Skip to contents

Run rate summation on a TPC with a functional form

Usage

nla_tpc_analytic(
  tpc_func,
  paramlist,
  dailytemps,
  tempaxis_name = "temp",
  minvalue = NULL,
  maxvalue = NULL,
  default_value = NULL
)

Arguments

tpc_func

The tpc function to apply.

paramlist

A named list of parameters (or vectors of parameters) for tpc_func. If paramlist$labels is provided, this will be used as the rownames of the resultant matrix.

dailytemps

A matrix of temperature across a 24 hour period at various mean temperatures.

tempaxis_name

Override the name of the temperature axis within the tpc func (if it is not "temp", the default in rTPC).

minvalue

Minimum value a TPC can have (acts as a lower clamp).

maxvalue

Maximum value a TPC can have (acts as a lower clamp).

default_value

Value to replace NaN results from the TPC with, should these occur (this may be changed later to a possible function instead).

Value

A matrix of averaged values, where columns are temperatures, and rows are individual tpc runs.

Examples

test_param_list <- list(
"a" = c(0.01, 0.02),
"b" = 2,
"tmin" = 10,
"tmax" = 30,
"labels" = c("test", "test2")
)
test_dt <- dt_sin(dtr = 15, tbar = seq(20,45,0.1), sunrise = 6, resolution = 0.5, clamp = TRUE)
nla_tpc_analytic(
  tpc_func = rTPC::briere2_1999,
  paramlist = test_param_list,
  dailytemps = test_dt,
  minvalue = 0,
  default_value = 0
  )
