Skip to content

Prepare addition/replacement of p-model example data#322

Merged
fabern merged 81 commits into
masterfrom
update-vignettes-with-gmd-paper
Dec 19, 2025
Merged

Prepare addition/replacement of p-model example data#322
fabern merged 81 commits into
masterfrom
update-vignettes-with-gmd-paper

Conversation

@fabern

@fabern fabern commented Nov 14, 2025

Copy link
Copy Markdown
Member

This PR

  • includes data from the rsofun documentation paper as the new example data sets.
    • details are summarised in the NEWS.md. briefly,
      • we now use runread_pmodel for both daily and onestep simulation by using a column onestep == TRUE/FALSE in the params_siml of the pmodel_drivers. This replaces the use of run_pmodel_onestep_f_bysite() by the end user.
      • we updated example data sets with additional sites and renamed them to pmodel_drivers and pmodel_validation to reduce potential bugs (also previous data sets were renamed to p_model_oldformat_drivers and p_model_oldformat_validation and will soon be entirely removed from the package)
      • we now support more complex priors as showcased in the documentation paper, see createMixedPrior()
  • updates the vignettes to a similar calibration as shown in the documentation paper.

Note that, for simplicity, we could have similarly updated the biomee_validation data.frame to a similar format. Note that the drivers biomee_[xxx]_drivers does not need an update (since there is no onestep function for biomee).

For the moment it was decided against updating biomee_validation (in case we want to do later, see code in commit c10f8cc). But such an approach will likely be needed for future multi-target calibrations of BiomeE.

For a summary of changes have a look at NEWS.md

This uses the interface and data format of the target data.frame as used in the rsofun_doc repository.

