aboutsummaryrefslogtreecommitdiff
path: root/pkg
diff options
context:
space:
mode:
Diffstat (limited to 'pkg')
-rw-r--r--pkg/NAMESPACE1
-rw-r--r--pkg/R/PEC_sw_drift.R14
-rw-r--r--pkg/R/PEC_sw_drift_NL.R49
-rw-r--r--pkg/man/PEC_sw_drift.Rd9
-rw-r--r--pkg/man/PEC_sw_drift_NL.Rd37
5 files changed, 56 insertions, 54 deletions
diff --git a/pkg/NAMESPACE b/pkg/NAMESPACE
index c59559b..fe73f6c 100644
--- a/pkg/NAMESPACE
+++ b/pkg/NAMESPACE
@@ -8,6 +8,7 @@ export(GUS)
export(PEC_soil)
export(PEC_sw_drainage_UK)
export(PEC_sw_drift)
+export(PEC_sw_drift_NL)
export(PEC_sw_sed)
export(SFO_actual_twa)
export(SSLRC_mobility_classification)
diff --git a/pkg/R/PEC_sw_drift.R b/pkg/R/PEC_sw_drift.R
index ce57f79..261706c 100644
--- a/pkg/R/PEC_sw_drift.R
+++ b/pkg/R/PEC_sw_drift.R
@@ -23,6 +23,8 @@
#'
#' @param rate Application rate in units specified below
#' @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 crop Crop name (use German names for JKI data), defaults to "Ackerbau"
#' @param distances The distances in m for which to get PEC values
@@ -37,6 +39,7 @@
PEC_sw_drift <- function(rate,
applications = 1,
water_depth = 30,
+ drift_percentages = NULL,
drift_data = "JKI",
crop = "Ackerbau",
distances = c(1, 5, 10, 20),
@@ -49,7 +52,14 @@ PEC_sw_drift <- function(rate,
water_volume <- 100 * 100 * (water_depth/100) * 1000 # in L (for 1 ha)
PEC_sw_overspray <- rate * 1e6 / water_volume # in µg/L
dist_index <- as.character(distances)
- PEC_sw_drift <- PEC_sw_overspray * pfm::drift_data_JKI[[applications]][dist_index, crop] / 100
- names(PEC_sw_drift) <- paste(dist_index, "m")
+
+ if (is.null(drift_percentages)) {
+ drift_percentages <- pfm::drift_data_JKI[[applications]][dist_index, crop]
+ names(drift_percentages) <- paste(dist_index, "m")
+ } else {
+ names(drift_percentages) <- paste(drift_percentages, "%")
+ }
+
+ PEC_sw_drift <- PEC_sw_overspray * drift_percentages / 100
return(PEC_sw_drift)
}
diff --git a/pkg/R/PEC_sw_drift_NL.R b/pkg/R/PEC_sw_drift_NL.R
deleted file mode 100644
index cc92185..0000000
--- a/pkg/R/PEC_sw_drift_NL.R
+++ /dev/null
@@ -1,49 +0,0 @@
-# Copyright (C) 2016 Johannes Ranke
-# Contact: jranke@uni-bremen.de
-# This file is part of the R package pfm
-
-# This program is free software: you can redistribute it and/or modify it under
-# the terms of the GNU General Public License as published by the Free Software
-# Foundation, either version 3 of the License, or (at your option) any later
-# version.
-
-# This program is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
-# details.
-
-# You should have received a copy of the GNU General Public License along with
-# this program. If not, see <http://www.gnu.org/licenses/>
-
-#' Calculate predicted environmental concentrations in surface water due to drift
-#'
-#' This is a basic, vectorised form of a simple calculation of a contaminant
-#' concentration in surface water based on complete, instantaneous mixing
-#' with input via spray drift.
-#'
-#' @param rate Application rate in units specified below
-#' @param applications Number of applications for selection of drift percentile
-#' @param drift_percentages Percentage drift values for which to calculate PECsw
-#' @param water_depth Depth of the water body in cm
-#' @param rate_units Defaults to g/ha
-#' @param PEC_units Requested units for the calculated PEC. Only µg/L currently supported
-#' @return The predicted concentration in surface water
-#' @export
-#' @author Johannes Ranke
-#' @examples
-#' PEC_sw_drift_NL(100)
-PEC_sw_drift_NL <- function(rate,
- applications = 1,
- water_depth = 30,
- drift_percentages = c(1),
- rate_units = "g/ha",
- PEC_units = "\u00B5g/L")
-{
- rate_units <- match.arg(rate_units)
- PEC_units <- match.arg(PEC_units)
- water_volume <- 100 * 100 * (water_depth/100) * 1000 # in L (for 1 ha)
- PEC_sw_overspray <- rate * 1e6 / water_volume # in µg/L
- PEC_sw_drift <- PEC_sw_overspray * drift_percentages / 100
- names(PEC_sw_drift) <- paste(drift_percentages, "%")
- return(PEC_sw_drift)
-}
diff --git a/pkg/man/PEC_sw_drift.Rd b/pkg/man/PEC_sw_drift.Rd
index c486831..20fa921 100644
--- a/pkg/man/PEC_sw_drift.Rd
+++ b/pkg/man/PEC_sw_drift.Rd
@@ -4,9 +4,9 @@
\alias{PEC_sw_drift}
\title{Calculate predicted environmental concentrations in surface water due to drift}
\usage{
-PEC_sw_drift(rate, applications = 1, water_depth = 30, drift_data = "JKI",
- crop = "Ackerbau", distances = c(1, 5, 10, 20), rate_units = "g/ha",
- PEC_units = "µg/L")
+PEC_sw_drift(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 = "µg/L")
}
\arguments{
\item{rate}{Application rate in units specified below}
@@ -15,6 +15,9 @@ PEC_sw_drift(rate, applications = 1, water_depth = 30, drift_data = "JKI",
\item{water_depth}{Depth of the water body in cm}
+\item{drift_percentages}{Percentage drift values for which to calculate PECsw.
+'drift_data' and 'distances' if not NULL.}
+
\item{drift_data}{Source of drift percentage data}
\item{crop}{Crop name (use German names for JKI data), defaults to "Ackerbau"}
diff --git a/pkg/man/PEC_sw_drift_NL.Rd b/pkg/man/PEC_sw_drift_NL.Rd
new file mode 100644
index 0000000..404123a
--- /dev/null
+++ b/pkg/man/PEC_sw_drift_NL.Rd
@@ -0,0 +1,37 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/PEC_sw_drift_NL.R
+\name{PEC_sw_drift_NL}
+\alias{PEC_sw_drift_NL}
+\title{Calculate predicted environmental concentrations in surface water due to drift}
+\usage{
+PEC_sw_drift_NL(rate, applications = 1, water_depth = 30,
+ drift_percentages = c(1), rate_units = "g/ha", PEC_units = "µg/L")
+}
+\arguments{
+\item{rate}{Application rate in units specified below}
+
+\item{applications}{Number of applications for selection of drift percentile}
+
+\item{water_depth}{Depth of the water body in cm}
+
+\item{drift_percentages}{Percentage drift values for which to calculate PECsw}
+
+\item{rate_units}{Defaults to g/ha}
+
+\item{PEC_units}{Requested units for the calculated PEC. Only µg/L currently supported}
+}
+\value{
+The predicted concentration in surface water
+}
+\description{
+This is a basic, vectorised form of a simple calculation of a contaminant
+concentration in surface water based on complete, instantaneous mixing
+with input via spray drift.
+}
+\examples{
+PEC_sw_drift_NL(100)
+}
+\author{
+Johannes Ranke
+}
+

Contact - Imprint