Skip to content

Commit

Permalink
Merge pull request #184 from pepaaran/master
Browse files Browse the repository at this point in the history
Amends after CRAN feedback
  • Loading branch information
pepaaran authored Oct 25, 2023
2 parents 47e2e7c + 58a39b8 commit aae2737
Show file tree
Hide file tree
Showing 19 changed files with 757 additions and 55 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Authors@R: c(
family = "Benjamin",
given = "Stocker",
email = "[email protected]",
comment = c(ORCID = "0000-0002-5070-8109"),
comment = c(ORCID = "0000-0003-2697-9096"),
role = c("aut", "cre")),
person(
family = "Hufkens",
Expand All @@ -25,7 +25,7 @@ Authors@R: c(
)
Description: Implements the Simulating Optimal FUNctioning framework for
site-scale simulations of ecosystem processes, including model
calibration. It contains Fortran modules for the P-model (Stocker
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)
Expand Down
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
* documentation parameter sensitivity analysis
* documentation on the data format
* document calibration diagnostic and model uncertainty calculation
* more transparent licensing and copyright statements in COPYING file

# rsofun v4.3

Expand Down
2 changes: 1 addition & 1 deletion R/init_dates_dataframe.R
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#' @export
#'
#' @examples
#' \dontrun{
#' \donttest{
#' ddf <- init_dates_dataframe( 2000, 2003, startmoy=1, startdoy=1,
#' freq="days", endmoy=12, enddom=31, noleap=FALSE )
#' }
Expand Down
364 changes: 349 additions & 15 deletions R/run_biomee_f_bysite.R

Large diffs are not rendered by default.

11 changes: 6 additions & 5 deletions R/runread_biomee_f.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#' Runs the BiomeE model and loads output in once.
#'
#' @param drivers A nested data frame with one row for each site and columns
#' named according to thearguments of function `runread_biomee_f_bysite()`
#' named according to the arguments of function `runread_biomee_f_bysite()`
#' @param makecheck A logical specifying whether checks are performed to verify
#' forcings.
#' @param parallel A logical specifying whether simulations are to be
Expand All @@ -12,17 +12,18 @@
#' @param ncores An integer specifying the number of cores used for parallel
#' computing. Defaults to 2.
#'
#' @return A tibble with one row for each site and outputs stored
#' in the nested column \code{data}.
#' @return A tibble with one row for each site and model outputs stored
#' in the nested column \code{data}. See `run_biomee_f_bysite()` for a
#' description of the BiomeE output variables.
#' @export
#'
#' @examples
#' \dontrun{ \donttest{
#' \donttest{
#' # Example BiomeE model run
#'
#' mod_output <- runread_biomee_f(
#' drivers = biomee_gs_leuning_drivers)
#' }}
#' }

runread_biomee_f <- function(
drivers,
Expand Down
26 changes: 21 additions & 5 deletions analysis/paper_results.R
Original file line number Diff line number Diff line change
Expand Up @@ -228,8 +228,8 @@ par_calib <- calib_sofun(

toc() # took 1555.601 sec to run

# # Save result
# saveRDS(par_calib, file = "analysis/calibration_exploration_files/par_calib_12000iterations.rsd")
# Save result
saveRDS(par_calib, file = "analysis/calibration_exploration_files/par_calib_12000iterations.rda")

# Define functions for plotting (re-use BayesianTools hidden code)
getSetup <- function(x) {
Expand Down Expand Up @@ -362,6 +362,12 @@ plot_gpp_error <- ggplot(data = pmodel_runs |>
# Merge GPP validation data (first year)
p_model_validation$data[[1]][1:365, ] |>
dplyr::rename(gpp_obs = gpp),
by = "date") |>
dplyr::left_join(
# Merge GPP before calibration
output$data[[1]][1:365, ] |>
dplyr::select(date, gpp) |>
dplyr::rename(gpp_no_calib = gpp),
by = "date")
) + # Plot only first year
geom_ribbon(
Expand All @@ -374,7 +380,15 @@ plot_gpp_error <- ggplot(data = pmodel_runs |>
ymax = gpp_q95,
x = date,
fill = "Parameter uncertainty")) +


# geom_line(
# aes(
# date,
# gpp_no_calib,
# color = "Non-calibrated predictions"
# ),
# lty = 2
# ) +
geom_line(
aes(
date,
Expand All @@ -401,9 +415,11 @@ plot_gpp_error <- ggplot(data = pmodel_runs |>
plot_gpp_error +
scale_color_manual(name = "",
breaks = c("Observations",
"Predictions"),
"Predictions",
"Non-calibrated predictions"),
values = c(t_col("black", 10),
t_col("#009E73", 10))) +
t_col("#E69F00", 10),
t_col("#56B4E9", 10))) +
scale_fill_manual(name = "",
breaks = c("Model uncertainty",
"Parameter uncertainty"),
Expand Down
16 changes: 15 additions & 1 deletion cran-comments.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,20 @@
Dear CRAN team,

This is the re-submission of the {rsofun} package. We have addressed your concerns about the DOIs in the description.
This is the re-submission of the {rsofun} package. We have addressed the following
concerns voiced by Benjamin Altman:

- Corrected the software naming in package title and description.
- Added a \value field to all the exported functions, explaining the object returned
by each function.
- Removed \dontrun statements in the documentation examples, now \donttest
is used for examples that have long runtimes.
- Included license and copyright statements in a COPYING file. The original authors
of the software borrowed for this package were contacted and permissions to use
parts of their code were discussed, as well as the copyright and license that
accompany their code. The direct authors of this package are listed in the
DESCRIPTION file.

---

The {rsofun} package provides the implementation of a modelling framework for site-scale simulations of ecosystem processes, with low level routines in Fortran 90. It contains the following models:
- P-model for leaf-level acclimation of photosynthesis from Stocker et al. (2019).
Expand Down
Binary file modified data/p_model_drivers.rda
Binary file not shown.
Binary file modified data/p_model_validation.rda
Binary file not shown.
2 changes: 1 addition & 1 deletion man/init_dates_dataframe.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit aae2737

Please sign in to comment.