aboutsummaryrefslogtreecommitdiff
path: root/R/PELMO_runs.R
diff options
context:
space:
mode:
Diffstat (limited to 'R/PELMO_runs.R')
-rw-r--r--R/PELMO_runs.R30
1 files changed, 26 insertions, 4 deletions
diff --git a/R/PELMO_runs.R b/R/PELMO_runs.R
index 3d4f03b..e5a78ff 100644
--- a/R/PELMO_runs.R
+++ b/R/PELMO_runs.R
@@ -12,7 +12,7 @@
#' run directory, holding the results for all FOCUS periods, equivalent to
#' the period.plm file generated by the FOCUS PELMO GUI.
#'
-#' @return If evaluate is TRUE, a list of lists of data frames holding the
+#' @return If evaluate is TRUE, a list of lists of matrices holding the
#' PEC data.
#' @param runs A list of lists. Each inner lists has an element named 'psm'
#' that holds the psm string, and elements named using three letter crop acronyms,
@@ -29,7 +29,31 @@
#' @references PELMO.installeR \url{https://jranke.github.io/PELMO.installeR}
#'
#' Wine \url{https://winehq.org}
+#'
+#' PELMO test results \url{http://esdac.jrc.ec.europa.eu/public_path/projects_data/focus/gw/models/pelmo/test-results/test_results_FOCUS_PELMO_5_5_3.doc}
#' @export
+#' @examples
+#' # Reproduce the official test results for annual application of Pesticide D
+#' # to winter cereals at the day before emergence
+#' runs_1 <- list(
+#' list(psm = 'Pesticide_D',
+#' win = c("Cha", "Ham", "Jok", "Kre", "Oke", "Pia", "Por", "Sev", "Thi")),
+#' list(psm = 'Pesticide_D_1_day_pre_em_every_third_year',
+#' pot = c("Cha", "Ham", "Jok", "Kre", "Oke", "Pia", "Por", "Sev", "Thi")))
+#' time_1 <- system.time(
+#' PECgw_1 <- PELMO_runs(runs_1, psm_dir = system.file("testdata", package = "pfm"),
+#' cores = 6, overwrite = TRUE)
+#' )
+#' print(PECgw_1)
+#' # We get exactly the same PECgw values (on Linux, calling PELMO using Wine).
+#' print(time_1)
+#'
+#' # Demonstrate some results with metabolites.
+#' runs_2 <- list(list(psm = 'Pesticide_D_1_May_every_other_year_mets',
+#' win = c("Cha", "Ham", "Kre")))
+#' PECgw_2 <- PELMO_runs(runs_2, psm_dir = system.file("testdata", package = "pfm"),
+#' cores = 3, overwrite = TRUE)
+#' print(PECgw_2)
PELMO_runs <- function(runs, psm_dir = ".", version = "5.5.3", PELMO_base = "auto",
execute = TRUE, cores = getOption("mc.cores", 2L),
evaluate = TRUE, overwrite = FALSE)
@@ -142,13 +166,11 @@ PELMO_runs <- function(runs, psm_dir = ".", version = "5.5.3", PELMO_base = "aut
# the exe file from this directory
file.copy(file.path(PELMO_base, "lf90.eer"), run_dir)
}
- run_list[[7]]
- setup_run(run_list[[7]])
lapply(run_list, setup_run)
if (execute) {
- run_PELMO(runs, version = version, PELMO_base = PELMO_base)
+ run_PELMO(runs, version = version, PELMO_base = PELMO_base, cores = cores)
}
if (evaluate) {

Contact - Imprint