| Title: | The P-Model and BiomeE Modelling Framework |
|---|---|
| Description: | 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 (Stocker et al. (2020) <doi:10.5194/gmd-13-1545-2020>), SPLASH (Davis et al. (2017) <doi:10.5194/gmd-10-689-2017>) and BiomeE (Weng et al. (2015) <doi:10.5194/bg-12-2655-2015>). |
| Authors: | Benjamin Stocker [aut, cre] (ORCID: <https://orcid.org/0000-0003-2697-9096>), Koen Hufkens [aut] (ORCID: <https://orcid.org/0000-0002-5070-8109>), Josefa Arán Paredes [aut] (ORCID: <https://orcid.org/0009-0006-7176-2311>), Laura Marqués [ctb] (ORCID: <https://orcid.org/0000-0002-3593-5557>), Mayeul Marcadella [ctb] (ORCID: <https://orcid.org/0000-0001-8555-3808>), Ensheng Weng [ctb] (ORCID: <https://orcid.org/0000-0002-1858-4847>), Fabian Bernhard [aut] (ORCID: <https://orcid.org/0000-0003-0338-0961>), Geocomputation and Earth Observation, University of Bern [cph, fnd] |
| Maintainer: | Benjamin Stocker <[email protected]> |
| License: | GPL-3 |
| Version: | 5.1.0.9001 |
| Built: | 2026-10-25 09:04:35 UTC |
| Source: | https://github.com/geco-bern/rsofun |
Example driver to run the BiomeE-model at the CH-LAE site
using the Leuning photosynthesis specification (and half-hourly time step)
It can also be used together with leaf trait data from CH-LAE (biomee_validation)
to optimize model parameters.
biomee_gs_leuning_driversbiomee_gs_leuning_drivers
A tibble of driver data.
Site name
Simulation parameters as a data.frame, including the following data:
Flag indicating whether this simulation does spin-up (deprecated).
Number of spin-up years. Set to 0 for no spinup.
Number of first N years of forcing data.frame that are recycled for spin-up.
Year of first transient year (AD) (optional). Is only used to set years in output data frames. Defaults to 0 if not provided.
Number of transient years (optional). Determines the length of simulation output after spin-up. Defaults to number of years contained in the forcing data. (If longer than forcing data, last year of forcing is repeated until the end (spin-down).)
Time resolution of the forcing (day-1).
Flag indicating whether U-shaped mortality is used.
Flag indicating whether doing N closed runs to recover N balance enforcing 0.2 kg N m-2 in the inorganic N pool.
String specifying the method of photosynthesis used in the model, either "pmodel" or "gs_leuning".document()
String indicating the type of mortality in the model. One of the following: "dbh" is size-dependent mortality, "const_selfthin" is constant self thinning (in development), "cstarvation" is carbon starvation, and "growthrate" is growth rate dependent mortality.
Whether to output daily diagnostics ('output_daily_tile'). Default: True.
Site meta info in a data.frame. This data structure can be freely used for documenting the dataset, but must include at least the following data:
Longitude of the site location in degrees east.
Latitude of the site location in degrees north.
Elevation of the site location, in meters above sea level.
Forcing data.frame used as input
Photosynthetic photon flux density (mol m-2 s-1)
Air temperature (deg C)
Vapor pressure deficit (Pa)
Precipitation (kgH2O m-2 s-1 == mm s-1)
Wind velocity (m s-1)
Atmospheric pressure (Pa)
Atmospheric CO concentration in ppm.
Tile-level model parameters, into a single row data.frame, including the following data:
Integer indicating the type of soil: Sand = 1, LoamySand = 2, SandyLoam = 3, SiltLoam = 4, FrittedClay = 5, Loam = 6, Clay = 7.
Field capacity (vol/vol). Water remaining in a soil after it has been thoroughly saturated and allowed to drain freely.
Wilting point (vol/vol). Water content of a soil at which plants wilt and fail to recover.
Fast soil C decomposition rate (yr).
Slow soil C decomposition rate (yr).
Mineral Nitrogen turnover rate (yr).
Ratio of C and N returned to litters from microbes.
N loss rate through runoff (organic and mineral) (yr).
Minimum LMA, leaf mass per unit area, LMAmin/LMA describes fraction of leaf that become fine litter (metabolic parts), kg C m. Has to be smaller than LMA. Difference to LMA is structural parts (becoming coarse litter).
Fraction of fast turnover carbon in fine biomass.
Fraction of fast turnover carbon in wood biomass.
Fraction of the carbon retained after leaf drop.
Retranslocation coefficient of nitrogen.
Coefficient for setting up initial sapwood.
Re-fill of N for sapwood.
Calibratable scalar for respiration, used to increase LUE levels.
A data.frame containing species-specific model parameters, with one species per row, including the following data:
Integer set to 0 for grasses and 1 for trees.
Integer indicating the type of plant according to photosynthesis: 0 for C3; 1 for C4
Fine root turnover rate (yr).
Material density of fine roots (kg C m).
Radius of the fine roots, in m.
e-folding parameter of root vertical distribution, in m.
Fine root water conductivity (mol m s MPa).
Wet leaf photosynthesis down-regulation.
Factor of stomatal conductance.
Photosynthesis efficiency.
Leaf respiration coefficient per unit N, in molC kgN yr.
Sapwood respiration rate, in kg C m yr.
Fine root respiration rate, kg C kg C yr.
Critical temperature triggering offset of leaf phenology (unused with evergreen), in Kelvin.
Critical temperature triggering onset of leaf phenology (unused with evergreen), in Kelvin.
Critical value of GDD5 for turning ON leaf phenology (unused with evergreen).
Quantum yield efficiency at optimal temperature, in mol mol. (optional, defaults to 0.05)
Unit cost ratio of carboxylation to transpiration, unitless. (optional, defaults to 146.0)
Ratio of Rdark to Vcmax25, unitless. (optional, defaults to 0.014)
Jmax cost ratio, unitless. (optional, defaults to 0.41)
Shape parameter of temperature-dependency of quantum yield efficiency, in degC. (optional, defaults to 0.0)
Optimal temperature of quantum yield efficiency, in degC. (optional, defaults to 25.0)
Coefficient for allometry (height = alphaHT * DBH_m ** thetaHT), in m m.
Coefficient for allometry (height = alphaHT * DBH_m ** thetaHT), unitless.
Coefficient for allometry (biomass = alphaBM * DBH ** thetaBM), unitless. Since alphaBM is derived from alphaHT, it makes sense to also ensure thetaBM = thetaHT + 2.
Coefficient for allometry (projected crown area = alphaCA * DBH_m ** thetaCA), in m .
Coefficient for allometry (projected crown area = alphaCA * DBH_m ** thetaCA), unitless. Dybzinski (eq. G1) showed that thetaCA = thetaBM - 1. Moreover, Weng et al. (2015, eq A2) uses thetaBM = thetaHT + 2.
Wood density (kg C m). (Only used to derive alphaBM.)
Multiplicative factor to correct the cylindric volume/mass calculated with DBH, unitless. E.g. for a cone taperfactor is 1/3 (V = 1/3 Pi * r^2 * HT). (Only used to derive alphaBM.)
Ratio of sapwood area to leaf area.
Ratio of fine root to leaf area.
TODO: same as kappa below) light extinction coefficient in the canopy (Beer's law), unitless. (optional, defaults to 0.75)
light extinction coefficient in the canopy (Beer's law), unitless. (optional, defaults to 0.5)
Initial size of seedlings, in kg C per individual.
Age at which trees can reproduce (years).
Fraction of G_SF to G_F.
Canopy tree mortality rate (yr).
(Differently used depending on method_mortality and do_U_shaped_mortality:
CAI_max (m m) if "const_selfthin",
multiplicative factor (-) if "cstarvation" (),
multiplicative factor (yrm) (deathrate = par_mort * dbh ** 1.5) if "dbh" and "do_U_shaped_mortality"
)
Understory tree mortality rate (yr).
A coefficient in understory mortality rate correction, (deathrate = mortrate_d_u * (1+A*exp(B*DBH))/(1+exp(B*DBH))), in year. (optional, defaults to 9.0)
B coefficient in understory mortality rate correction, (deathrate = mortrate_d_u * (1+A*exp(B*DBH))/(1+exp(B*DBH))), in m. (optional, defaults to -60.0)
Leaf mass per unit area (kg C m).
Basal leaf N per unit leaf area, in kg N m. NOTE: it is used to represent the N content in metabolic parts of the leaf. (TODO: correct?)
C/N ratio of the structural parts of the leaf (non-metabolic parts).
Residence time of C in NSC (to define storage capacity), in years.
Max fraction of total C growth that is allocated to leaves and fine root (remaining C growth used for seeds and DBH growth), unitless. (optional, defaults to 0.85)
#'
Multiplier for NSNmax as sum of potential bl and br.
Fraction of internal gaps in the canopy
C/N ratio of sapwood, in kg C kg N.
C/N ratio of heartwood, in kg C kg N.
C/N ratio of roots, in kg C kg N.
C/N ratio of seeds, in kg C kg N.
Reference N fixation rate (kg N kg C root).
Carbon cost of N fixation (kg C kg N).
Maximum LAI limited by light.
A data.frame of initial cohort specifications, including the following data:
Index of a species described in param_species.
Initial tree/cohort age, in yr. (optional) Default: 0.
Initial individual density, in individuals per m.
Initial biomass of leaf, in kg C per individual.
Initial biomass of fine root, in kg C per individual.
Initial biomass of sapwood, in kg C per individual.
Initial biomass of heartwood, in kg C per individual.
Initial biomass of seed, in kg C per individual.
Initial non-structural biomass, in kg C per individual. (optional, defaults to value derived from br_max and bl_max)
Initial nitrogen in leaf, in kg N per individual. (optional, defaults to C biomass * CN-ratio)
Initial nitrogen in fine root, in kg N per individual. (optional, defaults to C biomass * CN-ratio)
Initial nitrogen in sapwood, in kg N per individual. (optional, defaults to C biomass * CN-ratio)
Initial nitrogen in heartwood, in kg N per individual. (optional, defaults to C biomass * CN-ratio)
Initial nitrogen in seed, in kg N per individual. (optional, defaults to C biomass * CN-ratio)
Initial non-structural biomass, in kg N per individual. (optional, defaults to value derived from br_max and bl_max)
Land use type this cohorts belongs to (given as index in init_lu aray). (optional) Default: 0 (attach to all LU types except thoses which do not accept vegetation – cf init_lu.vegetated).
Restart phenology status for the cohort ('0' = leaf-off, '1' = leaf-on). Optional; when omitted, a cold-start default is used.
Restart canopy layer for the cohort. Optional; when omitted, cohorts are relayered as in a cold start.
Restart flag indicating whether the cohort has previously occupied the top layer. Optional.
Restart growing degree days stored on the cohort. Optional.
Restart leaf age, in years. Optional.
Restart count of years spent in the top canopy layer. Optional.
Restart target leaf biomass ('bl_max'), in kg C per individual. Optional.
Restart target fine-root biomass ('br_max'), in kg C per individual. Optional.
A data.frame of initial soil pools, including the following data:
Initial fast soil carbon, in kg C m.
Initial slow soil carbon, in kg C m.
Mineral nitrogen pool, in kg N m.
Annual nitrogen input to soil N pool, in kg N m yr.
Initial fast soil nitrogen, in kg N m. (optional, defaults to C biomass * CN-ratio)
Initial slow soil nitrogen, in kg N m. (optional, defaults to C biomass * CN-ratio)
Initial carbon in soil microbial biomass, in kg C m. (optional, defaults to 0.0)
Initial d13C signature in soil microbial biomass, in permil. (optional, defaults to -9999)
Initial nitrogen in soil microbial biomass, in kg N m. (optional, defaults to 0.0)
Initial volumetric water content of soil layer 1, in mm. (optional, defaults to field capacity)
Initial volumetric water content of soil layer 2, in mm. (optional, defaults to field capacity)
Initial volumetric water content of soil layer 3, in mm. (optional, defaults to field capacity)
Initial total amount of nitrogen in ecosystem (only used for nitrogen workaround), in kg N m. (optional, defaults to sum of soil and plant pools.) Might not be needed.
Restart smoothed phenology temperature, in Kelvin. Optional.
###
Restart tile-level growing degree days. Optional.
A data.frame of initial land unit (LU) specifications, including the following data:
Initial grid cell fraction occupied by this LU, dimensionless (0 to 1) or m LU area per m grid cell area.
The sum of all fractions is typically equal to 1, but may be less in which case the difference is the fraction of the grid cell occupied by ice/water.
Predefined land use type (optional). One of: 'unmanaged', 'urban', 'cropland', 'pasture'. See below for meaning of these presets. Leave empty to not use any preset.
Whether this LU accepts vegetation. Default for preset 'urban': False, default for other presets: True.
Additional inorg N supply (to account for N fertiliser application), in kg m-2 yr-1. Default for preset 'cropland': 0.01, default other presets: 0.
Additional soil turnover rate (to account for soil management such as tillage), dimensionless. Default for preset 'cropland': 0.2, default for other presets: 0.
Fraction of above-ground turnover that is directly oxidized (crop and grass harvest), dimensionless. Default for preset 'cropland': 0.9, default for preset 'pasture': 0.4, default for other presets: 0.
Array of land use change (LUC) used during transient phase.
During spinup, the initial land unit fractions are used (i.e. no transition).
If there are more transient years than provided LUC data, the last state is maintained until the end of the transient phase (i.e. no transition).
The array is a nxn square matrix, where n is the number of LU (i.e. dimension of init_lu).
Each entry f(i, j) expresses the grid cell fraction of LU i (row) being transfered to LU j (column).
I.e. same units as init_lu$fraction.
Self transitions are allowed, meaning that a part of the land unit is clear cut, but the area remains in the same land use.
Example output dataset from a BiomeE-model run using divers biomee_gs_leuning_drivers
See runread_biomee_f and run_biomee_f_bysite for a detailed description of the outputs.
biomee_gs_leuning_outputbiomee_gs_leuning_output
An object of class tbl_df (inherits from tbl, data.frame) with 1 rows and 2 columns.
Example driver data to run the BiomeE-model at the CH-LAE site
using the P-model photosynthesis specification (and daily time step).
It can also be used together with leaf trait data from CH-LAE (biomee_validation)
to optimize model parameters.
biomee_p_model_driversbiomee_p_model_drivers
Example driver data to run the BiomeE-model at the CH-LAE site using the P-model photosynthesis specification (and daily time step). It provides an example of land use change (LUC).
biomee_p_model_luluc_driversbiomee_p_model_luluc_drivers
Example output dataset from a BiomeE-model run using divers biomee_p_model_luluc_drivers
See runread_biomee_f and run_biomee_f_bysite for a detailed description of the outputs.
biomee_p_model_luluc_outputbiomee_p_model_luluc_output
An object of class tbl_df (inherits from tbl, data.frame) with 1 rows and 4 columns.
Example output dataset from a BiomeE-model run using divers biomee_p_model_drivers
See runread_biomee_f and run_biomee_f_bysite for a detailed description of the outputs.
biomee_p_model_outputbiomee_p_model_output
An object of class tbl_df (inherits from tbl, data.frame) with 1 rows and 2 columns.
Small example dataset of target observations (leaf trait data) at the CH-LAE site
to optimize model parameters with the function calib_sofun_legacy
biomee_validationbiomee_validation
A tibble of validation data:
site name
validation data
Lukas Hörtnagl, Werner Eugster, Nina Buchmann, Eugenie Paul-Limoges, Sophia Etzold, Matthias Haeni, Peter Pluess, Thomas Baur (2004-2014) FLUXNET2015 CH-Lae Laegern, Dataset. https://doi.org/10.18140/FLX/1440134
Build land-use change (LUC) transition matrix from patterns.
build_luc_matrix(patterns, n_lu, n_years, out = vector())build_luc_matrix(patterns, n_lu, n_years, out = vector())
patterns |
A list of patterns.
Each pattern must be a sequence of transition values whose size is a multiple of |
n_lu |
Number of land use types (LU). |
n_years |
Number of years (i.e. length of the 3rd dimension). |
out |
For internal use only. |
An n_luxn_luxn_years transition matrix.
# Example of building a 6 year-long transition matix consisting of 6 times 2x2 matrices # A one time transfer of 0.5 of the total cell fraction from LU 2 to LU 1 pattern1 <- c(0, 0, 0.5, 0) # The null pattern (no transition) null_pattern <- rep(0, 4) # A repeated self-transition of 0.1 of the total cell fraction from LU 2 to LU 2 every other year pattern2 <- rep(c(c(0, 0, 0, 0.1), null_pattern), 3) # Building the transition matrix build_luc_matrix(list(pattern1, pattern2), 2, 6)# Example of building a 6 year-long transition matix consisting of 6 times 2x2 matrices # A one time transfer of 0.5 of the total cell fraction from LU 2 to LU 1 pattern1 <- c(0, 0, 0.5, 0) # The null pattern (no transition) null_pattern <- rep(0, 4) # A repeated self-transition of 0.1 of the total cell fraction from LU 2 to LU 2 every other year pattern2 <- rep(c(c(0, 0, 0, 0.1), null_pattern), 3) # Building the transition matrix build_luc_matrix(list(pattern1, pattern2), 2, 6)
Runs the requested model calibration and returns results
calib_sofun( drivers, obs, settings_calib, optim_out = TRUE, logpath = file.path(tempdir(), paste0("out_calib_", "my_calibration_name", ".rds.log.txt")), ... )calib_sofun( drivers, obs, settings_calib, optim_out = TRUE, logpath = file.path(tempdir(), paste0("out_calib_", "my_calibration_name", ".rds.log.txt")), ... )
drivers |
A data frame with driver data. See |
obs |
A data frame containing observational data used for model
calibration. See |
settings_calib |
A list containing model calibration settings. See the 'P-model usage' vignette for more information and examples.
|
optim_out |
A logical indicating whether the function returns and stores the raw output of the optimization functions (defaults to TRUE). |
logpath |
A path where a log-file is created and progress logged for parallel sampling, defaults to a temporary directory. The path is stored in the output object as simulation 'name' and 'logpath'. (Note that this argument is only used when parallelized sampling is requested.) |
... |
Optional arguments, simply passed on to the cost function. |
This is the main function that handles the calibration of SOFUN model parameters.
A named list containing the calibrated parameter vector 'par', the output object from the optimization 'mod', and additional identifier outputs 'name', 'logpath', and 'walltime'. For more details on the 'mod' output and how to evaluate it, see runMCMC (also this post) and GenSA. If parallel ('n_parallel_nrChains >= 2') also a logfile is created at 'logpath'.
# Calib 1: use Bayesian calibration approach with likelihood: # Define priors of model parameters that will be calibrated params_to_estimate <- list( kphio = list(lower = 0.02, upper = 0.15, init = 0.05), err_gpp = list(lower = 0.01, upper = 3, init = 0.8), err_bigD13C = list(lower = 0.5, upper = 4.0, init = 2.0) ) # Fix model parameters that won't be calibrated params_fix <- list( kphio_par_a = 0, kphio_par_b = 25, soilm_thetastar = 0.6 * 240, soilm_betao = 0.01, beta_unitcostratio = 146, rd_to_vcmax = 0.014, tau_acclim = 30, kc_jmax = 0.41 ) # Define calibration settings settings_calib <- list( method = "BayesianTools", par = params_to_estimate, metric = rsofun::cost_likelihood_pmodel, control = list( sampler_runMCMC = "DEzs", settings_runMCMC = list( burnin = 0, iterations = 10, # kept artificially low nrChains = 1 # 2, # these are the independent chains ), n_parallel_nrChains = 1 # 2, this can be parallelized ) ) # Run the calibration for GPP and D13C data drivers_to_use <- rsofun::pmodel_drivers |> dplyr::filter(sitename %in% c("FR-Pue", "lon_+146.13_lat_-032.97")) obs_to_use <- rsofun::pmodel_validation |> dplyr::filter(sitename %in% c("FR-Pue", "lon_+146.13_lat_-032.97")) calib_output <- rsofun::calib_sofun( drivers = drivers_to_use, obs = obs_to_use, settings_calib = settings_calib, # extra arguments for the cost function targets = c("gpp" = "fluxnet", "bigD13C" = "cornwell"), par_fixed = params_fix ) calib_output$mod # BayesianTools::mcmcSamplerList calib_output$par # Named vector calib_output$walltime # Benchmarked time calib_output$runtime # unused calib_output$name # optionally used calibration name calib_output$fpath # path of rds output # Calib 2: use GenSa optimization of RMSE # Calibrate the model and optimize the free parameters using demo datasets settings_calib_rmse <- list( method = "GenSA", # minimizes the RMSE metric = cost_rmse_pmodel, # our cost function returning the RMSE control = list( # control parameters for optimizer GenSA maxit = 2), par = list( # bounds for the parameter space beta_unitcostratio = list(lower = 100, upper = 200, init = 130.0) ) ) drivers_to_use <- rsofun::pmodel_drivers |> dplyr::filter(sitename %in% c("lon_+146.13_lat_-032.97")) obs_to_use <- rsofun::pmodel_validation |> dplyr::filter(sitename %in% c("lon_+146.13_lat_-032.97")) pars_calib_rmse <- calib_sofun( # calib_sofun arguments: drivers = drivers_to_use, obs = obs_to_use, settings_calib = settings_calib_rmse, # extra arguments passed to the cost function: targets = c("bigD13C" = "cornwall"), par_fixed = list( # fix all other parameters kphio = 0.09, # set to zero to disable temperature-dependence kphio_par_a = 0.0, # set to zero to disable temperature-dependence # of kphio, setup ORG kphio_par_b = 1.0, soilm_thetastar = 0.6 * 240, # to recover paper setup with soil moisture stress soilm_betao = 0.0, rd_to_vcmax = 0.014, # value from Atkin et al. 2015 for C3 herbaceous tau_acclim = 30.0, kc_jmax = 0.41 ) )# Calib 1: use Bayesian calibration approach with likelihood: # Define priors of model parameters that will be calibrated params_to_estimate <- list( kphio = list(lower = 0.02, upper = 0.15, init = 0.05), err_gpp = list(lower = 0.01, upper = 3, init = 0.8), err_bigD13C = list(lower = 0.5, upper = 4.0, init = 2.0) ) # Fix model parameters that won't be calibrated params_fix <- list( kphio_par_a = 0, kphio_par_b = 25, soilm_thetastar = 0.6 * 240, soilm_betao = 0.01, beta_unitcostratio = 146, rd_to_vcmax = 0.014, tau_acclim = 30, kc_jmax = 0.41 ) # Define calibration settings settings_calib <- list( method = "BayesianTools", par = params_to_estimate, metric = rsofun::cost_likelihood_pmodel, control = list( sampler_runMCMC = "DEzs", settings_runMCMC = list( burnin = 0, iterations = 10, # kept artificially low nrChains = 1 # 2, # these are the independent chains ), n_parallel_nrChains = 1 # 2, this can be parallelized ) ) # Run the calibration for GPP and D13C data drivers_to_use <- rsofun::pmodel_drivers |> dplyr::filter(sitename %in% c("FR-Pue", "lon_+146.13_lat_-032.97")) obs_to_use <- rsofun::pmodel_validation |> dplyr::filter(sitename %in% c("FR-Pue", "lon_+146.13_lat_-032.97")) calib_output <- rsofun::calib_sofun( drivers = drivers_to_use, obs = obs_to_use, settings_calib = settings_calib, # extra arguments for the cost function targets = c("gpp" = "fluxnet", "bigD13C" = "cornwell"), par_fixed = params_fix ) calib_output$mod # BayesianTools::mcmcSamplerList calib_output$par # Named vector calib_output$walltime # Benchmarked time calib_output$runtime # unused calib_output$name # optionally used calibration name calib_output$fpath # path of rds output # Calib 2: use GenSa optimization of RMSE # Calibrate the model and optimize the free parameters using demo datasets settings_calib_rmse <- list( method = "GenSA", # minimizes the RMSE metric = cost_rmse_pmodel, # our cost function returning the RMSE control = list( # control parameters for optimizer GenSA maxit = 2), par = list( # bounds for the parameter space beta_unitcostratio = list(lower = 100, upper = 200, init = 130.0) ) ) drivers_to_use <- rsofun::pmodel_drivers |> dplyr::filter(sitename %in% c("lon_+146.13_lat_-032.97")) obs_to_use <- rsofun::pmodel_validation |> dplyr::filter(sitename %in% c("lon_+146.13_lat_-032.97")) pars_calib_rmse <- calib_sofun( # calib_sofun arguments: drivers = drivers_to_use, obs = obs_to_use, settings_calib = settings_calib_rmse, # extra arguments passed to the cost function: targets = c("bigD13C" = "cornwall"), par_fixed = list( # fix all other parameters kphio = 0.09, # set to zero to disable temperature-dependence kphio_par_a = 0.0, # set to zero to disable temperature-dependence # of kphio, setup ORG kphio_par_b = 1.0, soilm_thetastar = 0.6 * 240, # to recover paper setup with soil moisture stress soilm_betao = 0.0, rd_to_vcmax = 0.014, # value from Atkin et al. 2015 for C3 herbaceous tau_acclim = 30.0, kc_jmax = 0.41 ) )
This is the main function that handles the calibration of SOFUN model parameters.
calib_sofun_legacy(drivers, obs, settings, optim_out = TRUE, ...)calib_sofun_legacy(drivers, obs, settings, optim_out = TRUE, ...)
drivers |
A data frame with driver data. See |
obs |
A data frame containing observational data used for model
calibration. See |
settings |
A list containing model calibration settings. See the 'P-model usage' vignette for more information and examples.
|
optim_out |
A logical indicating whether the function returns the raw output of the optimization functions (defaults to TRUE). |
... |
Optional arguments, simply passed on to the cost function. |
A named list containing the calibrated parameter vector 'par' and the output object from the optimization 'mod'. For more details on this output and how to evaluate it, see runMCMC (also this post) and GenSA.
# Fix model parameters that won't be calibrated params_fix <- list( kphio_par_a = 0, kphio_par_b = 1.0, soilm_thetastar = 0.6 * 240, soilm_betao = 0.01, beta_unitcostratio = 146, rd_to_vcmax = 0.014, tau_acclim = 30, kc_jmax = 0.41 ) # Define calibration settings settings <- list( method = "BayesianTools", par = list( kphio = list(lower = 0.04, upper = 0.09, init = 0.05), err_gpp = list(lower = 0.01, upper = 4, init = 2) ), metric = rsofun::cost_likelihood_pmodel, control = list( sampler = "DEzs", settings = list( nrChains = 1, burnin = 0, iterations = 50 # kept artificially low ) ) ) # Run the calibration for GPP data calib_output <- rsofun::calib_sofun_legacy( drivers = rsofun::pmodel_drivers |> dplyr::filter(sitename == "FR-Pue"), obs = rsofun::pmodel_validation |> dplyr::filter(sitename == "FR-Pue"), settings = settings, # extra arguments for the cost function targets = c("gpp" = "fluxnet"), par_fixed = params_fix )# Fix model parameters that won't be calibrated params_fix <- list( kphio_par_a = 0, kphio_par_b = 1.0, soilm_thetastar = 0.6 * 240, soilm_betao = 0.01, beta_unitcostratio = 146, rd_to_vcmax = 0.014, tau_acclim = 30, kc_jmax = 0.41 ) # Define calibration settings settings <- list( method = "BayesianTools", par = list( kphio = list(lower = 0.04, upper = 0.09, init = 0.05), err_gpp = list(lower = 0.01, upper = 4, init = 2) ), metric = rsofun::cost_likelihood_pmodel, control = list( sampler = "DEzs", settings = list( nrChains = 1, burnin = 0, iterations = 50 # kept artificially low ) ) ) # Run the calibration for GPP data calib_output <- rsofun::calib_sofun_legacy( drivers = rsofun::pmodel_drivers |> dplyr::filter(sitename == "FR-Pue"), obs = rsofun::pmodel_validation |> dplyr::filter(sitename == "FR-Pue"), settings = settings, # extra arguments for the cost function targets = c("gpp" = "fluxnet"), par_fixed = params_fix )
Cost function for parameter calibration, which computes the log-likelihood for the biomee model fitting several target variables for a given set of parameters.
cost_likelihood_biomee(par, obs, drivers, targets)cost_likelihood_biomee(par, obs, drivers, targets)
par |
A named vector containing parameter values for |
obs |
A nested data frame of observations, following the structure of |
drivers |
A nested data frame of driver data, for example |
targets |
A character vector indicating the target variables for which the
optimization will be done. This should be a subset of |
The cost function performs a BiomeE model run for the value of
par given as argument. The likelihood is calculated assuming that the
predicted targets are independent, normally distributed and centered on the observations.
The optimization
should be run using BayesianTools, so the likelihood is maximized.
The log-likelihood of the simulated targets by the biomee model versus the observed targets.
# do not run long-running simulations # Compute the likelihood for a set of # BiomeE model parameter values # and the example data cost_likelihood_biomee( par = c(phiRL = 3.5, LAI_light = 3.5, tf_base = 1, par_mort = 1, # model params err_GPP = 0.5), # err_GPP obs = biomee_validation, drivers = biomee_p_model_drivers, targets = c("GPP") )# do not run long-running simulations # Compute the likelihood for a set of # BiomeE model parameter values # and the example data cost_likelihood_biomee( par = c(phiRL = 3.5, LAI_light = 3.5, tf_base = 1, par_mort = 1, # model params err_GPP = 0.5), # err_GPP obs = biomee_validation, drivers = biomee_p_model_drivers, targets = c("GPP") )
The cost function performs a P-model run for the input drivers and model parameter values, and computes the outcome's normal log-likelihood centered at the input observed values and with standard deviation given as an input parameter (calibratable).
cost_likelihood_pmodel( par, obs, drivers, targets, par_fixed = NULL, parallel = FALSE, ncores = 1, get_mod_obs = get_mod_obs_pmodel )cost_likelihood_pmodel( par, obs, drivers, targets, par_fixed = NULL, parallel = FALSE, ncores = 1, get_mod_obs = get_mod_obs_pmodel )
par |
A named list for the parameters to be calibrated, including
a subset of model parameters and error terms for each target variable (for
example |
obs |
A nested data.frame of observations, with columns |
drivers |
A nested data.frame of driver data. See |
targets |
A named character vector indicating the target variable(s) for
which the likelihood is computed.
The names of |
par_fixed |
A named list of model parameter values to keep fixed during the
calibration. These should complement the input |
parallel |
A logical specifying whether simulations are to be parallelised
(sending data from a certain number of sites to each core). Defaults to
|
ncores |
An integer specifying the number of cores used for parallel computing. Defaults to 2. |
get_mod_obs |
Function running P-model and combining model outputs and observations (defaults to get_mod_obs_pmodel) |
To run the P-model, all model parameters must be given. The cost
function uses arguments par and par_fixed such that, in the
calibration routine, par can be updated by the optimizer and
par_fixed are kept unchanged throughout calibration.
If the validation data contains a "date" column (fluxes), the simulated target time series is compared to the observed values on those same dates (e.g. for GPP).
The log-likelihood of the observed target values, assuming that they
are independent, normally distributed and centered on the predictions
made by the P-model run with standard deviation given as input par e.g.
gpp_err.
# Compute the likelihood for a set of # model parameter values involved in the # temperature dependence of kphio # and example data cost_likelihood_pmodel( par = c(kphio = 0.05, kphio_par_a = -0.01, kphio_par_b = 1, # error model parameters err_gpp = 2), obs = pmodel_validation |> dplyr::filter(sitename == "FR-Pue"), drivers = pmodel_drivers |> dplyr::filter(sitename == "FR-Pue"), targets = c("gpp" = "fluxnet"), par_fixed = list( soilm_thetastar = 0.6 * 240, # old setup with soil moisture stress soilm_betao = 0.0, beta_unitcostratio = 146.0, rd_to_vcmax = 0.014, # from Atkin et al. 2015 for C3 herbaceous tau_acclim = 30.0, kc_jmax = 0.41 ) )# Compute the likelihood for a set of # model parameter values involved in the # temperature dependence of kphio # and example data cost_likelihood_pmodel( par = c(kphio = 0.05, kphio_par_a = -0.01, kphio_par_b = 1, # error model parameters err_gpp = 2), obs = pmodel_validation |> dplyr::filter(sitename == "FR-Pue"), drivers = pmodel_drivers |> dplyr::filter(sitename == "FR-Pue"), targets = c("gpp" = "fluxnet"), par_fixed = list( soilm_thetastar = 0.6 * 240, # old setup with soil moisture stress soilm_betao = 0.0, beta_unitcostratio = 146.0, rd_to_vcmax = 0.014, # from Atkin et al. 2015 for C3 herbaceous tau_acclim = 30.0, kc_jmax = 0.41 ) )
The cost function performs a P-model run for the input drivers and model parameter values, and computes the outcome's normal log-likelihood centered at the input observed values and with standard deviation given as an input parameter (calibratable).
cost_likelihood_pmodel_legacy( par, obs, drivers, targets, par_fixed = NULL, parallel = FALSE, ncores = 2 )cost_likelihood_pmodel_legacy( par, obs, drivers, targets, par_fixed = NULL, parallel = FALSE, ncores = 2 )
par |
A named vector of values for the parameters to be calibrated, including
a subset of model parameters (described in |
obs |
A nested data.frame of observations, with columns |
drivers |
A nested data.frame of driver data. See |
targets |
A character vector indicating the target variables for which the
likelihood is computed. The names must be column
name(s) of the |
par_fixed |
A named list of model parameter values to keep fixed during the
calibration. These should complement the input |
parallel |
A logical specifying whether simulations are to be parallelised
(sending data from a certain number of sites to each core). Defaults to
|
ncores |
An integer specifying the number of cores used for parallel computing. Defaults to 2. |
To run the P-model, all model parameters must be given. The cost
function uses arguments par and par_fixed such that, in the
calibration routine, par can be updated by the optimizer and
par_fixed are kept unchanged throughout calibration.
If the validation data contains a "date" column (fluxes), the simulated target time series is compared to the observed values on those same dates (e.g. for GPP). Otherwise, there should only be one observed value per site (leaf traits), and the outputs (averaged over the growing season, weighted by predicted GPP) will be compared to this single value representative of the site (e.g. Vcmax25). As an exception, when the date of a trait measurement is available, it will be compared to the trait value predicted on that date.
The log-likelihood of the observed target values, assuming that they are independent, normally distributed and centered on the predictions made by the P-model run with standard deviation given as input (via 'par' because the error terms are estimated through the calibration with 'BayesianTools', as shown in the "Parameter calibration and cost functions" vignette).
# Compute the likelihood for a set of # model parameter values involved in the # temperature dependence of kphio # and example data cost_likelihood_pmodel_legacy( par = c(kphio = 0.05, kphio_par_a = -0.01, kphio_par_b = 1, # model parameters err_gpp = 2), # err_gpp obs = pmodel_validation |> dplyr::filter(sitename == "FR-Pue"), drivers = pmodel_drivers |> dplyr::filter(sitename == "FR-Pue"), targets = c("gpp"), # NOTE: the old legacy format of targets par_fixed = list( soilm_thetastar = 0.6 * 240, # old setup with soil moisture stress soilm_betao = 0.0, beta_unitcostratio = 146.0, rd_to_vcmax = 0.014, # from Atkin et al. 2015 for C3 herbaceous tau_acclim = 30.0, kc_jmax = 0.41 ) ) cost_likelihood_pmodel_legacy( par = c(kphio = 0.05, kphio_par_a = -0.01, kphio_par_b = 1, # model parameters err_le = 2, err_gpp = 2, err_bigD13C = 2), obs = pmodel_validation, drivers = pmodel_drivers, targets = c("gpp", "le", "bigD13C"), # NOTE: the old legacy format of targets par_fixed = list( soilm_thetastar = 0.6 * 240, # old setup with soil moisture stress soilm_betao = 0.0, beta_unitcostratio = 146.0, rd_to_vcmax = 0.014, # from Atkin et al. 2015 for C3 herbaceous tau_acclim = 30.0, kc_jmax = 0.41 ) )# Compute the likelihood for a set of # model parameter values involved in the # temperature dependence of kphio # and example data cost_likelihood_pmodel_legacy( par = c(kphio = 0.05, kphio_par_a = -0.01, kphio_par_b = 1, # model parameters err_gpp = 2), # err_gpp obs = pmodel_validation |> dplyr::filter(sitename == "FR-Pue"), drivers = pmodel_drivers |> dplyr::filter(sitename == "FR-Pue"), targets = c("gpp"), # NOTE: the old legacy format of targets par_fixed = list( soilm_thetastar = 0.6 * 240, # old setup with soil moisture stress soilm_betao = 0.0, beta_unitcostratio = 146.0, rd_to_vcmax = 0.014, # from Atkin et al. 2015 for C3 herbaceous tau_acclim = 30.0, kc_jmax = 0.41 ) ) cost_likelihood_pmodel_legacy( par = c(kphio = 0.05, kphio_par_a = -0.01, kphio_par_b = 1, # model parameters err_le = 2, err_gpp = 2, err_bigD13C = 2), obs = pmodel_validation, drivers = pmodel_drivers, targets = c("gpp", "le", "bigD13C"), # NOTE: the old legacy format of targets par_fixed = list( soilm_thetastar = 0.6 * 240, # old setup with soil moisture stress soilm_betao = 0.0, beta_unitcostratio = 146.0, rd_to_vcmax = 0.014, # from Atkin et al. 2015 for C3 herbaceous tau_acclim = 30.0, kc_jmax = 0.41 ) )
Cost function for parameter calibration, which computes the root mean squared
error (RMSE) between BiomeE simulations (using the input set of parameters)
and observed target variables.
Cost function for parameter calibration, which
computes the RMSE for the biomee model fitting target variables
'GPP','LAI','Density' and 'Biomass' for a given set of parameters.
cost_rmse_biomee(par, obs, drivers)cost_rmse_biomee(par, obs, drivers)
par |
A vector containing parameter values for |
obs |
A nested data frame of observations, following the structure of |
drivers |
A nested data frame of driver data, for example |
The root mean squared error (RMSE) between the observed and simulated
values of 'GPP','LAI','Density' and 'Biomass' (all variables
have the same weight). Relative errors (difference divided by observed values) are used
instead of absolute errors.
The cost function performs a BiomeE model run for parameter values
par and model drivers drivers given as arguments, producing the
simulated values used to compute the RMSE.
# do not run long-running simulations # Compute RMSE for a set of # model parameter values # and example data cost_rmse_biomee( par = c(3.5, 3.5, 1, 1), obs = biomee_validation, drivers = biomee_p_model_drivers )# do not run long-running simulations # Compute RMSE for a set of # model parameter values # and example data cost_rmse_biomee( par = c(3.5, 3.5, 1, 1), obs = biomee_validation, drivers = biomee_p_model_drivers )
The cost function performs a P-model run for the input drivers and parameter values, and compares the output to observations of various targets by computing the root mean squared error (RMSE).
cost_rmse_pmodel( par, obs, drivers, targets, par_fixed = NULL, target_weights = NULL )cost_rmse_pmodel( par, obs, drivers, targets, par_fixed = NULL, target_weights = NULL )
par |
A vector of values for the parameters to be calibrated (a subset of
those described in |
obs |
A nested data.frame of observations, with columns |
drivers |
A nested data.frame of driver data. See |
targets |
A named character vector indicating the target variable(s) for
which the RMSE is computed.
The names of |
par_fixed |
A named list of model parameter values to keep fixed during the
calibration. These should complement the input |
target_weights |
A vector of weights to be used in the computation of
the RMSE if using several targets. By default ( |
To run the P-model, all model parameters must be given. The cost
function uses arguments par and par_fixed such that, in the
calibration routine, par can be updated by the optimizer and
par_fixed are kept unchanged throughout calibration.
If the validation data contains a "date" column (fluxes), the simulated target time series is compared to the observed values on those same dates (e.g. for GPP). Otherwise, there should only be one observed value per site (leaf traits), and the outputs (averaged over the growing season, weighted by predicted GPP) will be compared to this single value representative of the site (e.g. Vcmax25). As an exception, when the date of a trait measurement is available, it will be compared to the trait value predicted on that date.
The root mean squared error (RMSE) between observed values and P-model predictions. The RMSE is computed for each target separately and then aggregated (mean or weighted average).
# Compute RMSE for a set # of model parameter values # and example data cost_rmse_pmodel( par = c(0.05, -0.01, 0.5), # kphio related parameters obs = pmodel_validation |> dplyr::filter(sitename == "FR-Pue"), drivers = pmodel_drivers |> dplyr::filter(sitename == "FR-Pue"), targets = c("gpp" = "fluxnet"), par_fixed = list( soilm_thetastar = 0.6 * 240, # old setup with soil moisture stress soilm_betao = 0.0, beta_unitcostratio = 146.0, rd_to_vcmax = 0.014, # from Atkin et al. 2015 for C3 herbaceous tau_acclim = 30.0, kc_jmax = 0.41 ) )# Compute RMSE for a set # of model parameter values # and example data cost_rmse_pmodel( par = c(0.05, -0.01, 0.5), # kphio related parameters obs = pmodel_validation |> dplyr::filter(sitename == "FR-Pue"), drivers = pmodel_drivers |> dplyr::filter(sitename == "FR-Pue"), targets = c("gpp" = "fluxnet"), par_fixed = list( soilm_thetastar = 0.6 * 240, # old setup with soil moisture stress soilm_betao = 0.0, beta_unitcostratio = 146.0, rd_to_vcmax = 0.014, # from Atkin et al. 2015 for C3 herbaceous tau_acclim = 30.0, kc_jmax = 0.41 ) )
Similar to BayesianTools::createUniformPrior()
createMixedPrior(prior_definitions)createMixedPrior(prior_definitions)
prior_definitions |
A named list with parameters for a distribution |
TRUE or FALSE, if the provided parameters describe a beta distribution
library(BayesianTools) prior_definitions_mixed <- list( par = list( par_uniform = list(lower = 10, upper = 30, init = 15), par_normal = list(mean = 10, sd = 2), par_lognormal = list(meanlog = -4, sdlog = 1.1), par_truncnormal = list(mean = 10, sd = 2, lower = 9, upper = 14), # par_trunclognormal = list(meanlog = -4, sdlog = 1.1, endpoint = 0.5), par_beta = list(shape1 = 5, shape2 = 2) )) priorMixed <- rsofun:::createMixedPrior(prior_definitions_mixed$par) priorMixed$sampler(2000) hist(priorMixed$sampler(2000)[, 5])library(BayesianTools) prior_definitions_mixed <- list( par = list( par_uniform = list(lower = 10, upper = 30, init = 15), par_normal = list(mean = 10, sd = 2), par_lognormal = list(meanlog = -4, sdlog = 1.1), par_truncnormal = list(mean = 10, sd = 2, lower = 9, upper = 14), # par_trunclognormal = list(meanlog = -4, sdlog = 1.1, endpoint = 0.5), par_beta = list(shape1 = 5, shape2 = 2) )) priorMixed <- rsofun:::createMixedPrior(prior_definitions_mixed$par) priorMixed$sampler(2000) hist(priorMixed$sampler(2000)[, 5])
The get_mod_obs function performs a P-model run for the input drivers and model parameter values, and collects and combines the model output with the observations. It provides output for all possible targets (defined by the error terms provided in params_modl_and_err) and must be subset for requested targets by the calling cost_function.
get_mod_obs_pmodel( drivers, obs, params_modl_and_err, parallel, ncores, return_continuous_timeseries = FALSE )get_mod_obs_pmodel( drivers, obs, params_modl_and_err, parallel, ncores, return_continuous_timeseries = FALSE )
drivers |
A nested data.frame of driver data. See |
obs |
A nested data.frame of observations, see |
params_modl_and_err |
A named list for the model parameters and error
terms for each target variable, see |
parallel |
A logical specifying whether simulations are to be parallelised (sending data from a certain number of sites to each core). |
ncores |
An integer specifying the number of cores used for parallel computing. |
return_continuous_timeseries |
A logical specifying whether modelled values are returned as daily, continuous time series (including days without observations) or whether modelled values are only returned when a corresponding observation is available. |
Creates a tibble with rows for each date from 'yrstart' to 'yrend'
in 'yyyy-mm-dd' format. Intervals of dates are specified by argument
'freq'.
ddf <- init_dates_dataframe(2000, 2003, startmoy=1, startdoy=1,
freq="days", endmoy=12, enddom=31, noleap=FALSE)
init_dates_dataframe( yrstart, yrend, startmoy = 1, startdoy = 1, freq = "days", endmoy = 12, enddom = 31, noleap = FALSE )init_dates_dataframe( yrstart, yrend, startmoy = 1, startdoy = 1, freq = "days", endmoy = 12, enddom = 31, noleap = FALSE )
yrstart |
An integer defining the start year of dates covered by the dataframe. |
yrend |
An integer defining the end year of dates covered by the dataframe. |
startmoy |
An integer defining the start month-of-year of dates covered by the dataframe. Defaults to 1. |
startdoy |
An integer defining the start day-of-year of dates covered by the dataframe. Defaults to 1. |
freq |
A character string specifying the time steps of dates
(in rows). Defaults to |
endmoy |
An integer defining the end month-of-year of dates covered by the dataframe. Defaults to 12. |
enddom |
An integer defining the end day-of-year of dates covered by the dataframe. Defaults to 31. |
noleap |
Whether leap years are ignored, that is, whether the 29 |
A tibble with dates.
Checks if provided parameter list describes a beta distribution
is_beta_prior(distr_pars)is_beta_prior(distr_pars)
distr_pars |
A named list with parameters for a distribution |
TRUE or FALSE, if the provided parameters describe a beta distribution
prior_definitions_mixed <- list( par = list( par_uniform = list(lower = 10, upper = 30, init = 15), par_normal = list(mean = 10, sd = 2), par_lognormal = list(meanlog = -4, sdlog = 1.1), par_truncnormal = list(mean = 10, sd = 2, lower = 9, upper = 14), par_trunclognormal = list(meanlog = -4, sdlog = 1.1, endpoint = 2.2), par_beta = list(shape1 = 5, shape2 = 2) )) lapply(prior_definitions_mixed$par, rsofun:::is_beta_prior)prior_definitions_mixed <- list( par = list( par_uniform = list(lower = 10, upper = 30, init = 15), par_normal = list(mean = 10, sd = 2), par_lognormal = list(meanlog = -4, sdlog = 1.1), par_truncnormal = list(mean = 10, sd = 2, lower = 9, upper = 14), par_trunclognormal = list(meanlog = -4, sdlog = 1.1, endpoint = 2.2), par_beta = list(shape1 = 5, shape2 = 2) )) lapply(prior_definitions_mixed$par, rsofun:::is_beta_prior)
Checks if provided parameter list describes a lognormal distribution
is_lognormal_prior(distr_pars)is_lognormal_prior(distr_pars)
distr_pars |
A named list with parameters for a distribution |
TRUE or FALSE, if the provided parameters describe a lognormal distribution
prior_definitions_mixed <- list( par = list( par_uniform = list(lower = 10, upper = 30, init = 15), par_normal = list(mean = 10, sd = 2), par_lognormal = list(meanlog = -4, sdlog = 1.1), par_truncnormal = list(mean = 10, sd = 2, lower = 9, upper = 14), par_trunclognormal = list(meanlog = -4, sdlog = 1.1, endpoint = 2.2), par_beta = list(shape1 = 5, shape2 = 2) )) lapply(prior_definitions_mixed$par, rsofun:::is_lognormal_prior)prior_definitions_mixed <- list( par = list( par_uniform = list(lower = 10, upper = 30, init = 15), par_normal = list(mean = 10, sd = 2), par_lognormal = list(meanlog = -4, sdlog = 1.1), par_truncnormal = list(mean = 10, sd = 2, lower = 9, upper = 14), par_trunclognormal = list(meanlog = -4, sdlog = 1.1, endpoint = 2.2), par_beta = list(shape1 = 5, shape2 = 2) )) lapply(prior_definitions_mixed$par, rsofun:::is_lognormal_prior)
Checks if provided parameter list describes a normal distribution
is_normal_prior(distr_pars)is_normal_prior(distr_pars)
distr_pars |
A named list with parameters for a distribution |
TRUE or FALSE, if the provided parameters describe a normal distribution
prior_definitions_mixed <- list( par = list( par_uniform = list(lower = 10, upper = 30, init = 15), par_normal = list(mean = 10, sd = 2), par_lognormal = list(meanlog = -4, sdlog = 1.1), par_truncnormal = list(mean = 10, sd = 2, lower = 9, upper = 14), par_trunclognormal = list(meanlog = -4, sdlog = 1.1, endpoint = 2.2), par_beta = list(shape1 = 5, shape2 = 2) )) lapply(prior_definitions_mixed$par, rsofun:::is_normal_prior)prior_definitions_mixed <- list( par = list( par_uniform = list(lower = 10, upper = 30, init = 15), par_normal = list(mean = 10, sd = 2), par_lognormal = list(meanlog = -4, sdlog = 1.1), par_truncnormal = list(mean = 10, sd = 2, lower = 9, upper = 14), par_trunclognormal = list(meanlog = -4, sdlog = 1.1, endpoint = 2.2), par_beta = list(shape1 = 5, shape2 = 2) )) lapply(prior_definitions_mixed$par, rsofun:::is_normal_prior)
Checks if provided parameter list describes a truncated lognormal distribution
is_trunclognormal_prior(distr_pars)is_trunclognormal_prior(distr_pars)
distr_pars |
A named list with parameters for a distribution |
TRUE or FALSE, if the provided parameters describe a truncated lognormal distribution
prior_definitions_mixed <- list( par = list( par_uniform = list(lower = 10, upper = 30, init = 15), par_normal = list(mean = 10, sd = 2), par_lognormal = list(meanlog = -4, sdlog = 1.1), par_truncnormal = list(mean = 10, sd = 2, lower = 9, upper = 14), par_trunclognormal = list(meanlog = -4, sdlog = 1.1, endpoint = 2.2), par_beta = list(shape1 = 5, shape2 = 2) )) lapply(prior_definitions_mixed$par, rsofun:::is_trunclognormal_prior)prior_definitions_mixed <- list( par = list( par_uniform = list(lower = 10, upper = 30, init = 15), par_normal = list(mean = 10, sd = 2), par_lognormal = list(meanlog = -4, sdlog = 1.1), par_truncnormal = list(mean = 10, sd = 2, lower = 9, upper = 14), par_trunclognormal = list(meanlog = -4, sdlog = 1.1, endpoint = 2.2), par_beta = list(shape1 = 5, shape2 = 2) )) lapply(prior_definitions_mixed$par, rsofun:::is_trunclognormal_prior)
Checks if provided parameter list describes a truncated normal distribution
is_truncnormal_prior(distr_pars)is_truncnormal_prior(distr_pars)
distr_pars |
A named list with parameters for a distribution |
TRUE or FALSE, if the provided parameters describe a truncated normal distribution
prior_definitions_mixed <- list( par = list( par_uniform = list(lower = 10, upper = 30, init = 15), par_normal = list(mean = 10, sd = 2), par_lognormal = list(meanlog = -4, sdlog = 1.1), par_truncnormal = list(mean = 10, sd = 2, lower = 9, upper = 14), par_trunclognormal = list(meanlog = -4, sdlog = 1.1, endpoint = 2.2), par_beta = list(shape1 = 5, shape2 = 2) )) lapply(prior_definitions_mixed$par, rsofun:::is_truncnormal_prior)prior_definitions_mixed <- list( par = list( par_uniform = list(lower = 10, upper = 30, init = 15), par_normal = list(mean = 10, sd = 2), par_lognormal = list(meanlog = -4, sdlog = 1.1), par_truncnormal = list(mean = 10, sd = 2, lower = 9, upper = 14), par_trunclognormal = list(meanlog = -4, sdlog = 1.1, endpoint = 2.2), par_beta = list(shape1 = 5, shape2 = 2) )) lapply(prior_definitions_mixed$par, rsofun:::is_truncnormal_prior)
Checks if provided parameter list describes a uniform distribution
is_uniform_prior(distr_pars)is_uniform_prior(distr_pars)
distr_pars |
A named list with parameters for a distribution |
TRUE or FALSE, if the provided parameters describe a uniform distribution
prior_definitions_mixed <- list( par = list( par_uniform = list(lower = 10, upper = 30, init = 15), par_normal = list(mean = 10, sd = 2), par_lognormal = list(meanlog = -4, sdlog = 1.1), par_truncnormal = list(mean = 10, sd = 2, lower = 9, upper = 14), par_trunclognormal = list(meanlog = -4, sdlog = 1.1, endpoint = 2.2), par_beta = list(shape1 = 5, shape2 = 2) )) lapply(prior_definitions_mixed$par, rsofun:::is_uniform_prior)prior_definitions_mixed <- list( par = list( par_uniform = list(lower = 10, upper = 30, init = 15), par_normal = list(mean = 10, sd = 2), par_lognormal = list(meanlog = -4, sdlog = 1.1), par_truncnormal = list(mean = 10, sd = 2, lower = 9, upper = 14), par_trunclognormal = list(meanlog = -4, sdlog = 1.1, endpoint = 2.2), par_beta = list(shape1 = 5, shape2 = 2) )) lapply(prior_definitions_mixed$par, rsofun:::is_uniform_prior)
Small dataset representing the driver to run the P-model at the FR-Pue site.
Legacy data set. See details in the documentation of its replacement
pmodel_drivers
p_model_oldformat_driversp_model_oldformat_drivers
An object of class tbl_df (inherits from tbl, data.frame) with 1 rows and 4 columns.
Small example dataset of target observations (daily GPP flux data) to optimize
model parameters with the function calib_sofun_legacy.
Legacy data set. See details in the documentation of its replacement
pmodel_validation
p_model_oldformat_validationp_model_oldformat_validation
An object of class tbl_df (inherits from tbl, data.frame) with 1 rows and 2 columns.
Small dataset representing the driver to run the P-model at the six Fluxnet
sites and 5 sites with trait observations.
It can be used together with daily GPP or ET flux time series data and
trait data to optimize model parameters (see pmodel_validation).
pmodel_driverspmodel_drivers
A tibble of driver data:
A character string containing the site name.
A tibble of a time series of forcing climate data. Required parameters differ for daily simulations or for onestep acclimation. For daily simulations these include daily values of:
Date of the observation in YYYY-MM-DD format.
Daytime average air temperature in C.
Daytime average vapour pressure deficit in Pa.
Photosynthetic photon flux density (PPFD) in
mol m s. If all values are NA, it indicates that
PPFD should be calculated by the SPLASH model and column ccov.
Net radiation in W m. WARNING: This is currently
ignored as a model forcing.
Atmospheric pressure in Pa.
Snow in water equivalents mm s.
Rain as precipitation in liquid form in mm s.
Daily minimum air temperature in C.
Daily maximum air temperature in C.
Wind velocity (m s-1)
Fraction of photosynthetic active radiation (fAPAR), taking values between 0 and 1.
Atmospheric CO concentration in ppm.
Cloud coverage in %. This is only used when either PPFD or net radiation are not prescribed.
For onestep acclimation these include growing season averages (i.e. single values) of:
Daytime average air temperature in C.
Daytime average vapour pressure deficit in Pa.
Photosynthetic photon flux density (PPFD) in
mol m s.
Atmospheric pressure in Pa.
Atmospheric CO concentration in ppm.
A tibble of simulation parameters. Required parameters differ for daily simulations or for onestep acclimation. For daily simulations these include:
A logical value indicating whether this simulation does spin-up.
Number of spin-up years.
Number of first N years of forcing data.frame that are recycled for spin-up.
An integer indicating the output periodicity.
A logical value, TRUE if evergreen tree.
A logical value, TRUE if evergreen tree and N-fixing.
A logical value, TRUE if deciduous tree.
A logical value, TRUE if deciduous tree and N-fixing.
A logical value, TRUE if grass with C3 photosynthetic pathway.
A logical value, TRUE if grass with C3 photosynthetic
pathway and N-fixing.
A logical value, TRUE if grass with C4 photosynthetic pathway.
A logical value, FALSE to request daily simulations.
Defaults to FALSE if missing.
For onestep acclimation these include:
A logical value indicating whether to use C4 photosynthetic pathway.
A logical value, TRUE to request onestep acclimation.
Defaults to FALSE if missing.
A tibble containing site meta information. This data structure can be freely used for documenting the dataset, but must include at least the following data:
Longitude of the site location in degrees east.
Latitude of the site location in degrees north.
Elevation of the site location, in meters above sea level.
A numeric value for the rooting zone water holding capacity
(in mm). (Not needed if onestep == "TRUE".)
Pastorello, G., Trotta, C., Canfora, E. et al. The FLUXNET2015 dataset and the ONEFlux processing pipeline for eddy covariance data. Sci Data 7, 225 (2020). https://doi.org/10.1038/s41597-020-0534-3
University of East Anglia Climatic Research Unit; Harris, I.C.; Jones, P.D.; Osborn, T. (2021): CRU TS4.05: Climatic Research Unit (CRU) Time-Series (TS) version 4.05 of high-resolution gridded data of month-by-month variation in climate (Jan. 1901- Dec. 2020). NERC EDS Centre for Environmental Data Analysis, date of citation. https://catalogue.ceda.ac.uk/uuid/c26a65020a5e4b80b20018f148556681
Weedon, G. P., G. Balsamo, N. Bellouin,S. Gomes, M. J. Best, and P. Viterbo(2014), The WFDEI meteorologicalforcing data set: WATCH Forcing Datamethodology applied to ERA-Interimreanalysis data, Water Resour. Res.,50,7505–7514, doi:10.1002/2014WR015638.
Fick, S.E. and R.J. Hijmans, 2017. WorldClim 2: new 1km spatial resolution climate surfaces for global land areas. International Journal of Climatology 37 (12): 4302-4315.
Example output dataset from a p-model run using pmodel_drivers.
Results are stored as nested tibble in the column data.
See run_pmodel_f_bysite
and run_pmodel_onestep_f_bysite for a detailed
description of the outputs.
pmodel_outputpmodel_output
An object of class tbl_df (inherits from tbl, data.frame) with 5 rows and 3 columns.
Small example dataset of target observations (daily GPP flux data as well as
leaf D13C data) to optimize
model parameters with the function calib_sofun
pmodel_validationpmodel_validation
A tibble of validation data:
A character string containing the site name (e.g. 'FR-Pue').
A character string containing the name of the data source. It can be used for specifying which data sets to use for calibration.
A single tibble or a list of tibbles with target observations. For daily simulations this single tibble can contain daily values for:
Date vector with format YYYY-MM-DD.
The observed Gross Primary Productivity (GPP) for each time stamp
(in gC m d).
A quality check indicator.
Latent heat of exchange ...
... etc.
For onestep acclimation this can fore example include:
A tibble containing observations of leaf D13C values.
A tibble containing observations of Vcmax values.
A tibble containing observations of Jmax values.
Pastorello, G., Trotta, C., Canfora, E. et al. The FLUXNET2015 dataset and the ONEFlux processing pipeline for eddy covariance data. Sci Data 7, 225 (2020). https://doi.org/10.1038/s41597-020-0534-3
Cornwell, W. (2025). traitecoevo/leaf13C: V0.2.2 (Version v0.2.2) [Computer software]. Zenodo. https://doi.org/10.5281/zenodo.15239220
Cornwell, William K., et al. “Climate and soils together regulate photosynthetic carbon isotope discrimination within C3 plants worldwide.” Global Ecology and Biogeography 27.9 (2018): 1056-1067.
require(ggplot2) require(tidyr) p_model_oldformat_validation %>% tidyr::unnest(data) pmodel_validation |> dplyr::filter(grepl("^[A-Z]", sitename)) |> unnest(data) pmodel_validation |> dplyr::filter(grepl("lon", sitename)) |> unnest(data)require(ggplot2) require(tidyr) p_model_oldformat_validation %>% tidyr::unnest(data) pmodel_validation |> dplyr::filter(grepl("^[A-Z]", sitename)) |> unnest(data) pmodel_validation |> dplyr::filter(grepl("lon", sitename)) |> unnest(data)
Run BiomeE Fortran model on single site.
run_biomee_f_bysite( sitename, params_siml, site_info, forcing, params_tile, params_species, init_cohort, init_soil, init_lu = NULL, luc_forcing = NULL, makecheck = TRUE )run_biomee_f_bysite( sitename, params_siml, site_info, forcing, params_tile, params_species, init_cohort, init_soil, init_lu = NULL, luc_forcing = NULL, makecheck = TRUE )
sitename |
Site name. |
params_siml |
Simulation parameters. |
site_info |
Site meta info in a data.frame. |
forcing |
A data.frame of forcing climate data, used as input. |
params_tile |
Tile-level model parameters, into a single row data.frame. |
params_species |
A data.frame containing species-specific model parameters,
with one species per row. See examples |
init_cohort |
A data.frame of initial cohort specifications. |
init_soil |
A data.frame of initial soil pools. |
init_lu |
A data.frame of initial land unit (LU) specifications. |
luc_forcing |
An array of land use change (LUC) used during transient phase. For further specifications of above inputs and examples see |
makecheck |
A logical specifying whether checks are performed to verify forcings and model parameters. |
A data.frame with columns containing model output for each land unit (LU).
See examples biomee_gs_leuning_output, biomee_p_model_output, or biomee_p_model_luluc_output.
If only one land unit (LU) is simulated, the column is named 'data'.
If multiple land units (LU) are simulated, the columns are named according to the LU names.
If multiple land units (LU) are simulated, an additional column 'aggregated' contains output aggregating all tiles as
well as product pools.
Model output for each land unit (LU) is provided as a list.
Each list has elements: output_daily_tile, output_annual_tile, output_annual_cohorts,
restart_init_cohort, and restart_init_soil.
Model output for the aggregated land units (LU) is provided as a list containing output_daily_cell.
output_daily_tileA data.frame with daily outputs at tile level.
Year of the simulation.
Day of the year.
Air temperature (Kelvin).
Dampened soil temperature (Kelvin).
Precipitation (mm m day).
Soil water content in root zone (kg m).
Transpiration (mm m day).
Evaporation (mm m day).
Water runoff (mm m day).
Soil water content for layer 1 (mm = kg H2O m).
Soil water content for layer 2 (mm = kg H2O m).
Soil water content for layer 3 (mm = kg H2O m).
Leaf area index (m/m).
Net primary productivity (kg C m day).
Gross primary production (kg C m day).
Plant autotrophic respiration (kg C m day).
Heterotrophic respiration (kg C m day).
Non-structural carbon (kg C m).
Biomass of seeds (kg C m).
Biomass of leaves (kg C m).
Biomass of fine roots (kg C m).
Biomass of sapwood (kg C m).
Biomass of heartwood (kg C m).
Non-structural N pool (kg N m).
Nitrogen of seeds (kg N m).
Nitrogen of leaves (kg N m).
Nitrogen of roots (kg N m).
Nitrogen of sapwood (kg N m).
Nitrogen of heartwood (kg N m).
Microbial carbon (kg C m).
Fast soil carbon pool (kg C m).
Slow soil carbon pool (kg C m).
Microbial nitrogen (kg N m).
Fast soil nitrogen pool (kg N m).
Slow soil nitrogen pool (kg N m).
Mineral nitrogen pool (kg N m).
Nitrogen uptake (kg N m day).
output_annual_tileA data.frame with annual outputs at tile level.
Year of the simulation.
Crown area index (m/m).
Leaf area index (m/m).
Number of trees per area (trees ha).
Diameter at tile level (cm).
Tree density for trees with DBH > 12 cm (individuals ha).
Diameter at tile level considering trees with DBH > 12 cm(cm).
Quadratic mean diameter at tile level considering trees withDBH > 12 cm (cm).
Net primary productivity (kg C m yr).
Gross primary productivity (kg C m yr).
Plant autotrophic respiration (kg C m yr).
Heterotrophic respiration (kg C m yr).
Annual precipitation (mm m yr).
Soil water content in root zone (kg m).
Transpiration (mm m yr).
Evaporation (mm m yr).
Water runoff (mm m yr).
Plant biomass (kg C m).
Soil carbon (kg C m).
Total carbon in plant and soil (kg C m).
Plant nitrogen (kg N m).
Soil nitrogen (kg N m).
Total nitrogen in plant and soil (kg N m).
Nonstructural carbohydrates (kg C m).
Seed biomass (kg C m).
Leaf biomass (kg C m).
Fine root biomass (kg C m).
Sapwood biomass (kg C m).
Heartwood biomass (kg C m).
Nonstructural nitrogen (kg N m).
Seed nitrogen (kg N m).
Leaf nitrogen (kg N m).
Fine root nitrogen (kg N m).
Sapwood nitrogen (kg N m).
Heartwood nitrogen (kg N m).
Microbial carbon (kg C m).
Fast soil carbon pool (kg C m).
Slow soil carbon pool (kg C m).
Microbial nitrogen (kg N m).
Fast soil nitrogen pool (kg N m).
Slow soil nitrogen pool (kg N m).
Mineral nitrogen pool (kg N m).
Nitrogen fixation (kg N m).
Nitrogen uptake (kg N m).
Annual available nitrogen (kg N m).
Annual nitrogen from plants to soil (kg N m).
Annual nitrogen loss (kg N m).
Total seed carbon (kg C m).
Total seed nitrogen (kg N m).
Total carbon from all compartments but seeds (kg C m).
Total nitrogen from all compartments but seeds(kg N m).
Age of the oldest tree in the tile (years).
Maximum volume of a tree in the tile (m).
Maximum DBH of a tree in the tile (m).
Growth of a tree, including carbon allocated to leaves(kg C m yr).
Growth of a tree, including carbon allocated to sapwood(kg C m yr).
Number of trees that died (trees m yr).
Carbon biomass of trees that died (kg C m yr).
Continuous biomass turnover (kg C m yr).
Carbon turnover rate, calculated as the ratio between plant biomass and NPP (yr).
Fraction of BiomeE grid cell that is occupied by this land unit (LU tile) tile (unitless, or m LU area per m grid cell area).
output_annual_cohortsA data.frame of annual outputs at the cohort level.
Year of the simulation.
An integer indicating the cohort identity.
An integer indicating the Plant Functional Type.
An integer indicating the crown layer, numbered from top to bottom.
Number of trees per area (trees ha).
Fraction of layer area occupied by this cohort.
Tree diameter (cm).
Diameter growth of a tree in this cohort (cm yr).
Tree height (m).
Age of the cohort (years).
Basal area a tree in this cohort (m tree).
Basal area increment of a tree in this cohort (m tree yr).
Crown area of a tree in this cohort (m tree).
Total area of leaves (m tree).
Sum of sapwood and heartwood biomass of a tree in this cohort (kg C tree).
Non-structural carbon of a tree in this cohort (kg C tree).
Biomass of seeds of a tree in this cohort (kg C tree).
Biomass of leaves of a tree in this cohort (kg C tree).
Biomass of fine roots of a tree in this cohort (kg C tree).
Biomass of sapwood of a tree in this cohort (kg C tree).
Biomass of heartwood of a tree in this cohort (kg C tree).
Nitrogen content in seeds of a tree in this cohort (kg N tree).
Nitrogen content in leaves of a tree in this cohort (kg N tree).
Nitrogen content in fine roots of a tree in this cohort (kg N tree).
Nitrogen content in sapwood of a tree in this cohort (kg N tree).
Nitrogen content in heartwood of a tree in this cohort (kg N tree).
Non-structural nitrogen of a tree in this cohort (kg N tree).
Total growth of a tree, including carbon allocated to seeds, leaves, fine roots, and sapwood (kg C tree yr).
Fraction of carbon allocated to seeds to total growth.
Fraction of carbon allocated to leaves to total growth.
Fraction of carbon allocated to fine roots to total growth.
Fraction of carbon allocated to sapwood to total growth.
Net primary productivity of a tree (kg C tree yr).
Gross primary productivity of a tree (kg C tree yr).
Plant autotrophic respiration (kg C tree yr).
Nitrogen uptake (kg N tree yr).
Nitrogen fixation (kg N tree yr).
Mortality rate of this cohort, including natural mortality, starvation and any other processes causing a loss of individuals in general (yr).
Plant to soil N flux due to mortality, including natural mortality, starvation and any other processes causing a loss of individuals in general (kg N yr m).
Plant to soil C flux due to mortality, including natural mortality, starvation and any other processes causing a loss of individuals in general (kg C yr m).
restart_init_cohortA data.frame that can be passed back as init_cohort for a restart run.
It contains the initialized pools together with restart-only cohort state such as phenology status, canopy layer,
GDD, leaf age, and the stored bl_max/br_max targets.
restart_init_soilA one-row data.frame that can be passed back as init_soil for a restart run.
It contains the soil pools together with the tile-level phenology restart state currently used during initialization.
If there are multiple land units (LU) there will also be a column named 'aggregated' containing a data.frame in the column 'output_annual_cell' with annual outputs aggregating all tiles present in the simulation cell. Note that quantities per m2 refer to m2 of grid cell area, i.e. the full area of the BiomeE simulation. 'lu_fraction' refers to the sum of all the tiles, which must remain constant and which represents the fraction of the cell area that is not water/ice. In most cases, it would be close to 1. It contains columns:
output_annual_cellA data.frame with annual outputs aggregating all tiles present in the simulation cell. Note that quantities per m refer to m of grid cell
area, i.e. the full area of the BiomeE simulation. 'lu_fraction' refers to the sum of all the tiles, which must remain constant and which represents the
fraction of the cell area that is not water/ice. In most cases, it would be close to 1.
See above for output_yearly_tile, but now expressed per unit area of the BiomeE grid cell.
Fraction of BiomeE grid cell that is occupied by this land unit (LU tile) tile (unitless, or m LU area per m grid cell area).
Carbon in product pool 1 (kg C m grid cell).
Nitrogen in product pool 1 (kg N m grid cell).
Carbon in product pool 2 (kg C m grid cell).
Nitrogen in product pool 2 (kg N m grid cell).
Carbon loss rate directly from land use change (LUC) (kg C m grid cell yr).
Nitrogen loss rate directly from land use change (LUC) (kg C m grid cell yr).
Carbon loss rate from product pool 1 (kg C m grid cell yr).
Nitrogen loss rate from product pool 1 (kg N m grid cell yr).
Carbon loss rate from product pool 2 (kg C m grid cell yr).
Nitrogen loss rate from product pool 2 (kg N m grid cell yr).
# do not run long-running simulations # Example BiomeE model run # Use example drivers data drivers <- biomee_p_model_drivers # Run BiomeE for the first site mod_output <- run_biomee_f_bysite( sitename = drivers$sitename[1], params_siml = drivers$params_siml[[1]], site_info = drivers$site_info[[1]], forcing = drivers$forcing[[1]], params_tile = drivers$params_tile[[1]], params_species = drivers$params_species[[1]], init_cohort = drivers$init_cohort[[1]], init_soil = drivers$init_soil[[1]] )# do not run long-running simulations # Example BiomeE model run # Use example drivers data drivers <- biomee_p_model_drivers # Run BiomeE for the first site mod_output <- run_biomee_f_bysite( sitename = drivers$sitename[1], params_siml = drivers$params_siml[[1]], site_info = drivers$site_info[[1]], forcing = drivers$forcing[[1]], params_tile = drivers$params_tile[[1]], params_species = drivers$params_species[[1]], init_cohort = drivers$init_cohort[[1]], init_soil = drivers$init_soil[[1]] )
Run P-model on a single site for a forcing time series.
run_pmodel_f_bysite( sitename, params_siml, site_info, forcing, params_modl, makecheck = TRUE, verbose = TRUE )run_pmodel_f_bysite( sitename, params_siml, site_info, forcing, params_modl, makecheck = TRUE, verbose = TRUE )
sitename |
Site name. |
params_siml |
Simulation parameters. See |
site_info |
Site meta info in a data.frame. |
forcing |
A data frame of forcing climate data, used as input. |
params_modl |
A named list of free (calibratable) model parameters. See |
makecheck |
A logical specifying whether checks are performed
to verify forcings and model parameters. |
verbose |
A logical specifying whether to print warnings.
Defaults to For further specifications of above inputs and examples see |
Depending on the input model parameters, it's possible to run the different P-model setups presented in Stocker et al. 2020 GMD. The P-model version implemented in this package allows more flexibility than the one presented in the paper, with the following functions:
The temperature dependence of the quantum yield efficiency is given by: if , if , and if .
The ORG setup can be reproduced by setting kphio_par_a = 0
and calibrating the kphio parameter only.
The BRC setup (which calibrates in Eq. 18) is more difficult to reproduce,
since the temperature-dependency has been reformulated and a custom cost
function would be necessary for calibration. The new parameters
are related to as follows:
The soil moisture stress is implemented as if
and if .
In Stocker et al. 2020 GMD, the threshold plant-available soil water is set as
= 0.6 * whc where whc is the site's water holding capacity. Also,
the reduction at low soil moisture () was parameterized
as a linear function of mean aridity (Eq. 20 in Stocker et al. 2020 GMD) but is
considered a constant model parameter in this package.
Hence, the FULL calibration setup cannot be
exactly replicated.
Model output is provided as a tidy dataframe (tibble), with columns:
dateDate of the observation in YYYY-MM-DD format.
year_decDecimal representation of year and day of the year (for example, 2007.000 corresponds to 2007-01-01 and 2007.003 to 2007-01-02.
faparFraction of photosynthetic active radiation (fAPAR), taking values between 0 and 1.
gppGross Primary Productivity (GPP) for each time stamp
(in gC m d).
aetActual evapotranspiration (AET), calculated by SPLASH following Priestly-Taylor (in mm d).
leLatent heat flux (in J m d).
petPotential evapotranspiration (PET), calculated by SPLASH following Priestly-Taylor (in mm d).
vcmaxMaximum rate of RuBisCO carboxylation
(Vcmax) (in mol C m s).
jmaxMaximum rate of electron transport for RuBP regeneration
(in mol CO m s).
vcmax25Maximum rate of carboxylation (Vcmax),
normalised to 25C (in mol C m s).
jmax25Maximum rate of electron transport, normalised to
25C (in mol C m s).
gs_acclAcclimated stomatal conductance (in
mol C (mol photons) Pa. (Multiply by
ppfd (mol photons m d) and fapar
to express per unit ground area and time.)
wscalRelative soil water content, between 0 (permanent wilting point, PWP) and 1 (field capacity, FC).
chiRatio of leaf-internal to ambient CO, ci:ca (unitless).
iwueIntrinsic water use efficiency (iWUE) (unitless, multiply with patm (Pa) to get iWUE in Pa).
rdDark respiration (Rd) in gC m s.
(Multiply by 1/12 (mol C / gC) to convert to mol C m s.)
tsoilSoil temperature, in C.
netradNet radiation, in W m. WARNING: this is currently ignored as a model forcing. Instead, net radiation is internally calculated by SPLASH.
wcontSoil water content, in mm.
snowSnow water equivalents, in mm.
condWater input by condensation, in mm d
cleafC mass of a virtual leaf carbon pool to keep track of isotopic composition, in gC m
cleafd13c13C isotopic signature (delta) of cleaf, in permil.
# 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, # disable temperature-dependence of kphio kphio_par_b = 1.0, soilm_thetastar = 0.6 * 240, # old setup with soil moisture stress soilm_betao = 0.0, beta_unitcostratio = 146.0, rd_to_vcmax = 0.014, # from Atkin et al. 2015 for C3 herbaceous tau_acclim = 30.0, kc_jmax = 0.41 ) # Run the Fortran P-model mod_output <- run_pmodel_f_bysite( # unnest drivers example data sitename = pmodel_drivers$sitename[[5]], params_siml = pmodel_drivers$params_siml[[5]], site_info = pmodel_drivers$site_info[[5]], forcing = pmodel_drivers$forcing[[5]], params_modl = params_modl )# 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, # disable temperature-dependence of kphio kphio_par_b = 1.0, soilm_thetastar = 0.6 * 240, # old setup with soil moisture stress soilm_betao = 0.0, beta_unitcostratio = 146.0, rd_to_vcmax = 0.014, # from Atkin et al. 2015 for C3 herbaceous tau_acclim = 30.0, kc_jmax = 0.41 ) # Run the Fortran P-model mod_output <- run_pmodel_f_bysite( # unnest drivers example data sitename = pmodel_drivers$sitename[[5]], params_siml = pmodel_drivers$params_siml[[5]], site_info = pmodel_drivers$site_info[[5]], forcing = pmodel_drivers$forcing[[5]], params_modl = params_modl )
Run P-model on a single site for a single time step. This does not include the simulation of ecosystem-level quantities, water limitation, nor a simulation of water fluxes. Instead, this corresponds to a leaf-level representation of the acclimation of photosynthesis.
run_pmodel_onestep_f_bysite(lc4, forcing, params_modl, makecheck = TRUE)run_pmodel_onestep_f_bysite(lc4, forcing, params_modl, makecheck = TRUE)
lc4 |
Logical specifying whether P-model simulation is for C4 (as opposed to C3). Defaults to |
forcing |
A data frame of forcing climate data, used as input (single row). |
params_modl |
A named list of free (calibratable) model parameters. See |
makecheck |
A logical specifying whether checks are performed
to verify forcings and model parameters. For further specifications of above inputs and examples see |
TBC
Model output is provided as a tidy dataframe (tibble), with columns:
vcmaxMaximum rate of RuBisCO carboxylation
(Vcmax) (in mol C m s).
jmaxMaximum rate of electron transport for RuBP regeneration
(in mol CO m s).
vcmax25Maximum rate of carboxylation (Vcmax),
normalised to 25C (in mol C m s).
jmax25Maximum rate of electron transport, normalised to
25C (in mol C m s).
gs_acclAcclimated stomatal conductance (in
mol C (mol photons) Pa. (Multiply by
ppfd (mol photons m d) and fapar
to express per unit ground area and time.)
chiRatio of leaf-internal to ambient CO, ci:ca (unitless).
iwueIntrinsic water use efficiency (iWUE) (unitless, multiply with patm (Pa) to get iWUE in Pa).
rdDark respiration (Rd) in gC m s.
(Multiply by 1/12 (mol C / gC) to convert to mol C m s.)
bigdelta13C isotope discrimination of leaf assimilates against atmospheric signature (permil).
# 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, # disable temperature-dependence of kphio kphio_par_b = 1.0, beta_unitcostratio = 146.0, rd_to_vcmax = 0.014, # from Atkin et al. 2015 for C3 herbaceous kc_jmax = 0.41 ) # Run the Fortran P-model run_pmodel_onestep_f_bysite( lc4 = FALSE, forcing = data.frame( temp = 20, # temperature, deg C vpd = 1000, # Pa, ppfd = 300 / 10^6, # mol/m2/s co2 = 400, # ppm, patm = 101325 # Pa ), params_modl = list( kphio = 0.04998, # setup ORG in Stocker et al. 2020 GMD kphio_par_a = 0.0, # disable temperature-dependence of kphio kphio_par_b = 1.0, beta_unitcostratio = 146.0, rd_to_vcmax = 0.014, # from Atkin et al. 2015 for C3 herbaceous kc_jmax = 0.41 ), makecheck = TRUE )# 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, # disable temperature-dependence of kphio kphio_par_b = 1.0, beta_unitcostratio = 146.0, rd_to_vcmax = 0.014, # from Atkin et al. 2015 for C3 herbaceous kc_jmax = 0.41 ) # Run the Fortran P-model run_pmodel_onestep_f_bysite( lc4 = FALSE, forcing = data.frame( temp = 20, # temperature, deg C vpd = 1000, # Pa, ppfd = 300 / 10^6, # mol/m2/s co2 = 400, # ppm, patm = 101325 # Pa ), params_modl = list( kphio = 0.04998, # setup ORG in Stocker et al. 2020 GMD kphio_par_a = 0.0, # disable temperature-dependence of kphio kphio_par_b = 1.0, beta_unitcostratio = 146.0, rd_to_vcmax = 0.014, # from Atkin et al. 2015 for C3 herbaceous kc_jmax = 0.41 ), makecheck = TRUE )
Runs BiomeE model for multiple sites.
runread_biomee_f(drivers, makecheck = TRUE, parallel = FALSE, ncores = 1)runread_biomee_f(drivers, makecheck = TRUE, parallel = FALSE, ncores = 1)
drivers |
A nested data frame with one row for each site and columns
named according to the arguments of function |
makecheck |
A logical specifying whether checks are performed
to verify forcings and model parameters. |
parallel |
Deprecated. Use ncores instead. |
ncores |
An integer specifying the number of cores used for parallel computing (sites processed in parallel). Default: 1 (no parallel execution). |
A data frame (tibble) with one row for each site.
The columns are the site information site_info and one column per land unit (LU) in addition to an aggregated output aggregated.
By default, the only LU is named data and aggregated is not present since aggregating one LU is not useful.
When multiple LU are configured (using init_lu), the columns are named using the LU name provided in init_lu.
See run_biomee_f_bysite for a detailed description of the outputs.
Example outputs are provided as biomee_p_model_output and biomee_p_model_luluc_output.
# Example BiomeE model run # do not run long-running simulations runread_biomee_f( drivers = biomee_p_model_drivers ) ## Not run: # do not run this long-running example at all, only *show* example runread_biomee_f( drivers = biomee_gs_leuning_drivers ) ## End(Not run)# Example BiomeE model run # do not run long-running simulations runread_biomee_f( drivers = biomee_p_model_drivers ) ## Not run: # do not run this long-running example at all, only *show* example runread_biomee_f( drivers = biomee_gs_leuning_drivers ) ## End(Not run)
Runs P-model for multiple sites.
runread_pmodel_f(drivers, par, makecheck = TRUE, parallel = FALSE, ncores = 1)runread_pmodel_f(drivers, par, makecheck = TRUE, parallel = FALSE, ncores = 1)
drivers |
A nested data frame with one row for each site and columns
|
par |
A named list of free (calibratable) model parameters.
|
makecheck |
A logical specifying whether checks are performed
to verify forcings and model parameters. |
parallel |
A logical specifying whether simulations are to be
parallelised (sending data from a certain number of sites to each core).
Defaults to |
ncores |
An integer specifying the number of cores used for parallel
computing (by default |
Depending on the input model parameters, it's possible to run the different P-model setups presented in Stocker et al. 2020 GMD. The P-model version implemented in this package allows more flexibility than the one presented in the paper, with the following functions:
The temperature dependence of the quantum yield efficiency is given by: if , if , and if .
The ORG setup can be reproduced by setting kphio_par_a = 0
and calibrating the kphio parameter only.
The BRC setup (which calibrates in Eq. 18) is more difficult to reproduce,
since the temperature-dependency has been reformulated and a custom cost
function would be necessary for calibration. The new parameters
are related to as follows:
The soil moisture stress is implemented as if
and if .
In Stocker et al. 2020 GMD, the threshold plant-available soil water is set as
= 0.6 * whc where whc is the site's water holding capacity. Also,
the reduction at low soil moisture () was parameterized
as a linear function of mean aridity (Eq. 20 in Stocker et al. 2020 GMD) but is
considered a constant model parameter in this package.
Hence, the FULL calibration setup cannot be
exactly replicated.
A data frame (tibble) with one row for each site, site information
stored in the nested column site_info and outputs stored in the nested
column data. See run_pmodel_f_bysite and
run_pmodel_onestep_f_bysite for a detailed
description of the outputs.
Example outputs are provided as pmodel_output.
# 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, # disable temperature-dependence of kphio kphio_par_b = 1.0, soilm_thetastar = 0.6 * 240, # old setup with soil moisture stress soilm_betao = 0.0, beta_unitcostratio = 146.0, rd_to_vcmax = 0.014, # from Atkin et al. 2015 for C3 herbaceous tau_acclim = 30.0, kc_jmax = 0.41 ) # Run the model for these parameters and the example drivers output <- rsofun::runread_pmodel_f( drivers = rsofun::pmodel_drivers |> dplyr::slice(1), par = params_modl) output <- rsofun::runread_pmodel_f( drivers = rsofun::pmodel_drivers |> dplyr::slice(1), par = params_modl, parallel = TRUE, ncores = 3)# 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, # disable temperature-dependence of kphio kphio_par_b = 1.0, soilm_thetastar = 0.6 * 240, # old setup with soil moisture stress soilm_betao = 0.0, beta_unitcostratio = 146.0, rd_to_vcmax = 0.014, # from Atkin et al. 2015 for C3 herbaceous tau_acclim = 30.0, kc_jmax = 0.41 ) # Run the model for these parameters and the example drivers output <- rsofun::runread_pmodel_f( drivers = rsofun::pmodel_drivers |> dplyr::slice(1), par = params_modl) output <- rsofun::runread_pmodel_f( drivers = rsofun::pmodel_drivers |> dplyr::slice(1), par = params_modl, parallel = TRUE, ncores = 3)