#>              20      20.1      20.2      20.3      20.4      20.5      20.6
#> test   7.084026  7.081722  7.077992  7.071788  7.065088  7.056767  7.047517
#> test2 14.168053 14.163444 14.155983 14.143576 14.130177 14.113533 14.095033
#>            20.7      20.8      20.9        21      21.1      21.2      21.3
#> test   7.034943  7.021881  7.005611  6.988321  6.970904  6.951111  6.928592
#> test2 14.069886 14.043761 14.011222 13.976641 13.941809 13.902222 13.857183
#>           21.4      21.5      21.6      21.7     21.8      21.9        22
#> test   6.90363  6.875735  6.844551  6.810082  6.77134  6.728894  6.683291
#> test2 13.80726 13.751470 13.689101 13.620165 13.54268 13.457788 13.366582
#>            22.1     22.2      22.3      22.4      22.5      22.6      22.7
#> test   6.632312  6.57431  6.508169  6.428159  6.310759  6.176481  6.110875
#> test2 13.264625 13.14862 13.016337 12.856318 12.621518 12.352962 12.221749
#>            22.8      22.9       23      23.1      23.2      23.3      23.4
#> test   5.990159  5.943883  5.88541  5.777854  5.743777  5.705526  5.654381
#> test2 11.980319 11.887765 11.77082 11.555709 11.487554 11.411052 11.308761
#>            23.5      23.6      23.7      23.8      23.9       24      24.1
#> test   5.553321  5.523997  5.496253  5.455858  5.415041  5.31757  5.302188
#> test2 11.106643 11.047995 10.992505 10.911716 10.830082 10.63514 10.604377
#>            24.2     24.3      24.4      24.5      24.6      24.7     24.8
#> test   5.278687  5.26158  5.230474  5.198336  5.147847  5.062847  5.03867
#> test2 10.557374 10.52316 10.460948 10.396672 10.295695 10.125694 10.07734
#>            24.9       25     25.1     25.2     25.3     25.4     25.5     25.6
#> test   5.027685 4.998712 4.975066 4.941003 4.911621 4.822654 4.814482 4.788869
#> test2 10.055369 9.997424 9.950132 9.882007 9.823242 9.645309 9.628965 9.577738
#>           25.7     25.8     25.9       26     26.1     26.2     26.3     26.4
#> test  4.786886 4.750364 4.745740 4.696703 4.662013 4.574890 4.568016 4.555371
#> test2 9.573772 9.500728 9.491481 9.393406 9.324025 9.149781 9.136031 9.110742
#>           26.5     26.6     26.7     26.8     26.9       27     27.1     27.2
#> test  4.543926 4.530592 4.513986 4.491688 4.465378 4.432196 4.351925 4.345403
#> test2 9.087853 9.061184 9.027973 8.983377 8.930755 8.864393 8.703850 8.690805
#>           27.3     27.4     27.5     27.6     27.7     27.8     27.9       28
#> test  4.342272 4.334329 4.329040 4.320963 4.309494 4.292802 4.271366 4.240274
#> test2 8.684543 8.668658 8.658079 8.641926 8.618988 8.585604 8.542733 8.480548
#>           28.1     28.2     28.3     28.4     28.5     28.6     28.7     28.8
#> test  4.161276 4.157841 4.152208 4.143579 4.133195 4.118931 4.100487 4.076124
#> test2 8.322552 8.315681 8.304417 8.287157 8.266391 8.237863 8.200973 8.152248
#>           28.9       29     29.1     29.2     29.3     29.4    29.5     29.6
#> test  4.042466 3.960236 3.954446 3.946634 3.936589 3.924466 3.90864 3.889849
#> test2 8.084932 7.920473 7.908893 7.893267 7.873178 7.848931 7.81728 7.779699
#>           29.7     29.8     29.9       30     30.1     30.2     30.3     30.4
#> test  3.866837 3.838946 3.800667 3.713769 3.702064 3.689437 3.674518 3.658784
#> test2 7.733674 7.677892 7.601334 7.427538 7.404128 7.378875 7.349037 7.317567
#>           30.5     30.6     30.7     30.8     30.9       31     31.1     31.2
#> test  3.636618 3.612737 3.584544 3.552914 3.509299 3.416932 3.397855 3.379323
#> test2 7.273237 7.225473 7.169088 7.105827 7.018597 6.833863 6.795710 6.758647
#>           31.3     31.4     31.5     31.6     31.7     31.8     31.9       32
#> test  3.358236 3.337966 3.306769 3.275021 3.237427 3.195006 3.099336 3.080087
#> test2 6.716471 6.675932 6.613538 6.550043 6.474854 6.390011 6.198672 6.160175
#>           32.1     32.2     32.3     32.4     32.5     32.6     32.7     32.8
#> test  3.052747 3.028564 3.008501 2.979064 2.938232 2.900218 2.856141 2.811991
#> test2 6.105494 6.057129 6.017001 5.958127 5.876463 5.800435 5.712281 5.623981
#>           32.9       33     33.1     33.2     33.3     33.4     33.5     33.6
#> test  2.709832 2.683845 2.642355 2.609629 2.589918 2.551925 2.485795 2.429122
#> test2 5.419663 5.367690 5.284710 5.219257 5.179836 5.103851 4.971590 4.858244
#>           33.7     33.8     33.9       34     34.1     34.2     34.3     34.4
#> test  2.323506 2.294009 2.261994 2.227161 2.189106 2.147257 2.100717 2.047858
#> test2 4.647013 4.588017 4.523988 4.454321 4.378212 4.294514 4.201434 4.095716
#>           34.5     34.6     34.7     34.8     34.9       35     35.1    35.2
#> test  1.984739 1.872232 1.835278 1.795065 1.751005 1.702187 1.646963 1.58137
#> test2 3.969477 3.744464 3.670556 3.590129 3.502010 3.404374 3.293927 3.16274
#>          35.3     35.4     35.5     35.6     35.7     35.8     35.9       36
#> test  1.46625 1.426508 1.383285 1.335935 1.283467 1.224127 1.153800 1.033111
#> test2 2.93250 2.853017 2.766571 2.671871 2.566934 2.448254 2.307601 2.066221
#>            36.1      36.2      36.3      36.4     36.5      36.6      36.7
#> test  0.9866164 0.9348617 0.8759955 0.8057535 0.684515 0.6364006 0.5810357
#> test2 1.9732329 1.8697234 1.7519911 1.6115070 1.369030 1.2728012 1.1620715
#>            36.8     36.9        37      37.1      37.2      37.3       37.4
#> test  0.5139352 0.395054 0.3475754 0.2883702 0.1767114 0.1333732 0.03919973
#> test2 1.0278704 0.790108 0.6951507 0.5767403 0.3534228 0.2667464 0.07839945
#>       37.5 37.6 37.7 37.8 37.9 38 38.1 38.2 38.3 38.4 38.5 38.6 38.7 38.8 38.9
#> test     0    0    0    0    0  0    0    0    0    0    0    0    0    0    0
#> test2    0    0    0    0    0  0    0    0    0    0    0    0    0    0    0
#>       39 39.1 39.2 39.3 39.4 39.5 39.6 39.7 39.8 39.9 40 40.1 40.2 40.3 40.4
#> test   0    0    0    0    0    0    0    0    0    0  0    0    0    0    0
#> test2  0    0    0    0    0    0    0    0    0    0  0    0    0    0    0
#>       40.5 40.6 40.7 40.8 40.9 41 41.1 41.2 41.3 41.4 41.5 41.6 41.7 41.8 41.9
#> test     0    0    0    0    0  0    0    0    0    0    0    0    0    0    0
#> test2    0    0    0    0    0  0    0    0    0    0    0    0    0    0    0
#>       42 42.1 42.2 42.3 42.4 42.5 42.6 42.7 42.8 42.9 43 43.1 43.2 43.3 43.4
#> test   0    0    0    0    0    0    0    0    0    0  0    0    0    0    0
#> test2  0    0    0    0    0    0    0    0    0    0  0    0    0    0    0
#>       43.5 43.6 43.7 43.8 43.9 44 44.1 44.2 44.3 44.4 44.5 44.6 44.7 44.8 44.9
#> test     0    0    0    0    0  0    0    0    0    0    0    0    0    0    0
#> test2    0    0    0    0    0  0    0    0    0    0    0    0    0    0    0
#>       45
#> test   0
#> test2  0