rsofun
R framework for site-scale simulations of ecosystem processes.
https://github.com/geco-bern/rsofun
Category: Biosphere
Sub Category: Plants and Vegetation
Keywords
dgvm growth modeling p-model simulation vegetation-dynamics
Keywords from Contributors
acclimation optimality-theory photosynthesis
Last synced: about 16 hours ago
JSON representation
Repository metadata
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.
- Host: GitHub
- URL: https://github.com/geco-bern/rsofun
- Owner: geco-bern
- License: gpl-3.0
- Created: 2018-10-24T15:48:42.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2025-04-16T10:08:54.000Z (11 days ago)
- Last Synced: 2025-04-17T23:54:22.579Z (9 days ago)
- Topics: dgvm, growth, modeling, p-model, simulation, vegetation-dynamics
- Language: Fortran
- Homepage: https://geco-bern.github.io/rsofun/
- Size: 171 MB
- Stars: 28
- Watchers: 9
- Forks: 32
- Open Issues: 19
- Releases: 11
-
Metadata Files:
- Readme: README.md
- Changelog: NEWS.md
- License: COPYING
README.md
rsofun
An R Simulating Optimal FUNctioning (RSOFUN) framework for site-scale simulations of ecosystem processes. The package contains the following modules:
- P-model for leaf-level acclimation of photosynthesis from Stocker et al. (2019).
- SPLASH for bioclimatic variables, including the surface radiation budget and the soil water balance from Davis et al. (2017).
- BiomeE for comprehensive simulations of ecosystem carbon and water cycling, tree growth, and tree cohort-explicit forest dynamics following the Perfect Plasticity Approximation, from Weng et al., (2015).
Installation
Stable release
To install the current stable release use a CRAN repository:
install.packages("rsofun")
library("rsofun")
Development release
To install the latest development release of the package run the following commands to install rsofun directly from GitHub:
if(!require(remotes)){install.packages("remotes")}
remotes::install_github("geco-bern/rsofun")
library("rsofun")
NOTE: Installing from GitHub requires compilation of Fortran and C source code contained in {rsofun}. To enable compiling source code, install Rtools on Windows, or Xcode and the GNU Fortran compiler on Mac (see also 'Mandatory tools' here). On Linux, the gfortran compiler is usually installed already.
Vignettes are not rendered by default, if you want to include additional documentation please use:
if(!require(remotes)){install.packages("remotes")}
remotes::install_github("geco-bern/rsofun", build_vignettes = TRUE)
library("rsofun")
From source
Assuming rsofun
is the location of the source directory, on can build the R package (with extension .tar.gz) from the command line using:
R CMD build --no-manual --no-build-vignettes rsofun
The package can then be installed with:
R CMD INSTALL -c --preclean *.tar.gz
, where the star *
can be replaced by the name of the package produced at the previous step.
Use
Below sections show the ease of use of the package in terms of model parameter specification and running both a single run or optimizing the parameters for a given site (or multiple sites). For an in depth discussion we refer to the vignettes.
Running model
With all data prepared we can run the P-model using runread_pmodel_f()
. This function takes the nested data structure and runs the model site by site, returning nested model output results matching the input drivers.
# define model parameter values from previous
# work
params_modl <- list(
kphio = 0.04998, # setup ORG in Stocker et al. 2020 GMD
kphio_par_a = 0.0, # set to zero to disable temperature-dependence of kphio
kphio_par_b = 1.0,
soilm_thetastar = 0.6 * 240, # to recover old setup with soil moisture stress
soilm_betao = 0.0,
beta_unitcostratio = 146.0,
rd_to_vcmax = 0.014, # value from Atkin et al. 2015 for C3 herbaceous
tau_acclim = 30.0,
kc_jmax = 0.41
)
# run the model for these parameters
output <- rsofun::runread_pmodel_f(
p_model_drivers,
par = params_modl
)
Parameter optimization
To optimize new parameters based upon driver data and a validation dataset we must first specify an optimization strategy and settings, as well as a cost function and parameter ranges.
settings <- list(
method = "GenSA",
metric = cost_rmse_pmodel,
control = list(
maxit = 100),
par = list(
kphio = list(lower=0.02, upper=0.2, init = 0.05)
)
)
rsofun
supports both optimization using the GenSA
and BayesianTools
packages. The above statement provides settings for a GenSA
optimization approach. For this example the maximum number of iterations is kept artificially low. In a real scenario you will have to increase this value orders of magnitude. Keep in mind that optimization routines rely on a cost function, which, depending on its structure influences parameter selection. A limited set of cost functions is provided but the model structure is transparent and custom cost functions can be easily written. More details can be found in the "Parameter calibration and cost functions" vignette.
In addition starting values and ranges are provided for the free parameters in the model. Free parameters include: parameters for the quantum yield efficiency kphio
, kphio_par_a
and kphio_par_b
, soil moisture stress parameters soilm_thetastar
and soilm_betao
, and also beta_unitcostratio
, rd_to_vcmax
, tau_acclim
and kc_jmax
(see ?runread_pmodel_f
). Be mindful that with newer versions of rsofun
additional parameters might be introduced, so re-check vignettes and function documentation when updating existing code.
With all settings defined the optimization function calib_sofun()
can be called with driver data and observations specified. Extra arguments for the cost function (like what variable should be used as target to compute the root mean squared error (RMSE) and previous values for the parameters that aren't calibrated, which are needed to run the P-model).
# calibrate the model and optimize free parameters
pars <- calib_sofun(
drivers = p_model_drivers,
obs = p_model_validation,
settings = settings,
# extra arguments passed to the cost function:
targets = "gpp", # define target variable GPP
par_fixed = params_modl[-1] # fix non-calibrated parameters to previous
# values, removing kphio
)
Data and code for model documentation paper (Paredes et al., in rev.)
Versioned releases of this repository are deposited on Zenodo (see badge at the top of the README file). Code to reproduce the analysis and plots presented here is contained in this repository (subdirectory analysis/
) and is demonstrated on the model documentation website (https://geco-bern.github.io/rsofun/, article ‘Sensitivity analysis and calibration interpretation’).
The model forcing and evaluation data is based on the publicly available FLUXNET2015 data for the site FR-Pue, prepared by FluxDataKit v3.4.2 (10.5281/zenodo.14808331), taken here as a subset of the originally published data for years 2007-2012. It is accessible through the {rsofun} R package and contained as part of this repository (subdirectory data/
) as CSV and as files. Outputs of the analysis presented here are archived in the analysis/paper_results_files/
subfolder.
The model documentation paper is currently under review.
A preprint is available at: https://www.biorxiv.org/content/10.1101/2023.11.24.568574v3
References
Stocker, B. D., Wang, H., Smith, N. G., Harrison, S. P., Keenan, T. F., Sandoval, D., Davis, T., and Prentice, I. C.: P-model v1.0: an optimality-based light use efficiency model for simulating ecosystem gross primary production, Geosci. Model Dev., 13, 1545–1581, https://doi.org/10.5194/gmd-13-1545-2020, 2020.
Davis, T. W., Prentice, I. C., Stocker, B. D., Thomas, R. T., Whitley, R. J., Wang, H., Evans, B. J., Gallego-Sala, A. V., Sykes, M. T., and Cramer, W.: Simple process-led algorithms for simulating habitats (SPLASH v.1.0): robust indices of radiation, evapotranspiration and plant-available moisture, Geoscientific Model Development, 10, 689–708, doi:10.5194/gmd-10-689-2017, URL http: //www.geosci-model-dev.net/10/689/2017/, 2017.
Weng, E. S., Malyshev, S., Lichstein, J. W., Farrior, C. E., Dybzinski, R., Zhang, T., Shevliakova, E., and Pacala, S. W.: Scaling from individual trees to forests in an Earth system modeling framework using a mathematically tractable model of height-structured competition, Biogeosciences, 12, 2655–2694, https://doi.org/10.5194/bg-12-2655-2015, 2015.
Acknowledgements
The {rsofun} is part of the LEMONTREE project and funded by Schmidt Futures and under the umbrella of the Virtual Earth System Research Institute (VESRI).
Owner metadata
- Name: GECO
- Login: geco-bern
- Email:
- Kind: organization
- Description: Geocomputation and Earth Observation at the University of Bern
- Website: geco-group.org
- Location: Switzerland
- Twitter: SteniBocker
- Company:
- Icon url: https://avatars.githubusercontent.com/u/93120344?v=4
- Repositories: 22
- Last ynced at: 2023-03-15T20:55:13.905Z
- Profile URL: https://github.com/geco-bern
GitHub Events
Total
- Create event: 28
- Release event: 2
- Issues event: 85
- Watch event: 4
- Delete event: 17
- Issue comment event: 180
- Push event: 242
- Pull request review event: 86
- Pull request review comment event: 63
- Pull request event: 46
- Fork event: 4
Last Year
- Create event: 28
- Release event: 2
- Issues event: 85
- Watch event: 4
- Delete event: 17
- Issue comment event: 180
- Push event: 242
- Pull request review event: 86
- Pull request review comment event: 63
- Pull request event: 46
- Fork event: 4
Committers metadata
Last synced: 7 days ago
Total Commits: 1,563
Total Committers: 24
Avg Commits per committer: 65.125
Development Distribution Score (DDS): 0.74
Commits in past year: 158
Committers in past year: 6
Avg Commits per committer in past year: 26.333
Development Distribution Score (DDS) in past year: 0.525
Name | Commits | |
---|---|---|
Pepa Aran Paredes | p****a@p****n | 407 |
Benjamin Stocker | b****r@g****m | 348 |
khufkens | k****s@g****m | 264 |
stineb | b****r@i****k | 189 |
Laura Marques | l****z@g****m | 115 |
marcadella | m****a@u****h | 75 |
Laura Marqués | l****s@g****h | 54 |
Fabian Bernhard | 1****n | 28 |
Laura Marques | l****a@p****n | 23 |
Pepa Arán | 6****n | 19 |
Joan Maspons | j****s@c****t | 18 |
marcadella | 3****a | 8 |
Benjamin Stocker | b****r@B****l | 4 |
stineb | b****r@g****m | 1 |
Benjamin Stocker | b****e@g****h | 1 |
Benjamin Stocker | b****e@e****h | 1 |
Benjamin Stocker | b****e@e****h | 1 |
Benjamin Stocker | b****e@e****h | 1 |
Benjamin Stocker | b****e@e****h | 1 |
Benjamin Stocker | b****e@e****h | 1 |
Benjamin Stocker | b****r@c****t | 1 |
Benjamin Stocker | b****r@B****l | 1 |
maloan | 5****n | 1 |
yunpeng | y****g@u****h | 1 |
Committer domains:
- creaf.uab.cat: 2
- pop-os.localdomain: 2
- usys.ethz.ch: 1
- eu-login-07-ng.euler.ethz.ch: 1
- eu-login-11-ng.euler.ethz.ch: 1
- eu-login-18.euler.ethz.ch: 1
- eu-login-24-ng.euler.ethz.ch: 1
- eu-login-47.euler.ethz.ch: 1
- gl141-210.ethz.ch: 1
- gmail.comm: 1
- gl142-110.ethz.ch: 1
- unibe.ch: 1
- imperial.ac.uk: 1
Issue and Pull Request metadata
Last synced: 1 day ago
Total issues: 131
Total pull requests: 135
Average time to close issues: 3 months
Average time to close pull requests: 9 days
Total issue authors: 8
Total pull request authors: 10
Average comments per issue: 2.92
Average comments per pull request: 1.17
Merged pull request: 110
Bot issues: 0
Bot pull requests: 0
Past year issues: 56
Past year pull requests: 46
Past year average time to close issues: 13 days
Past year average time to close pull requests: 4 days
Past year issue authors: 4
Past year pull request authors: 7
Past year average comments per issue: 3.45
Past year average comments per pull request: 1.39
Past year merged pull request: 33
Past year bot issues: 0
Past year bot pull requests: 0
Top Issue Authors
- marcadella (39)
- khufkens (31)
- stineb (28)
- pepaaran (18)
- fabern (10)
- jrmodel (2)
- FrancescoGrossi-unimi (2)
- Zinny-E (1)
Top Pull Request Authors
- khufkens (33)
- pepaaran (32)
- stineb (27)
- marcadella (18)
- fabern (9)
- lauramarques (4)
- jrmodel (4)
- FrancescoGrossi-unimi (3)
- jaideep777 (3)
- maloan (2)
Top Issue Labels
- enhancement (6)
- question (2)
- wontfix (1)
Top Pull Request Labels
Package metadata
- Total packages: 1
-
Total downloads:
- cran: 202 last-month
- Total dependent packages: 0
- Total dependent repositories: 0
- Total versions: 2
- Total maintainers: 1
cran.r-project.org: rsofun
The P-Model and BiomeE Modelling Framework
- Homepage: https://github.com/geco-bern/rsofun
- Documentation: http://cran.r-project.org/web/packages/rsofun/rsofun.pdf
- Licenses: GPL-3
- Latest release: 5.0.0 (published 5 months ago)
- Last Synced: 2025-04-25T14:04:55.118Z (1 day ago)
- Versions: 2
- Dependent Packages: 0
- Dependent Repositories: 0
- Downloads: 202 Last month
-
Rankings:
- Dependent packages count: 28.954%
- Dependent repos count: 36.973%
- Average: 50.896%
- Downloads: 86.762%
- Maintainers (1)
Dependencies
- R >= 3.6 depends
- BayesianTools * imports
- GenSA * imports
- dplyr * imports
- graphics * imports
- lubridate * imports
- magrittr * imports
- multidplyr * imports
- purrr * imports
- stats * imports
- tidyr * imports
- tidyselect * imports
- utils * imports
- covr * suggests
- ggplot2 * suggests
- knitr * suggests
- rmarkdown * suggests
- rpmodel * suggests
- testthat * suggests
- actions/cache v2 composite
- actions/checkout v2 composite
- actions/upload-artifact main composite
- r-lib/actions/setup-pandoc v2 composite
- r-lib/actions/setup-r v2 composite
- JamesIves/github-pages-deploy-action v4.4.1 composite
- actions/checkout v3 composite
- r-lib/actions/setup-pandoc v2 composite
- r-lib/actions/setup-r v2 composite
- r-lib/actions/setup-r-dependencies v2 composite
- actions/cache v2 composite
- actions/checkout v2 composite
- r-lib/actions/setup-pandoc v1 composite
- r-lib/actions/setup-r v1 composite
Score: 12.341407411099791