Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
69e46ef
just coding style
fabern Jul 7, 2025
e1a9202
Remove unused declarations of dAleaf and dAleaf_pool
fabern Jul 7, 2025
26388f7
added one-step function for P-model
fabern Jul 7, 2025
75193bd
Fix typo in biomee interface
fabern Jul 7, 2025
e99eaa5
Make pmodel_onestep_f public
fabern Jul 7, 2025
5b8ca3c
Refactor pmodel output following biomee code
fabern Jul 7, 2025
ff59c8f
Reorder arguments of run_pmodel_f_bysite() to prepare refactoring
fabern Jul 7, 2025
ee3a7c6
Refactor pmodel_onestep output following biomee code
fabern Jul 7, 2025
df4e0ff
Add simple test for run_pmodel_onestep_f_bysite()
fabern Jul 8, 2025
f9feb84
Fix test comparison between rpmodel::rpmodel() and run_pmodel_onestep…
fabern Jul 18, 2025
d65ef22
Standardize unit style in comments
fabern Jul 18, 2025
513474f
Add further comments on units
fabern Jul 18, 2025
afd13a8
Standardize unit style in comments II
fabern Jul 20, 2025
359cf56
Fix units of iwue, rd, and gs_accl (gs_setpoint) in documentation/com…
fabern Jul 20, 2025
d4c5518
Update correct units in vignette for run_pmodel_onestep_f_bysite()
fabern Jul 21, 2025
80d57db
Increment version number to 5.2.0
fabern Jul 21, 2025
26a0ff7
Clarify different units of dppfd and ppfd_splash
fabern Jul 23, 2025
21086af
Standardize unit style in comments III
fabern Jul 23, 2025
0139958
Return explicitly NA if pmodel not run
fabern Jul 28, 2025
3ee4cfd
Follow style of NEWS.md
fabern Jul 28, 2025
228d624
Decrease pkg-tarball size <5MB for CRAN
fabern Jul 28, 2025
395a083
Update cran-comments.md
fabern Jul 28, 2025
827bf35
Mark as dev version for merge into main
fabern Jul 28, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: rsofun
Title: The P-Model and BiomeE Modelling Framework
Version: 5.1.0
Version: 5.1.0.9000
Authors@R: c(
person(
family = "Stocker",
Expand Down Expand Up @@ -82,6 +82,7 @@ Suggests:
ggplot2,
knitr,
sensitivity,
rpmodel,
gridExtra,
patchwork
VignetteBuilder: knitr
Expand Down
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export(cost_rmse_biomee)
export(cost_rmse_pmodel)
export(run_biomee_f_bysite)
export(run_pmodel_f_bysite)
export(run_pmodel_onestep_f_bysite)
export(runread_biomee_f)
export(runread_pmodel_f)
import(BayesianTools)
Expand Down
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# rsofun (development version)

* New `run_pmodel_onestep_f_bysite()` adds single-step leaf-level simulations of the P-model.

# rsofun 5.1.0

## New features
Expand Down
33 changes: 18 additions & 15 deletions R/calib_sofun.R
Original file line number Diff line number Diff line change
Expand Up @@ -95,18 +95,18 @@ calib_sofun <- function(
lower <- upper <- out_optim <- NULL

# check input variables
if(missing(obs) | missing(drivers) | missing(settings)){
if (missing(obs) | missing(drivers) | missing(settings)){
stop("missing input arguments, please check all parameters")
}

# check data structure
if(is.data.frame(obs)){
if (is.data.frame(obs)){
if (nrow(obs) == 0){
warning("no validation data available, returning NA parameters")
return(lapply(settings$par,
function(x) NA))
}
}else{
} else {
stop("obs must be a (nested) data.frame")
}

Expand All @@ -131,9 +131,10 @@ calib_sofun <- function(
drivers = drivers,
...
)
if(optim_out){

if (optim_out){
out_optim <- list(par = out$par, mod = out)
}else{
} else {
out_optim <- list(par = out$par)
}

Expand Down Expand Up @@ -163,14 +164,15 @@ calib_sofun <- function(
# setup the bayes run, no message forwarding is provided
# so wrap the function in a do.call
setup <- BayesianTools::createBayesianSetup(
likelihood = function(
random_par) {
do.call("cost",
list(
par = random_par,
obs = obs,
drivers = drivers
))
likelihood = function(random_par){
do.call(
"cost",
list(
par = random_par,
obs = obs,
drivers = drivers
)
)
},
prior = priors,
names = names(settings$par)
Expand All @@ -189,9 +191,10 @@ calib_sofun <- function(
# drop last value
bt_par <- BayesianTools::MAP(out)$parametersMAP
bt_par <- bt_par[1:(length(bt_par))]
if(optim_out){

if (optim_out){
out_optim <- list(par = bt_par, mod = out)
}else{
} else {
out_optim <- list(par = bt_par)
}

Expand Down
8 changes: 4 additions & 4 deletions R/data.R
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#' \item{tmax}{Daily maximum air temperature in \eqn{^\circ}C.}
#' \item{fapar}{Fraction of photosynthetic active radiation (fAPAR), taking
#' values between 0 and 1.}
#' \item{co2}{Atmospheric CO\eqn{_2} concentration.}
#' \item{co2}{Atmospheric CO\eqn{_2} concentration in ppm.}
#' \item{ccov}{Cloud coverage in \%. This is only used when either PPFD or
#' net radiation are not prescribed.}
#' }
Expand Down Expand Up @@ -214,13 +214,13 @@
#' }}
#' \item{forcing}{Forcing data.frame used as input
#' \describe{
#' \item{ppfd}{Photosynthetic photon flux density (mol s-1 m-2)}
#' \item{ppfd}{Photosynthetic photon flux density (mol m-2 s-1)}
#' \item{tair}{Air temperature (deg C)}
#' \item{vpd}{Vapor pressure deficit (Pa)}
#' \item{rain}{Precipitation (kgH2O m-2 s-1 == mm s-1)}
#' \item{wind}{Wind velocity (m s-1)}
#' \item{pair}{Atmospheric pressure (pa)}
#' \item{co2}{CO2 atmospheric concentration (ppm)}
#' \item{pair}{Atmospheric pressure (Pa)}
#' \item{co2}{Atmospheric CO\eqn{_2} concentration in ppm.}
#' }}
#' \item{params_tile}{Tile-level model parameters, into a single row data.frame, including the following data:
#' \describe{
Expand Down
101 changes: 0 additions & 101 deletions R/init_dates_dataframe.R

This file was deleted.

4 changes: 2 additions & 2 deletions R/run_biomee_f_bysite.R
Original file line number Diff line number Diff line change
Expand Up @@ -271,13 +271,13 @@ run_biomee_f_bysite <- function(
n_annual_trans = as.integer(n_annual_trans)
)

out <- build_out(biomeeout, init_lu$name, sitename, params_siml$do_daily_diagnostics)
out <- build_out_biomee(biomeeout, init_lu$name, sitename, params_siml$do_daily_diagnostics)

return(out)
}

# Build R output
build_out <- function(biomeeout, lu_names, sitename, do_daily_diagnostics){
build_out_biomee <- function(biomeeout, lu_names, sitename, do_daily_diagnostics){
if (do_daily_diagnostics) {
# If simulation is very long, output gets massive.
# E.g., In a 3000 years-simulation 'biomeeout' is 11.5 GB.
Expand Down
Loading
Loading