aboutsummaryrefslogtreecommitdiff
path: root/man/PELMO_runs.Rd
blob: 60216135a2bffbb8531400c36c0d456f55b89640 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/PELMO_runs.R
\name{PELMO_runs}
\alias{PELMO_runs}
\alias{run_PELMO}
\alias{evaluate_PELMO}
\title{Set up runs for FOCUS PELMO}
\usage{
PELMO_runs(runs, psm_dir = ".", version = "5.5.3", PELMO_base = "auto",
  execute = TRUE, cores = getOption("mc.cores", 2L), evaluate = TRUE,
  overwrite = FALSE)

run_PELMO(runs, version = "5.5.3", PELMO_base = "auto",
  cores = getOption("mc.cores", 2L))

evaluate_PELMO(runs, version = "5.5.3", PELMO_base = "auto")
}
\arguments{
\item{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,
as used in \code{\link{FOCUS_PELMO_crops}},
that hold character vectors of three letter scenario acronyms
as used in \code{\link{FOCUS_GW_scenarios_2012}}.}

\item{psm_dir}{The directory where the psm files are located}

\item{version}{The FOCUS PELMO version}

\item{PELMO_base}{Where the FOCUS PELMO installation is located}

\item{execute}{Should PELMO be executed directly?}

\item{cores}{The number of cores to execute PELMO runs in parallel}

\item{evaluate}{Should the results be returned?}

\item{overwrite}{Should existing run directories be overwritten?}
}
\value{
If evaluate is TRUE, a list of lists of matrices holding the
  PEC data.
}
\description{
Per default, the runs are not only set up but also executed with FOCUS
PELMO, the results are processed and returned. Currently, only FOCUS PELMO
as installed on Linux (or other Unix systems)
using the \code{install_PELMO} from the \code{PELMO.installeR} package
maintained on github is supported. In such installations, FOCUS PELMO is
installed into the package installation directory of \code{PELMO.installeR}
and run using \code{wine}.
}
\details{
As a side effect, an R data file (period_pfm.rda) is generated in each
run directory, holding the results for all FOCUS periods, equivalent to
the period.plm file generated by the FOCUS PELMO GUI.
}
\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 = 15, overwrite = TRUE)
)
print(PECgw_1)
# We get exactly the same PECgw values (on Linux, calling PELMO using Wine).
print(time_1)
if(!inherits(try(cpuinfo <- readLines("/proc/cpuinfo")), "try-error")) {
  cat(gsub("model name\\t: ", "CPU model: ", cpuinfo[grep("model name", cpuinfo)[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)
}
\references{
PELMO.installeR \url{https://pkgdown.jrwb.de/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}
}

Contact - Imprint