From cb3695dd434b3a3273217fb22c5ffb86065ae96d Mon Sep 17 00:00:00 2001 From: Johannes Ranke Date: Tue, 10 Jul 2018 17:57:33 +0200 Subject: EFSA PEC soil guidance from 2017 - Implement the new guidance as well as possible - Maintenance work addressing CRAN checks --- tests/testthat/test_PEC_soil.R | 68 +++++++++++++++++++++++++++++++----------- 1 file changed, 51 insertions(+), 17 deletions(-) (limited to 'tests/testthat/test_PEC_soil.R') diff --git a/tests/testthat/test_PEC_soil.R b/tests/testthat/test_PEC_soil.R index 0661a52..34b4749 100644 --- a/tests/testthat/test_PEC_soil.R +++ b/tests/testthat/test_PEC_soil.R @@ -1,4 +1,5 @@ library(pfm) +library(testthat) context("Simple PEC soil calculations") test_that("PEC_soil calculates correctly", { @@ -6,40 +7,73 @@ test_that("PEC_soil calculates correctly", { expect_equal(as.numeric(PEC_soil(100)), 0.1 * 4/3) # or 0.1 mg/kg assuming 25% interception - expect_equal(as.numeric(PEC_soil(100, interception = 0.25)), 0.1) + expect_equal(as.numeric(PEC_soil(100, interception = 0.25)), 0.1) # Mixing depth of 1 cm gives five-fold PEC expect_equal(as.numeric(PEC_soil(100, interception = 0.25, mixing_depth = 1)), 0.5) }) -test_that("Tier 1 PEC soil example for Pesticide A in EFSA guidance can be reproduced", { +test_that("Tier 1 PEC soil example for Pesticide A in EFSA guidance from 2017 can be reproduced", { # Calculate total soil concentrations for tier 1 scenarios - results_pfm <- PEC_soil(1000, interval = 365, DT50 = 250, t_avg = c(0, 21), - scenarios = "EFSA_2015") + # Leaching is calculated from the 5 cm layer to be able to reproduce the + # results from the guidance + results_pfm_2017 <- PEC_soil(1000, interval = 365, DT50 = 250, t_avg = c(0, 21), + scenarios = "EFSA_2017", Kom = 1000, + leaching_depth = 5) + + # From Table G.2, p. 92 + results_guidance_2017 <- matrix(c(18.6, 13.0, 9.9, 18.2, 12.7, 9.6), + ncol = 3, byrow = TRUE) + dimnames(results_guidance_2017) <- list(t_avg = c(0, 21), + scenario = c("CTN", "CTC", "CTS")) + + + expect_equal(round(results_pfm_2017, 1)[1, ], results_guidance_2017[1, ]) + # I do not get the same TWA concentrations as in the 2017 guidance on p. 92 + + # Calculate porewater soil concentrations for tier 1 scenarios + results_pfm_pw_2017 <- PEC_soil(1000, interval = 365, DT50 = 250, t_av = c(0, 21), + Kom = 1000, scenarios = "EFSA_2017", porewater = TRUE, + leaching_depth = 5) # From Table I.5, p. 80 - results_guidance <- matrix(c(22.0, 11.5, 9.1, 21.8, 11.4, 9.0), - ncol = 3, byrow = TRUE) - dimnames(results_guidance) <- list(t_avg = c(0, 21), - scenario = c("CTN", "CTC", "CTS")) + results_guidance_pw_2017 <- matrix(c(0.48, 0.60, 0.91, 0.47, 0.58, 0.86), + ncol = 3, byrow = TRUE) + dimnames(results_guidance_pw_2017) <- list(t_avg = c(0, 21), + scenario = c("CLN", "CLC", "CLS")) + expect_equal(round(results_pfm_pw_2017, 2)[1, ], results_guidance_pw_2017[1, ]) + # Here I also do not get the same TWA concentrations as in the guidance p. 92 +}) + +test_that("Tier 1 PEC soil example for Pesticide A in EFSA guidance from 2015 can be reproduced", { + # Calculate total soil concentrations for tier 1 scenarios + results_pfm_2015 <- PEC_soil(1000, interval = 365, DT50 = 250, t_avg = c(0, 21), + scenarios = "EFSA_2015") + + # From Table I.5, p. 80 + results_guidance_2015 <- matrix(c(22.0, 11.5, 9.1, 21.8, 11.4, 9.0), + ncol = 3, byrow = TRUE) + dimnames(results_guidance_2015) <- list(t_avg = c(0, 21), + scenario = c("CTN", "CTC", "CTS")) - expect_equal(round(results_pfm, 1), results_guidance) + + expect_equal(round(results_pfm_2015, 1), results_guidance_2015) # Calculate porewater soil concentrations for tier 1 scenarios - results_pfm_pw <- PEC_soil(1000, interval = 365, DT50 = 250, t_av = c(0, 21), - Kom = 1000, scenarios = "EFSA_2015", porewater = TRUE) + results_pfm_pw_2015 <- PEC_soil(1000, interval = 365, DT50 = 250, t_av = c(0, 21), + Kom = 1000, scenarios = "EFSA_2015", porewater = TRUE) # From Table I.5, p. 80 - results_guidance_pw <- matrix(c(0.76, 0.67, 0.91, 0.75, 0.66, 0.90), - ncol = 3, byrow = TRUE) - dimnames(results_guidance_pw) <- list(t_avg = c(0, 21), - scenario = c("CLN", "CLC", "CLS")) + results_guidance_pw_2015 <- matrix(c(0.76, 0.67, 0.91, 0.75, 0.66, 0.90), + ncol = 3, byrow = TRUE) + dimnames(results_guidance_pw_2015) <- list(t_avg = c(0, 21), + scenario = c("CLN", "CLC", "CLS")) - expect_equal(round(results_pfm_pw, 2), results_guidance_pw) + expect_equal(round(results_pfm_pw_2015, 2), results_guidance_pw_2015) }) -test_that("Tier 1 PEC soil example for Pesticide F in EFSA guidance can be reproduced", { +test_that("Tier 1 PEC soil example for Pesticide F in EFSA guidance from 2015 can be reproduced", { # Parent F # Calculate total and porewater soil concentrations for tier 1 scenarios results_pfm <- PEC_soil(1000, interval = 365, DT50 = 25, t_avg = c(0, 21), -- cgit v1.2.1