Skip to content
alroblesPublic
forked from geco-bern/rsofun

About

Implements the Simulating Optimal FUNctioning framework for site-scale simulations of ecosystem processes, including model calibration. It contains Fortran 90 modules for the P-model, SPLASH, and BiomeE models.

Resources

Stars

1 star

Watchers

0 watching

Forks

 
 

Repository files navigation

rsofuncpp

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.

Status

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.

Origin and attribution

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.

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.

Installation

# install.packages("remotes")
remotes::install_github("alrobles/rsofuncpp")

Quick start

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.

Development

R CMD build .
R CMD check --as-cran --no-manual .

License

GPL (>= 3)

Original repository link

https://github.com/geco-bern/rsofun

References

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.

About

Implements the Simulating Optimal FUNctioning framework for site-scale simulations of ecosystem processes, including model calibration. It contains Fortran 90 modules for the P-model, SPLASH, and BiomeE models.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages