Repository navigation
BiomeEP: make ready for calibration to DBH distributions - #330
Conversation
Previously, cohorts within 20% relative DBH difference were merged. This has been reduced to 2%, with the aim to enable comparison with observed size distributions.
Thereby removing the more complicated relative threshold applied previously.
Colum order of these variables was wrong: "NSN","seedC","leafC","rootC","sapwoodC","heartwoodC"
Caused by warning: ! `case_match()` was deprecated in dplyr 1.2.0. i Please use `recode_values()` instead.
── Failure ('test-model-runs.R:64:3'): biomee output check (gs leuning) ────────
Expected `all.equal(...)` to be TRUE.
Differences:
`actual` is a character vector ('Mean relative difference: 0.0002914499')
`expected` is a logical vector (TRUE)
Following deprecation warnings starting with devtools 2.5.0 and following the instructions on https://devtools.r-lib.org/reference/install-deprecated.html
This streamlines the input preparation of the BiomeEP simulation
Namely: 'phenotype','Vmax','alphaBM','leafLS','lAImax','CNleaf0'
Namely: 'phenotype','Vmax','alphaBM','leafLS','lAImax','CNleaf0'
I.e. store them as part of the params_species_biomee and params_tile_biomee. Currently still hardcoded, but this allows for exposure of these in a next step.
… API)
This change is currently undocumented, since without specifying these parameters, BiomeEP continues to use the former hardcoded values as default.
This concerns parameters:
("kphio","beta","rd_to_vcmax","kc_jmax","kphio_par_a","kphio_par_b") in params_species and ("tau_acclim") in params_tile.
Small fix
Namely: 'gamma_L','Vannual','betaOFF','betaON', 'leaf_size' (all unused)
…th `mortrate_d_c`) Change value of mortrate_d_c in the example BiomeEP data set
This allows to use gdb instead of lldb. lldb has some shortcomings with Fortran, namely it can't explore variables at a breakpoint. The recommendation is therefore to use gdb. Since this is not available for arm-based "M4" Macs, we run an arm-based Linux in a Docker container. Use VSCode extension "Dev Containers" together with the specified Docker file. Step 1: "Dev Containers: Reopen in Container" Step 2: set a breakpoin in code. Step 3: go to the debug Tab in VSCode and click Play on the correct debug action "(gdb) Launch - MacBook Air M4".
…ohort_age`) If not provided it recovers old default of 0 years old at initialization.
…rt-with-full-initialization
…tion of NSC pool Since the function to compute bl_max and br_max war recently moved from Fortran to R (for the restarting), there had been a small bug (used `max()` instead of `pmax()`) which changed the initialization of NSC pools in case there were multiple species and one of them had LAI_light larger than 0.5.
f38c7c8 to
072fe00
Compare
…ablish-restart-with-full-initialization
| params_species <- tibble( | ||
| lifeform = c(0, 1, 1, 1, 1), # 0: grass; 1 Woody | ||
| phenotype = c(0, 0, 1, 1, 1), # 0: Deciduous; 1 Evergreen | ||
| phenotype = c(0, 1, 1, 1, 1), # 0: Deciduous; 1 Evergreen |
There was a problem hiding this comment.
Why was this changed? Better to change it back so that we still have a deciduous tree species in the example driver.
There was a problem hiding this comment.
Yes, do this in a next commit.
| do_relayer = .false. | ||
|
|
||
| ! update vegn GDD and tk_pheno | ||
| vegn%gdd = vegn%gdd + max(0.0, vegn%tk_daily - 278.15) |
There was a problem hiding this comment.
TODO: check why this could be removed
There was a problem hiding this comment.
This was removed because it was unused. The gdd (growing degrees days) we use is actually computed on the cohort level cc%gdd. It would actually not be needed to be computed on the cohort level since it anyway uses a hardcoded threshold of 5 degC. But technically that approach would enable a species-specific critical threshold for GDD accumulation.
| self%out_annual_cohorts(:, ANNUAL_COHORTS_ID) = 0 | ||
| self%out_annual_cohorts(:, ANNUAL_COHORTS_CID) = 0 |
There was a problem hiding this comment.
Is this change needed/usesful? If I remember correctly this was added to diagnose during debugging.
There was a problem hiding this comment.
No, it is not needed. It would give addtional safety if a row in the output corresponds to an existing cohort, but at slight additional code and computational complexity. => not needed.
We need a way to filter out on R side rows of out_annual_cohorts that were not filled by the output loop over all cohorts. These rows exist because there can be less cohorts simulated than NCohortMax. This filtering is done on column ANNUAL_COHORTS_YEAR. If this is zero then it indicates that the row was not overwritten. We don't need ANNUAL_COHORTS_ID or ANNUAL_COHORTS_CID for that.
| # BiomeE: test model outputs, repeatability and agreement with reference values from subfolder ./_snaps/ | ||
| set.seed(10) | ||
|
|
||
| test_that("BiomeEP Tksoil initial days (rolling mean, smoothed)", { |
There was a problem hiding this comment.
Is it useful to have this test?
There was a problem hiding this comment.
I think it does not hurt.
… default simulation by changing This also switches back the second species to be deciduous. And the third species to be evergreen. NOTE: tests only use evergreen species.
cf52b9d to
89a30d0
Compare
0232080 to
56e15b5
Compare
|
This is ready to merge. |
This PR results from changes in
All the changes that are user-facing are documented in
NEWS.md.Specifics for this PR:
This PR adds print statements for debugging the restarting.
Validation:
With a better diff tool than GitHub (e.g. such as GtiKraken), the change in file
rsofun/tests/testthat/_snaps/model-runs-snapshot-biomee.mdshows:biomee_res$out_daily_tileresults at year 1 and at year 251biomee_res$out_annual_tileresultsbiomee_res$out_annual_cohortresults at year 1 (initialization) butbiomee_res$out_annual_cohortresults at yearmod_BiomeE_Pmodel_oac_yr251andmod_BiomeE_PLULUC_primary_oac_yr251,mod_BiomeE_gsLeun_oac_yr251~~Current status: test fails. ~~
Judging the print output of the test, it appears thatcohorts are correctly initialized.cohorts are (in printout) not yet summarised on tile level (e.g. pleaf_c=0)dtemp_pvy and wscal_pvy are not initializedwscal_alldays is different