vignettes/1_p-model_reference_run.Rmd
1_p-model_reference_run.Rmd
This workflow runs the P-model with {rsofun} v4.2 and forcing as used in Stocker et al. (2020). Calibration and evaluation data is also as in Stocker et al. (2020). All data is from files created for Stocker et al. (2020). Results are almost identical as presented in Stocker et al. (2020). Slight deviations are related to the fact that rsofun v4.2 performs time series simulations with continuous acclimation - not for monthly means as done in Stocker et al. (2020). The workflow here provides an exact reproduction of code in sofunBench for v4.2.
Model parameters are determined for this version from calibration.
The code for model calibration is not shown. See
vignettes/1_p-model_reference_run.Rmd
for the code.
params_modl <- list(
kphio = 0.09423773, # pars$par[1],
soilm_par_a = 0.33349283, # pars$par[2],
soilm_par_b = 1.45602286, # pars$par[3],
tau_acclim_tempstress = 10, # irrelevant - not calibrated
par_shape_tempstress = 0.0 # irrelevant - not calibrated
)
output <- rsofun::runread_pmodel_f(
df_drivers_fluxnet2015 |>
dplyr::mutate(forcing = purrr::map(forcing, ~rename(., rain = rainf, snow = snowf))),
par = params_modl
)
This runs the eval_sofun()
routine included in the
sofunCalVal package, and outputs daily, monthly and annual summary
statistics comparing observed with simulated values. We’ll retake this
same routine when running on the latest release (i.e. the workflow is
equivalent but for the release of the rsofun
package)
Level | rsq | rmse | slope | bias | nvals |
---|---|---|---|---|---|
daily_pooled | 0.6822030 | 2.237670 | 0.9424125 | 0.0168156 | 237777 |
xdaily_pooled | 0.7402749 | 1.968332 | 1.0276624 | 0.0211308 | 33152 |
annual_pooled | 0.6888402 | 391.843125 | 1.0841131 | -15.8487457 | 598 |
monthly_pooled | 0.7655718 | 1.789852 | 1.0570757 | -0.1032881 | 7428 |
spatial | 0.7050382 | 409.730725 | 1.0358195 | -32.6734855 | 109 |
anomalies_annual | 0.0770564 | 176.099264 | 0.4296991 | -3.4124489 | 598 |
meandoy | 0.7358411 | 1.813804 | 1.0070837 | 0.1051432 | 42844 |
anomalies_daily | 0.2629290 | 1.569327 | 0.4433198 | -0.0317397 | 237603 |
meanxoy | 0.7617283 | 1.696434 | 1.0315764 | 0.0872718 | 5528 |
anomalies_xdaily | 0.1409777 | 1.214267 | 0.4071741 | -0.0036830 | 33152 |
Since rsofun takes time series forcing, overwrite forcing with
constant values corresponding to the arguments provided to
rpmodel::rpmodel()
.
## [1] "Are values equivalent?"
## [1] "- ci:ca: Mean relative difference: 0.00444033"
## [1] "- GPP: Mean relative difference: 0.3456686"
## [1] "- Vcmax: Mean relative difference: 0.3313334"
## [1] "- Vcmax25: Mean relative difference: 0.3313316"
## [1] "- Jmax: Mean relative difference: 0.3450332"
## [1] "- Jmax25: Mean relative difference: 0.3450321"
## [1] "Are values equivalent for:"
## [1] "- ci:ca: Mean relative difference: 0.00444033"
## [1] "- GPP: Mean relative difference: 0.00254358"
## [1] "- Vcmax: Mean relative difference: 0.01930885"
## [1] "- Vcmax25: Mean relative difference: 0.01931158"
## [1] "- Jmax: Mean relative difference: 0.001575214"
## [1] "- Jmax25: Mean relative difference: 0.001573512"
## R version 4.4.1 (2024-06-14)
## Platform: x86_64-pc-linux-gnu
## Running under: Ubuntu 22.04.5 LTS
##
## Matrix products: default
## BLAS: /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3
## LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/libopenblasp-r0.3.20.so; LAPACK version 3.10.0
##
## locale:
## [1] LC_CTYPE=C.UTF-8 LC_NUMERIC=C LC_TIME=C.UTF-8
## [4] LC_COLLATE=C.UTF-8 LC_MONETARY=C.UTF-8 LC_MESSAGES=C.UTF-8
## [7] LC_PAPER=C.UTF-8 LC_NAME=C LC_ADDRESS=C
## [10] LC_TELEPHONE=C LC_MEASUREMENT=C.UTF-8 LC_IDENTIFICATION=C
##
## time zone: UTC
## tzcode source: system (glibc)
##
## attached base packages:
## [1] stats graphics grDevices utils datasets methods base
##
## other attached packages:
## [1] RColorBrewer_1.1-3 here_1.0.1 ggthemes_5.1.0 knitr_1.48
## [5] lubridate_1.9.3 ggplot2_3.5.1 readr_2.1.5 tidyr_1.3.1
## [9] dplyr_1.1.4 rsofun_4.2 rpmodel_1.2.3
##
## loaded via a namespace (and not attached):
## [1] remotes_2.5.0 rlang_1.1.4 magrittr_2.0.3
## [4] compiler_4.4.1 mgcv_1.9-1 systemfonts_1.1.0
## [7] callr_3.7.6 vctrs_0.6.5 stringr_1.5.1
## [10] profvis_0.4.0 pkgconfig_2.0.3 crayon_1.5.3
## [13] fastmap_1.2.0 ellipsis_0.3.2 labeling_0.4.3
## [16] utf8_1.2.4 promises_1.3.0 rmarkdown_2.28
## [19] sessioninfo_1.2.2 tzdb_0.4.0 ps_1.8.1
## [22] nloptr_2.1.1 ragg_1.3.3 purrr_1.0.2
## [25] bit_4.5.0 xfun_0.48 cachem_1.1.0
## [28] jsonlite_1.8.9 highr_0.11 later_1.3.2
## [31] parallel_4.4.1 R6_2.5.1 bslib_0.8.0
## [34] stringi_1.8.4 boot_1.3-30 pkgload_1.4.0
## [37] jquerylib_0.1.4 Rcpp_1.0.13 usethis_3.0.0
## [40] DHARMa_0.4.7 httpuv_1.6.15 Matrix_1.7-0
## [43] splines_4.4.1 timechange_0.3.0 tidyselect_1.2.1
## [46] yaml_2.3.10 miniUI_0.1.1.1 curl_5.2.3
## [49] processx_3.8.4 pkgbuild_1.4.5 plyr_1.8.9
## [52] lattice_0.22-6 tibble_3.2.1 shiny_1.9.1
## [55] withr_3.0.2 bridgesampling_1.1-2 coda_0.19-4.1
## [58] evaluate_1.0.1 desc_1.4.3 urlchecker_1.0.1
## [61] pillar_1.9.0 generics_0.1.3 vroom_1.6.5
## [64] rprojroot_2.0.4 hms_1.1.3 BayesianTools_0.1.8
## [67] munsell_0.5.1 scales_1.3.0 minqa_1.2.8
## [70] xtable_1.8-4 glue_1.8.0 GenSA_1.1.14.1
## [73] tools_4.4.1 lme4_1.1-35.5 fs_1.6.4
## [76] mvtnorm_1.3-1 grid_4.4.1 yardstick_1.3.1
## [79] devtools_2.4.5 colorspace_2.1-1 nlme_3.1-164
## [82] cli_3.6.3 textshaping_0.4.0 fansi_1.0.6
## [85] Brobdingnag_1.2-9 gtable_0.3.6 sass_0.4.9
## [88] digest_0.6.37 htmlwidgets_1.6.4 farver_2.1.2
## [91] memoise_2.0.1 htmltools_0.5.8.1 pkgdown_2.1.1
## [94] lifecycle_1.0.4 mime_0.12 bit64_4.5.2
## [97] MASS_7.3-60.2