rsofuncpp is a drop-in, C++17/Rcpp replacement for the rsofun ecosystem model package. It preserves the public R API and bundled validation data while removing the Fortran 90 build dependency.
| Model | Status | Backend | Parity |
|---|---|---|---|
| P-model | Ready | C++17 / Rcpp | ~1e-13 vs rsofun Fortran output |
| BiomeE | Ready | C++17 / Rcpp | within rsofun snapshot tolerances; Density residual documented in inst/parity-notes/biomee-density-parity.md |
| Calibration | Ready | R wrappers (GenSA, optional BayesianTools) |
P-model and BiomeE; Stan integration pending |
See inst/notes/project-status.md for the full progress report.
The package follows the SSDLC used across the alrobles R portfolio: a pure-R reference (_r) is retained, a C++17 implementation (_cpp) is added, and testthat parity tests (test-*_cpp_vs_r.R) gate public dispatch. See inst/parity-notes/consistency-tests.md for the full comparison protocol against rsofun.
rsofuncpp is an independent downstream reimplementation of the rsofun R package developed by the Geocomputation and Earth Observation group at the University of Bern. It is not an official fork, but it is intended to be a drop-in, API-compatible replacement and a testbed for a modern C++17 backend.
- Original repository: https://github.com/geco-bern/rsofun
rsofunv5.1 paper (GMD, 2025): Paredes, J. A., Bernhard, F., Hufkens, K., Marcadella, M., & Stocker, B. D. rsofun v5.1: a model-data integration framework for simulating ecosystem processes. https://doi.org/10.5194/gmd-18-9855-2025- P-model (GMD, 2020): Stocker, B. D., Wang, H., Smith, N. G., et al. Development and evaluation of a geographically scalable plant phenology model. https://doi.org/10.5194/gmd-13-1545-2020
All scientific concepts, equations, and default parameter values come from these publications and from the rsofun source code. The rsofuncpp contribution is the C++17/Rcpp implementation, the parity validation suite, and the multi-site parallel dispatcher.
# install.packages("remotes")
remotes::install_github("alrobles/rsofuncpp")library(rsofuncpp)
data(p_model_drivers)
out <- runread_pmodel(drivers = p_model_drivers, par = list(
kphio = 0.04998,
kphio_par_a = 0.0,
kphio_par_b = 1.0,
soilm_thetastar = 144.0,
soilm_betao = 0.0,
beta_unitcostratio = 146.0,
rd_to_vcmax = 0.014,
tau_acclim = 30.0,
kc_jmax = 0.41
))
head(out$data[[1]])See vignette("pmodel_use") and ?run_pmodel_bysite for details.
R CMD build .
R CMD check --as-cran --no-manual .GPL (>= 3)
https://github.com/geco-bern/rsofun
Stocker, B. D., Wang, H., Smith, N. G., et al. (2020). Development and evaluation of a geographically scalable plant phenology model. Geoscientific Model Development, 13, 1545–1581. https://doi.org/10.5194/gmd-13-1545-2020.
Stocker, B., Hufkens, K., Bernhard, F., et al. (2025). geco-bern/rsofun: rsofun 5.1.0. Zenodo. https://doi.org/10.5281/zenodo.17313273.
Paredes, J. A., Bernhard, F., Hufkens, K., et al. (2025). rsofun v5. 1: a model-data integration framework for simulating ecosystem processes. Geoscientific Model Development, 18(23), 9855–9878.