Skip to content

Commit

Permalink
Merge pull request #188 from pepaaran/master
Browse files Browse the repository at this point in the history
Fortran updates from Beni and increase to v4.4.1
  • Loading branch information
khufkens authored Nov 2, 2023
2 parents 402128e + 9d37c02 commit fadea66
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 22 deletions.
4 changes: 2 additions & 2 deletions CRAN-SUBMISSION
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Version: 4.4
Date: 2023-10-30 09:56:10 UTC
SHA: 50aa48c8f7cb621dcd99b77ccd6ea6d8e8ca13ba
Date: 2023-10-31 17:03:39 UTC
SHA: 543a930620fe60662e8c6aa0d50544fcbd44c298
2 changes: 1 addition & 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: 4.4
Version: 4.4.1
Authors@R: c(
person(
family = "Benjamin",
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 v4.4.1

* bugfix Fortran modules

# rsofun v4.4

* bugfix on input data type P-model
Expand Down
37 changes: 18 additions & 19 deletions analysis/paper_results.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ library(sensitivity)
library(BayesianTools)
library(tictoc)

# Figure 1 #####
# Figure 1 - removed #####

# define model parameter values from Stocker et al 2020
params_modl <- list(
Expand Down Expand Up @@ -71,9 +71,6 @@ ggplot(data = df_gpp_plot) +
# and take a long time to run.
# For checking reproducibility, run the commented code.

# Load Morris sensitivity output from sensitivity_analysis.Rmd
load("vignettes/files/morrisOut.rda")

# Define log-likelihood function
ll_pmodel <- function(
par_v # a vector of all calibratable parameters including errors
Expand Down Expand Up @@ -135,16 +132,19 @@ morris_setup <- BayesianTools::createBayesianSetup(
names = names(par_cal_best)
)

# # Run Morris sensitivity analysis
# set.seed(432)
# morrisOut <- sensitivity::morris(
# model = morris_setup$posterior$density,
# factors = names(par_cal_best),
# r = 1000,
# design = list(type = "oat", levels = 20, grid.jump = 3),
# binf = par_cal_min,
# bsup = par_cal_max,
# scale = TRUE)
# Run Morris sensitivity analysis
set.seed(432)
morrisOut <- sensitivity::morris(
model = morris_setup$posterior$density,
factors = names(par_cal_best),
r = 1000,
design = list(type = "oat", levels = 20, grid.jump = 3),
binf = par_cal_min,
bsup = par_cal_max,
scale = TRUE)

# Save results
saveRDS(morrisOut, "analysis/paper_results_files/morrisOut_paper.rda")

# Summarise the morris output
morrisOut.df <- data.frame(
Expand Down Expand Up @@ -182,9 +182,6 @@ morrisOut.df |>
# and take a long time to run.
# For checking reproducibility, run the commented code.

# Load calibration output from sensitivity_analysis.Rmd
load("vignettes/files/par_calib.rda")

# Code to produce file
# Calibrates kphio, betao, kc_jmax - top 3 model params
set.seed(2023)
Expand Down Expand Up @@ -226,10 +223,10 @@ par_calib <- calib_sofun(
targets = "gpp"
)

toc() # took 1555.601 sec to run
toc() # took 552.854 sec to run

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

# Define functions for plotting (re-use BayesianTools hidden code)
getSetup <- function(x) {
Expand Down Expand Up @@ -354,6 +351,8 @@ pmodel_runs <- samples_par |>
gpp_pred_q95 = quantile(gpp_pred, 0.95, na.rm = TRUE)
)

saveRDS(pmodel_runs, file = "analysis/paper_results_files/pmodel_runs_paper.rda")

# Plot the credible intervals computed above
# for the first year only
plot_gpp_error <- ggplot(data = pmodel_runs |>
Expand Down
Binary file added analysis/paper_results_files/morrisOut_paper.rda
Binary file not shown.
Binary file added analysis/paper_results_files/par_calib_paper.rda
Binary file not shown.
Binary file not shown.

0 comments on commit fadea66

Please sign in to comment.