TODO: next steps are
- to make this backward compatible with the old input format and arguments, if possible.
- - do this by replacing the examples and tests of calib_sofun() with calib_sofun_parallelized() across the package
- - and eventually replace the files in data/*.rda
- to remove traces of the VJ target
- also use get_mod_obs_pmodel_bigD13C_vj_gpp() for predictive plot (time series) in the vignettes.
Since we update the data format, this keeps the "_oldformat" around for development.
During development we want:
- to replace occurrences of "_oldformat" to the new format
- keep around "_oldformat" to ensure backward compatible functions.
…l..'

This is to replace the `..._oldformat_...` in upcoming commits.
This is done by removing `onestep` simulations from the new data set and explicitly treating multiple sites when plotting.
* runread_pmodel() had a bug for onestep. Now fixed.
* Also includes changes to tests to remove warnings.
This reduces code duplication (parallel and non-parallel versions) and makes pmap more robust by using named arguments instead of relying on positional arguments.
This also updates `cost_likelihood_pmodel()` and`cost_rmse_pmodel()`
@fabern fabern requested review from stineb and removed request for stineb December 16, 2025 12:56
@stineb

stineb commented Dec 16, 2025

Copy link
Copy Markdown
Collaborator

Great work!
Now may be a good time to run styler for tidyverse-styling throughout.
I didn't merge also because some tests are still failing.

@fabern

fabern commented Dec 16, 2025

Copy link
Copy Markdown
Member Author

Yes, the macOS test is currently failing probably due to some network issue installing an unrelated package xfun.
I will run the styler using the non-strict formatting.

@fabern

fabern commented Dec 16, 2025

Copy link
Copy Markdown
Member Author

Okay, I did now: library(styler); styler::style_pkg(style = styler::tidyverse_style, strict=FALSE).
And got the following output:

Styling  34  files:
 R/calib_sofun_legacy.R                           ℹ 
 R/calib_sofun.R                                  ℹ 
 R/cost_likelihood_biomee.R                       ℹ 
 R/cost_likelihood_pmodel_legacy.R                ℹ 
 R/cost_likelihood_pmodel.R                       ℹ 
 R/cost_rmse_biomee.R                             ℹ 
 R/cost_rmse_pmodel.R                             ℹ 
 R/createMixedPrior.R                             ℹ 
 R/data.R                                         ℹ 
 R/luluc.R                                        ℹ 
 R/run_biomee_f_bysite.R                          ℹ 
 R/run_pmodel_f_bysite.R                          ℹ 
 R/run_pmodel_onestep_f_bysite.R                  ℹ 
 R/runread_biomee_f.R                             ⚠ 
 R/runread_pmodel_f.R                             ℹ 
 tests/testthat.R                                 ✔ 
 tests/testthat/helpers.R                         ℹ 
 tests/testthat/test-calibration-biomee.R         ℹ 
 tests/testthat/test-calibration-pmodel.R         ℹ 
 tests/testthat/test-likelihoods.R                ℹ 
 tests/testthat/test-model-runs-snapshot-biomee.R ℹ 
 tests/testthat/test-model-runs.R                 ℹ 
 tests/testthat/test-quantitative-validation.R    ℹ 
 data-raw/generate_biomee_drivers.R               ℹ 
 data-raw/generate_biomee_output.R                ℹ 
 data-raw/generate_pmodel_drivers.R               ℹ 
 data-raw/generate_pmodel_output.R                ℹ 
 vignettes/biomee_luluc.Rmd                       ℹ 
 vignettes/biomee_use.Rmd                         ℹ 
 vignettes/data_format.Rmd                        ℹ 
 vignettes/new_cost_function.Rmd                  ℹ 
 vignettes/param_calib_multitarget.Rmd            ℹ 
 vignettes/pmodel_use.Rmd                         ℹ 
 vignettes/sensitivity_analysis.Rmd               ℹ 
────────────────────────────────────────────────
Status	Count	Legend 
✔ 	1	File unchanged.
ℹ 	32	File changed.
✖ 	1	Styling threw an error.
────────────────────────────────────────────────

I hope this does not bite me for the merge of phydro. (But I think I could separately do the same in the phydro branch to reduce potential issues.)

library(styler); styler::style_pkg(style = styler::tidyverse_style, strict=FALSE)
@stineb

stineb commented Dec 16, 2025

Copy link
Copy Markdown
Collaborator

I don't think this will bite you as phydro mainly has new developments at the Fortran level, which is left untouched by styler.

…ings_runMCMC

This should help to make code clearer and easier to distinguish between these two settings.

And this also add renames `sampler` to `sampler_runMCMC` for consistency.

This is fully backwards compatible because of partial name matching for argument names (settings_calibrate) and for list element names (settings_runMCMC, sampler_runMCMC). Nevertheless, for settings_calibrate we still included a warning about deprecated use.
n_chains_independent => nrChains
n_parallel_independent => n_parallel_nrChains

@fabern fabern left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Self-review done. This can be merged!

@fabern fabern merged commit 3a93439 into master Dec 19, 2025
7 checks passed
@fabern fabern deleted the update-vignettes-with-gmd-paper branch December 19, 2025 09:07
fabern added a commit to fabern/rsofun that referenced this pull request Dec 21, 2025
…tes-with-gmd-paper"

This reverts commit 3a93439, reversing
changes made to b5999ca.

This is to ensure installing the package from GitHub and checking the Documentation (geco-bern.github.io/rsofun/) do both refer to v5.1.0 over the holidays.
fabern added a commit that referenced this pull request Dec 21, 2025
…gmd-paper"

This reverts commit 3a93439, reversing
changes made to b5999ca.

This is to ensure installing the package from GitHub and checking the Documentation (geco-bern.github.io/rsofun/) do both refer to v5.1.0 over the holidays.
fabern added a commit that referenced this pull request Jan 6, 2026
@fabern

fabern commented Jan 6, 2026

Copy link
Copy Markdown
Member Author

This has been reverted in the main branch to avoid overwriting the documentations website.

The main branch has now been changed to distinguish between release and development documentations.
Thus the changes from this reverted PR will be merged again under PR #324.

So this can remain closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants