diff options
author | Johannes Ranke <jranke@uni-bremen.de> | 2020-07-23 12:22:25 +0200 |
---|---|---|
committer | Johannes Ranke <jranke@uni-bremen.de> | 2020-07-23 12:22:25 +0200 |
commit | c97a4f5a9fe30ffc3321681a97eea167cfc427b5 (patch) | |
tree | 4b7fde97924879d3556a927c0a2e965fe802e80f /R | |
parent | 90fa42c86596c85168931148bf8d5fa014fa7794 (diff) |
PEC_sw_drift: Rautmann formula (1 app, Ackerbau)
This makes it possible to calculate drift PECsw for other distances than
present in the JKI data or the Rautmann paper.
Diffstat (limited to 'R')
-rw-r--r-- | R/PEC_sw_drift.R | 43 |
1 files changed, 32 insertions, 11 deletions
diff --git a/R/PEC_sw_drift.R b/R/PEC_sw_drift.R index 6fcaecf..2dfd651 100644 --- a/R/PEC_sw_drift.R +++ b/R/PEC_sw_drift.R @@ -8,7 +8,9 @@ #' @param applications Number of applications for selection of drift percentile #' @param drift_percentages Percentage drift values for which to calculate PECsw. #' 'drift_data' and 'distances' if not NULL. -#' @param drift_data Source of drift percentage data +#' @param drift_data Source of drift percentage data. If 'JKI', the [drift_data_JKI] +#' included in the package is used. If 'RF', the Rautmann formula is used, if +#' implemented for the crop type and number of applications #' @param crop Crop name (use German names for JKI data), defaults to "Ackerbau" #' @param distances The distances in m for which to get PEC values #' @param water_depth Depth of the water body in cm @@ -19,15 +21,23 @@ #' @author Johannes Ranke #' @examples #' PEC_sw_drift(100) -PEC_sw_drift <- function(rate, - applications = 1, - water_depth = 30, - drift_percentages = NULL, - drift_data = "JKI", - crop = "Ackerbau", - distances = c(1, 5, 10, 20), - rate_units = "g/ha", - PEC_units = "\u00B5g/L") +#' # Alternatively, we can use the formula for a single application to "Ackerbau" from the paper +#' PEC_sw_drift(100, drift_data = "RF") +#' +#' # This makes it possible to also use different substances +#' PEC_sw_drift(100, distances = c(1, 3, 5, 6, 10, 20, 50, 100), drift_data = "RF") +#' +#' # Using custom drift percentages is also supported +#' PEC_sw_drift(100, drift_percentages = c(2.77, 0.95, 0.57, 0.48, 0.29, 0.15, 0.06, 0.03)) +PEC_sw_drift <- function(rate, + applications = 1, + water_depth = 30, + drift_percentages = NULL, + drift_data = c("JKI", "RF"), + crop = "Ackerbau", + distances = c(1, 5, 10, 20), + rate_units = "g/ha", + PEC_units = "\u00B5g/L") { rate_units <- match.arg(rate_units) PEC_units <- match.arg(PEC_units) @@ -36,8 +46,19 @@ PEC_sw_drift <- function(rate, PEC_sw_overspray <- rate * 1e6 / water_volume # in µg/L dist_index <- as.character(distances) + RF <- list( + "1" = list("Ackerbau" = function(distance) 2.7705 * distance^-0.9787) # p. 134 + ) + if (drift_data == "RF") { + if (is.null(RF[[as.character(applications)]])) stop("Rautmann formula not included for ", applications, " applications") + if (is.null(RF[[as.character(applications)]][[crop]])) stop("Rautmann formula not included for this case") + } + if (is.null(drift_percentages)) { - drift_percentages <- pfm::drift_data_JKI[[applications]][dist_index, crop] + drift_percentages <- switch(drift_data, + JKI = pfm::drift_data_JKI[[applications]][dist_index, crop], + RF = RF[[applications]][[crop]](distances) + ) names(drift_percentages) <- paste(dist_index, "m") } else { names(drift_percentages) <- paste(drift_percentages, "%") |