aboutsummaryrefslogtreecommitdiff
path: root/tests/testthat
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 /tests/testthat
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.
Diffstat (limited to 'tests/testthat')
-rw-r--r--tests/testthat/test_PEC_sw_drift.R23
1 files changed, 19 insertions, 4 deletions
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