aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Ranke <jranke@uni-bremen.de>2020-07-23 12:22:25 +0200
committerJohannes Ranke <jranke@uni-bremen.de>2020-07-23 12:22:25 +0200
commitc97a4f5a9fe30ffc3321681a97eea167cfc427b5 (patch)
tree4b7fde97924879d3556a927c0a2e965fe802e80f
parent90fa42c86596c85168931148bf8d5fa014fa7794 (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.
-rw-r--r--ChangeLog6
-rw-r--r--R/PEC_sw_drift.R43
-rw-r--r--build.log2
-rw-r--r--docs/404.html2
-rw-r--r--docs/authors.html2
-rw-r--r--docs/index.html2
-rw-r--r--docs/pkgdown.yml2
-rw-r--r--docs/reference/PEC_sw_drift.html61
-rw-r--r--docs/reference/drift_data_JKI.html6
-rw-r--r--docs/reference/index.html2
-rw-r--r--man/PEC_sw_drift.Rd14
-rw-r--r--man/drift_data_JKI.Rd2
-rw-r--r--test.log8
-rw-r--r--tests/testthat/test_PEC_sw_drift.R23
14 files changed, 119 insertions, 56 deletions
diff --git a/ChangeLog b/ChangeLog
index 58e9249..6767e33 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+commit 90fa42c86596c85168931148bf8d5fa014fa7794
+Author: Johannes Ranke <jranke@uni-bremen.de>
+Date: 2020-07-23 10:51:39 +0200
+
+ Update docs, use R6 support of roxygen
+
commit df70d80d9ef13b69e58de6f47b9041b6a021025e
Author: Johannes Ranke <jranke@uni-bremen.de>
Date: 2020-07-21 15:50:21 +0200
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, "%")
diff --git a/build.log b/build.log
index 08c031a..5dccfd7 100644
--- a/build.log
+++ b/build.log
@@ -8,5 +8,5 @@ Removed empty directory ‘pfm/inst/testdata/SwashProjects/Project_1’
Removed empty directory ‘pfm/inst/testdata/SwashProjects’
NB: this package now depends on R (>= 3.5.0)
WARNING: Added dependency on R >= 3.5.0 because serialized objects in serialize/load version 3 cannot be read in older versions of R. File(s) containing such objects: ‘pfm/data/EFSA_GW_interception_2014.RData’ WARNING: Added dependency on R >= 3.5.0 because serialized objects in serialize/load version 3 cannot be read in older versions of R. File(s) containing such objects: ‘pfm/data/EFSA_washoff_2017.RData’
-* building ‘pfm_0.5.7.tar.gz’
+* building ‘pfm_0.5.8.tar.gz’
diff --git a/docs/404.html b/docs/404.html
index 37f381e..a98212e 100644
--- a/docs/404.html
+++ b/docs/404.html
@@ -71,7 +71,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="https://pkgdown.jrwb.de/pfm/index.html">pfm</a>
- <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.5.7</span>
+ <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.5.8</span>
</span>
</div>
diff --git a/docs/authors.html b/docs/authors.html
index da75377..d886f2a 100644
--- a/docs/authors.html
+++ b/docs/authors.html
@@ -71,7 +71,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="index.html">pfm</a>
- <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.5.7</span>
+ <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.5.8</span>
</span>
</div>
diff --git a/docs/index.html b/docs/index.html
index 6ffb312..05e6106 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -33,7 +33,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="index.html">pfm</a>
- <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.5.7</span>
+ <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.5.8</span>
</span>
</div>
diff --git a/docs/pkgdown.yml b/docs/pkgdown.yml
index 8b86fe9..cfe1fde 100644
--- a/docs/pkgdown.yml
+++ b/docs/pkgdown.yml
@@ -2,7 +2,7 @@ pandoc: 2.2.1
pkgdown: 1.5.1
pkgdown_sha: ~
articles: []
-last_built: 2020-07-22T15:06Z
+last_built: 2020-07-23T09:34Z
urls:
reference: https://pkgdown.jrwb.de/pfm/reference
article: https://pkgdown.jrwb.de/pfm/articles
diff --git a/docs/reference/PEC_sw_drift.html b/docs/reference/PEC_sw_drift.html
index 302ab0d..e2c325b 100644
--- a/docs/reference/PEC_sw_drift.html
+++ b/docs/reference/PEC_sw_drift.html
@@ -10,23 +10,27 @@
<!-- jquery -->
-<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous"></script>
+<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js" integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script>
<!-- Bootstrap -->
-<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha256-916EbMg70RQy9LHiGkXzG8hSg9EdNy97GazNG/aiY1w=" crossorigin="anonymous" />
+<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.4.1/css/bootstrap.min.css" integrity="sha256-bZLfwXAP04zRMK2BjiO8iu9pf4FbLqX6zitd+tIvLhE=" crossorigin="anonymous" />
-<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha256-U5ZEeKfGNOja007MMD3YBI0A3OSZOQbeG6z2f2Y0hu8=" crossorigin="anonymous"></script>
+<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.4.1/js/bootstrap.min.js" integrity="sha256-nuL8/2cJ5NDSSwnKD8VqreErSWHtnEP9E7AySL+1ev4=" crossorigin="anonymous"></script>
+
+<!-- bootstrap-toc -->
+<link rel="stylesheet" href="../bootstrap-toc.css">
+<script src="../bootstrap-toc.js"></script>
<!-- Font Awesome icons -->
-<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.7.1/css/all.min.css" integrity="sha256-nAmazAk6vS34Xqo0BSrTb+abbtFlgsFK7NKSi6o7Y78=" crossorigin="anonymous" />
-<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.7.1/css/v4-shims.min.css" integrity="sha256-6qHlizsOWFskGlwVOKuns+D1nB6ssZrHQrNj1wGplHc=" crossorigin="anonymous" />
+<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.1/css/all.min.css" integrity="sha256-mmgLkCYLUQbXn0B1SRqzHar6dCnv9oZFPEC1g1cwlkk=" crossorigin="anonymous" />
+<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.1/css/v4-shims.min.css" integrity="sha256-wZjR52fzng1pJHwx4aV2AO3yyTOXrcDW7jBpJtTwVxw=" crossorigin="anonymous" />
<!-- clipboard.js -->
-<script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.4/clipboard.min.js" integrity="sha256-FiZwavyI2V6+EXO1U+xzLG3IKldpiTFf3153ea9zikQ=" crossorigin="anonymous"></script>
+<script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.6/clipboard.min.js" integrity="sha256-inc5kl9MA1hkeYUt+EC3BhlIgyp/2jDIyBLS6k3UxPI=" crossorigin="anonymous"></script>
<!-- headroom.js -->
-<script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.9.4/headroom.min.js" integrity="sha256-DJFC1kqIhelURkuza0AvYal5RxMtpzLjFhsnVIeuk+U=" crossorigin="anonymous"></script>
-<script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.9.4/jQuery.headroom.min.js" integrity="sha256-ZX/yNShbjqsohH1k95liqY9Gd8uOiE1S4vZc+9KQ1K4=" crossorigin="anonymous"></script>
+<script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.11.0/headroom.min.js" integrity="sha256-AsUX4SJE1+yuDu5+mAVzJbuYNPHj/WroHuZ8Ir/CkE0=" crossorigin="anonymous"></script>
+<script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.11.0/jQuery.headroom.min.js" integrity="sha256-ZX/yNShbjqsohH1k95liqY9Gd8uOiE1S4vZc+9KQ1K4=" crossorigin="anonymous"></script>
<!-- pkgdown -->
<link href="../pkgdown.css" rel="stylesheet">
@@ -39,7 +43,6 @@
<meta property="og:description" content="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." />
-<meta name="twitter:card" content="summary" />
@@ -57,7 +60,7 @@ with input via spray drift." />
</head>
- <body>
+ <body data-spy="scroll" data-target="#toc">
<div class="container template-reference-topic">
<header>
<div class="navbar navbar-default navbar-fixed-top" role="navigation">
@@ -71,7 +74,7 @@ with input via spray drift." />
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">pfm</a>
- <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.5.7</span>
+ <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.5.8</span>
</span>
</div>
@@ -118,7 +121,7 @@ with input via spray drift.</p>
<span class='kw'>applications</span> <span class='kw'>=</span> <span class='fl'>1</span>,
<span class='kw'>water_depth</span> <span class='kw'>=</span> <span class='fl'>30</span>,
<span class='kw'>drift_percentages</span> <span class='kw'>=</span> <span class='kw'>NULL</span>,
- <span class='kw'>drift_data</span> <span class='kw'>=</span> <span class='st'>"JKI"</span>,
+ <span class='kw'>drift_data</span> <span class='kw'>=</span> <span class='fu'><a href='https://rdrr.io/r/base/c.html'>c</a></span>(<span class='st'>"JKI"</span>, <span class='st'>"RF"</span>),
<span class='kw'>crop</span> <span class='kw'>=</span> <span class='st'>"Ackerbau"</span>,
<span class='kw'>distances</span> <span class='kw'>=</span> <span class='fu'><a href='https://rdrr.io/r/base/c.html'>c</a></span>(<span class='fl'>1</span>, <span class='fl'>5</span>, <span class='fl'>10</span>, <span class='fl'>20</span>),
<span class='kw'>rate_units</span> <span class='kw'>=</span> <span class='st'>"g/ha"</span>,
@@ -147,7 +150,9 @@ with input via spray drift.</p>
</tr>
<tr>
<th>drift_data</th>
- <td><p>Source of drift percentage data</p></td>
+ <td><p>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</p></td>
</tr>
<tr>
<th>crop</th>
@@ -173,18 +178,24 @@ with input via spray drift.</p>
<h2 class="hasAnchor" id="examples"><a class="anchor" href="#examples"></a>Examples</h2>
<pre class="examples"><div class='input'><span class='fu'>PEC_sw_drift</span>(<span class='fl'>100</span>)</div><div class='output co'>#&gt; 1 m 5 m 10 m 20 m
-#&gt; 0.92333333 0.19000000 0.09666667 0.05000000 </div></pre>
+#&gt; 0.92333333 0.19000000 0.09666667 0.05000000 </div><div class='input'><span class='co'># Alternatively, we can use the formula for a single application to "Ackerbau" from the paper</span>
+<span class='fu'>PEC_sw_drift</span>(<span class='fl'>100</span>, <span class='kw'>drift_data</span> <span class='kw'>=</span> <span class='st'>"RF"</span>)</div><div class='output co'>#&gt; 1 m 5 m 10 m 20 m
+#&gt; 0.92350000 0.19114149 0.09699222 0.04921742 </div><div class='input'>
+<span class='co'># This makes it possible to also use different substances</span>
+<span class='fu'>PEC_sw_drift</span>(<span class='fl'>100</span>, <span class='kw'>distances</span> <span class='kw'>=</span> <span class='fu'><a href='https://rdrr.io/r/base/c.html'>c</a></span>(<span class='fl'>1</span>, <span class='fl'>3</span>, <span class='fl'>5</span>, <span class='fl'>6</span>, <span class='fl'>10</span>, <span class='fl'>20</span>, <span class='fl'>50</span>, <span class='fl'>100</span>), <span class='kw'>drift_data</span> <span class='kw'>=</span> <span class='st'>"RF"</span>)</div><div class='output co'>#&gt; 1 m 3 m 5 m 6 m 10 m 20 m 50 m
+#&gt; 0.92350000 0.31512171 0.19114149 0.15990435 0.09699222 0.04921742 0.02007497
+#&gt; 100 m
+#&gt; 0.01018678 </div><div class='input'>
+<span class='co'># Using custom drift percentages is also supported</span>
+<span class='fu'>PEC_sw_drift</span>(<span class='fl'>100</span>, <span class='kw'>drift_percentages</span> <span class='kw'>=</span> <span class='fu'><a href='https://rdrr.io/r/base/c.html'>c</a></span>(<span class='fl'>2.77</span>, <span class='fl'>0.95</span>, <span class='fl'>0.57</span>, <span class='fl'>0.48</span>, <span class='fl'>0.29</span>, <span class='fl'>0.15</span>, <span class='fl'>0.06</span>, <span class='fl'>0.03</span>))</div><div class='output co'>#&gt; 2.77 % 0.95 % 0.57 % 0.48 % 0.29 % 0.15 % 0.06 %
+#&gt; 0.92333333 0.31666667 0.19000000 0.16000000 0.09666667 0.05000000 0.02000000
+#&gt; 0.03 %
+#&gt; 0.01000000 </div></pre>
</div>
- <div class="col-md-3 hidden-xs hidden-sm" id="sidebar">
- <h2>Contents</h2>
- <ul class="nav nav-pills nav-stacked">
- <li><a href="#arguments">Arguments</a></li>
- <li><a href="#value">Value</a></li>
- <li><a href="#examples">Examples</a></li>
- </ul>
-
- <h2>Author</h2>
- <p>Johannes Ranke</p>
+ <div class="col-md-3 hidden-xs hidden-sm" id="pkgdown-sidebar">
+ <nav id="toc" data-toggle="toc" class="sticky-top">
+ <h2 data-toc-skip>Contents</h2>
+ </nav>
</div>
</div>
@@ -195,7 +206,7 @@ with input via spray drift.</p>
</div>
<div class="pkgdown">
- <p>Site built with <a href="https://pkgdown.r-lib.org/">pkgdown</a> 1.4.1.</p>
+ <p>Site built with <a href="https://pkgdown.r-lib.org/">pkgdown</a> 1.5.1.</p>
</div>
</footer>
diff --git a/docs/reference/drift_data_JKI.html b/docs/reference/drift_data_JKI.html
index dd78451..36472d1 100644
--- a/docs/reference/drift_data_JKI.html
+++ b/docs/reference/drift_data_JKI.html
@@ -75,7 +75,7 @@ published by the German Julius-Kühn Institute (JKI)." />
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">pfm</a>
- <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.5.7</span>
+ <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.5.8</span>
</span>
</div>
@@ -162,7 +162,7 @@ included.</p>
<span class='no'>drift_data_JKI</span> <span class='kw'>&lt;-</span> <span class='fu'><a href='https://rdrr.io/r/base/list.html'>list</a></span>()
<span class='kw'>for</span> (<span class='no'>n</span> <span class='kw'>in</span> <span class='fl'>1</span>:<span class='fl'>8</span>) {
- <span class='no'>drift_data_raw</span> <span class='kw'>&lt;-</span> <span class='fu'><a href='https://readxl.tidyverse.org/reference/read_excel.html'>read_excel</a></span>(<span class='no'>abdrift_path</span>, <span class='kw'>sheet</span> <span class='kw'>=</span> <span class='no'>n</span> + <span class='fl'>1</span>, <span class='kw'>skip</span> <span class='kw'>=</span> <span class='fl'>2</span>)
+ <span class='no'>drift_data_raw</span> <span class='kw'>&lt;-</span> <span class='fu'><a href='https://rdrr.io/pkg/readxl/man/read_excel.html'>read_excel</a></span>(<span class='no'>abdrift_path</span>, <span class='kw'>sheet</span> <span class='kw'>=</span> <span class='no'>n</span> + <span class='fl'>1</span>, <span class='kw'>skip</span> <span class='kw'>=</span> <span class='fl'>2</span>)
<span class='no'>drift_data</span> <span class='kw'>&lt;-</span> <span class='fu'><a href='https://rdrr.io/r/base/matrix.html'>matrix</a></span>(<span class='fl'>NA</span>, <span class='kw'>nrow</span> <span class='kw'>=</span> <span class='fl'>9</span>, <span class='kw'>ncol</span> <span class='kw'>=</span> <span class='fu'><a href='https://rdrr.io/r/base/length.html'>length</a></span>(<span class='no'>JKI_crops</span>))
<span class='fu'><a href='https://rdrr.io/r/base/dimnames.html'>dimnames</a></span>(<span class='no'>drift_data</span>) <span class='kw'>&lt;-</span> <span class='fu'><a href='https://rdrr.io/r/base/list.html'>list</a></span>(<span class='kw'>distance</span> <span class='kw'>=</span> <span class='no'>drift_data_raw</span><span class='kw'>[[</span><span class='fl'>1</span>]][<span class='fl'>1</span>:<span class='fl'>9</span>],
<span class='kw'>crop</span> <span class='kw'>=</span> <span class='no'>JKI_crops</span>)
@@ -196,7 +196,7 @@ included.</p>
<span class='fu'><a href='https://rdrr.io/r/base/save.html'>save</a></span>(<span class='no'>drift_data_JKI</span>, <span class='kw'>file</span> <span class='kw'>=</span> <span class='st'>"data/drift_data_JKI.RData"</span>)
}
-<span class='co'># And this is the resulting data</span>
+<span class='co'># And these are the resulting data</span>
<span class='no'>drift_data_JKI</span></div><div class='output co'>#&gt; [[1]]
#&gt; crop
#&gt; distance Ackerbau Obstbau frueh Obstbau spaet Weinbau frueh Weinbau spaet
diff --git a/docs/reference/index.html b/docs/reference/index.html
index 186390e..9473a2d 100644
--- a/docs/reference/index.html
+++ b/docs/reference/index.html
@@ -71,7 +71,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">pfm</a>
- <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.5.7</span>
+ <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.5.8</span>
</span>
</div>
diff --git a/man/PEC_sw_drift.Rd b/man/PEC_sw_drift.Rd
index cde3c78..92e0f77 100644
--- a/man/PEC_sw_drift.Rd
+++ b/man/PEC_sw_drift.Rd
@@ -9,7 +9,7 @@ PEC_sw_drift(
applications = 1,
water_depth = 30,
drift_percentages = NULL,
- drift_data = "JKI",
+ drift_data = c("JKI", "RF"),
crop = "Ackerbau",
distances = c(1, 5, 10, 20),
rate_units = "g/ha",
@@ -26,7 +26,9 @@ PEC_sw_drift(
\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{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}
\item{crop}{Crop name (use German names for JKI data), defaults to "Ackerbau"}
@@ -46,6 +48,14 @@ with input via spray drift.
}
\examples{
PEC_sw_drift(100)
+# 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))
}
\author{
Johannes Ranke
diff --git a/man/drift_data_JKI.Rd b/man/drift_data_JKI.Rd
index 181eca6..bde9aad 100644
--- a/man/drift_data_JKI.Rd
+++ b/man/drift_data_JKI.Rd
@@ -89,7 +89,7 @@ included.
save(drift_data_JKI, file = "data/drift_data_JKI.RData")
}
-# And this is the resulting data
+# And these are the resulting data
drift_data_JKI
}
\keyword{datasets}
diff --git a/test.log b/test.log
index ac21026..07617f9 100644
--- a/test.log
+++ b/test.log
@@ -5,9 +5,9 @@ Testing pfm
✔ | OK F W S | Context
✔ | 1 | Simple PEC sediment calculations
✔ | 17 | Simple PEC soil calculations [0.2 s]
-✔ | 2 | Simple PEC surface water calculations with drift entry
+✔ | 6 | Simple PEC surface water calculations with drift entry
✔ | 1 | Actual and time weighted average concentrations for SFO kinetics
-✔ | 7 | Read and analyse TOXSWA cwa files [6.6 s]
+✔ | 7 | Read and analyse TOXSWA cwa files [6.0 s]
✔ | 12 | UK drainage PEC calculations
✔ | 7 | Exposit calculations
✔ | 6 | Geometric mean calculation
@@ -17,9 +17,9 @@ Testing pfm
✔ | 8 | FOCUS Steps 12 input files
══ Results ═════════════════════════════════════════════════════════════════════════════════════════
-Duration: 8.2 s
+Duration: 7.5 s
-OK: 82
+OK: 86
Failed: 0
Warnings: 0
Skipped: 0
diff --git a/tests/testthat/test_PEC_sw_drift.R b/tests/testthat/test_PEC_sw_drift.R
index d09d578..667b402 100644
--- a/tests/testthat/test_PEC_sw_drift.R
+++ b/tests/testthat/test_PEC_sw_drift.R
@@ -3,13 +3,28 @@ context("Simple PEC surface water calculations with drift entry")
test_that("PEC_sw_drift gives the same results as the CRD PEC calculator", {
# One application of 30 g/ha to field crops calculated with UK PEC calculator published by CRD
- expect_equal(round(PEC_sw_drift(30), 3),
+ expect_equal(round(PEC_sw_drift(30), 3),
c('1 m' = 0.277, '5 m' = 0.057, '10 m' = 0.029, '20 m' = 0.015))
# 7 applications of 30 g/ha to field crops calculated with UK PEC calculator, initial PEC
- expect_equal(round(PEC_sw_drift(30, 7), 3),
+ expect_equal(round(PEC_sw_drift(30, 7), 3),
c('1 m' = 0.161, '5 m' = 0.033, '10 m' = 0.017, '20 m' = 0.008))
- # 4 applications of 30 g/ha to late fruit crops calculated with UK PEC calculator published by CRD (uses different drift values from SANCO aquatic guidance)
- #expect_equal(round(PEC_sw_drift(30, 4, crop = "Obstbau spät", distances = c(3, 20, 50)), 3), c('3 m' = 1.101, '20 m' = 0.080, '50 m' = 0.013))
+ # 4 applications of 30 g/ha to late fruit crops calculated with UK PEC
+ # calculator published by CRD. CRD uses different drift values from SANCO aquatic
+ # guidance), except for 50 m
+ pfm_30_4_obst_spaet <- round(PEC_sw_drift(30, 4, crop = "Obstbau spaet",
+ distances = c(3, 20, 50)), 3)
+ crd_30_4_obst_spaet <- c('3 m' = 1.101, '20 m' = 0.080, '50 m' = 0.013)
+ expect_equal(pfm_30_4_obst_spaet[3], crd_30_4_obst_spaet[3])
+})
+
+test_that("The Rautmann formula is correctly implemented", {
+ pfm_jki <- PEC_sw_drift(100)
+ pfm_rf <- PEC_sw_drift(100, drift_data = "RF")
+ expect_equal(pfm_jki, pfm_rf, tolerance = 0.01)
+
+ expect_error(PEC_sw_drift(100, drift_data = "RF", applications = 2), "Rautmann formula not included")
+ expect_error(PEC_sw_drift(100, drift_data = "RF", applications = 1, crop = "Obstbau spaet"),
+ "Rautmann formula not included")
})

Contact - Imprint