aboutsummaryrefslogtreecommitdiff
path: root/R/PEC_sw_focus.R
diff options
context:
space:
mode:
Diffstat (limited to 'R/PEC_sw_focus.R')
-rw-r--r--R/PEC_sw_focus.R19
1 files changed, 10 insertions, 9 deletions
diff --git a/R/PEC_sw_focus.R b/R/PEC_sw_focus.R
index c01dece..4d5139e 100644
--- a/R/PEC_sw_focus.R
+++ b/R/PEC_sw_focus.R
@@ -24,24 +24,24 @@
#' @note Step 2 is not implemented.
#' @export
#' @param parent A list containing substance specific parameters, e.g.
-#' conveniently generated by \code{\link{chent_focus_sw}}.
+#' conveniently generated by [chent_focus_sw].
#' @param rate The application rate in g/ha. Overriden when
#' applications are given explicitly
#' @param n The number of applications
#' @param i The application interval
#' @param comment A comment for the input file
#' @param met A list containing metabolite specific parameters. e.g.
-#' conveniently generated by \code{\link{chent_focus_sw}}. If not NULL,
+#' conveniently generated by [chent_focus_sw]. If not NULL,
#' the PEC is calculated for this compound, not the parent.
#' @param f_drift The fraction of the application rate reaching the waterbody
#' via drift. If NA, this is derived from the scenario name and the number
#' of applications via the drift data defined by the
-#' \code{\link{FOCUS_Step_12_scenarios}}
+#' [FOCUS_Step_12_scenarios]
#' @param f_rd The fraction of the amount applied reaching the waterbody via
#' runoff/drainage. At Step 1, it is assumed to be 10%, be it the
#' parent or a metabolite
#' @param scenario The name of the scenario. Must be one of the scenario
-#' names given in \code{\link{FOCUS_Step_12_scenarios}}
+#' names given in [FOCUS_Step_12_scenarios]
#' @param region 'n' for Northern Europe or 's' for Southern Europe. If NA, only
#' Step 1 PECsw are calculated
#' @param season 'of' for October to February, 'mm' for March to May, and 'js'
@@ -64,7 +64,7 @@
#'
#' # Metabolite
#' new_dummy <- chent_focus_sw("New Dummy", mw = 250, Koc = 100)
-#' M1 <- chent_focus_sw("M1", mw = 100, cwsat = 100, DT50_ws = 100, Koc = 50,
+#' M1 <- chent_focus_sw("M1", mw = 100, cwsat = 100, DT50_ws = 100, Koc = 50,
#' max_ws = 0, max_soil = 0.5)
#' PEC_sw_focus(new_dummy, 1000, scenario = "cereals, winter", met = M1)
PEC_sw_focus <- function(parent, rate, n = 1, i = NA,
@@ -81,8 +81,9 @@ PEC_sw_focus <- function(parent, rate, n = 1, i = NA,
{
if (n > 1 & is.na(i)) stop("Please specify the interval i if n > 1")
+ scenario = match.arg(scenario)
+
if (is.na(f_drift)) {
- scenario = match.arg(scenario)
f_drift = FOCUS_Step_12_scenarios$drift[scenario, "1"] / 100
# For Step 2 we would select the reduced percentiles for multiple apps:
if (n <= 8) {
@@ -128,7 +129,6 @@ PEC_sw_focus <- function(parent, rate, n = 1, i = NA,
}
on.exit(close(txt))
- scenario = match.arg(scenario)
region = match.arg(region)
season = match.arg(season)
interception = match.arg(interception)
@@ -179,10 +179,11 @@ PEC_sw_focus <- function(parent, rate, n = 1, i = NA,
reg_sea = reg_code + sea_code
}
+ scenario_safe <- sub(" /", " or", scenario)
if (is.null(met)) {
- name_input <- paste(parent$name, scenario, region, season)
+ name_input <- paste(parent$name, scenario_safe, region, season)
} else {
- name_input <- paste(met$name, scenario, region, season)
+ name_input <- paste(met$name, scenario_safe, region, season)
}
if (comment != "") name_input = paste(name_input, comment)

Contact - Imprint