From 8452daa2015aa645dcc1eca3ec2bba5726603e4e Mon Sep 17 00:00:00 2001 From: Johannes Ranke Date: Sat, 22 Sep 2018 09:54:59 +0200 Subject: Add test and update docs --- ChangeLog | 6 + DESCRIPTION | 2 +- NAMESPACE | 1 + R/PEC_soil.R | 6 +- docs/authors.html | 2 +- docs/index.html | 36 ++--- docs/pkgdown.yml | 2 +- docs/reference/FOCUS_GW_scenarios_2012.html | 2 +- docs/reference/FOCUS_PELMO_crop_sze_names.html | 2 +- docs/reference/FOCUS_PELMO_crops.html | 2 +- docs/reference/FOCUS_PELMO_location_codes.html | 2 +- docs/reference/FOCUS_Step_12_scenarios.html | 2 +- docs/reference/FOMC_actual_twa.html | 2 +- docs/reference/GUS.html | 2 +- docs/reference/PEC_FOMC_accu_rel.html | 163 ++++++++++++++++++++++ docs/reference/PEC_soil.html | 24 ++-- docs/reference/PEC_sw_drainage_UK.html | 2 +- docs/reference/PEC_sw_drift.html | 2 +- docs/reference/PEC_sw_exposit_runoff.html | 2 +- docs/reference/PEC_sw_focus.html | 2 +- docs/reference/PEC_sw_sed.html | 2 +- docs/reference/PELMO_path.html | 2 +- docs/reference/PELMO_runs.html | 4 +- docs/reference/SFO_actual_twa.html | 2 +- docs/reference/SSLRC_mobility_classification.html | 2 +- docs/reference/TOXSWA_cwa.html | 2 +- docs/reference/chent_focus_sw.html | 2 +- docs/reference/create_run_list.html | 2 +- docs/reference/drift_data_JKI.html | 2 +- docs/reference/endpoint.html | 2 +- docs/reference/focus_80th.html | 2 +- docs/reference/geomean.html | 2 +- docs/reference/get_flux.html | 2 +- docs/reference/get_interval.html | 2 +- docs/reference/get_vertex.html | 141 +++++++++++++++++++ docs/reference/index.html | 2 +- docs/reference/max_twa.html | 2 +- docs/reference/one_box.html | 2 +- docs/reference/perc_runoff_exposit.html | 2 +- docs/reference/perc_runoff_reduction_exposit.html | 2 +- docs/reference/pesticide.txt | 2 + docs/reference/pfm_degradation.html | 2 +- docs/reference/plot.TOXSWA_cwa.html | 2 +- docs/reference/plot.one_box.html | 2 +- docs/reference/read.TOXSWA_cwa.html | 2 +- docs/reference/sawtooth.html | 2 +- docs/reference/soil_scenario_data_EFSA_2015.html | 2 +- docs/reference/soil_scenario_data_EFSA_2017.html | 2 +- docs/reference/sum_periods.html | 2 +- docs/reference/twa.html | 2 +- man/PEC_FOMC_accu_rel.Rd | 21 +++ man/PEC_soil.Rd | 6 +- man/get_vertex.Rd | 12 ++ tests/testthat/test_PEC_soil.R | 20 +++ 54 files changed, 449 insertions(+), 75 deletions(-) create mode 100644 docs/reference/PEC_FOMC_accu_rel.html create mode 100644 docs/reference/get_vertex.html create mode 100644 man/PEC_FOMC_accu_rel.Rd create mode 100644 man/get_vertex.Rd diff --git a/ChangeLog b/ChangeLog index 69d5e6b..37e9c30 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +commit ff7e67a4d3415419dd3f712ef1af7467ebf65508 +Author: Johannes Ranke +Date: 2018-09-21 19:39:44 +0200 + + Support FOMC in PEC_soil + commit 03c3035ca01c66b6a1352f7e509753fe2d057af2 Author: Johannes Ranke Date: 2018-07-11 03:41:43 +0200 diff --git a/DESCRIPTION b/DESCRIPTION index 932a4c8..e526ff0 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -2,7 +2,7 @@ Package: pfm Type: Package Title: Utilities for Pesticide Fate Modelling Version: 0.5.2 -Date: 2018-09-20 +Date: 2018-09-22 Authors@R: person("Johannes Ranke", email = "jranke@uni-bremen.de", role = c("aut", "cre", "cph"), comment = c(ORCID = "0000-0003-4371-6538")) diff --git a/NAMESPACE b/NAMESPACE index 229ea70..02f2e73 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -17,6 +17,7 @@ export(FOCUS_PELMO_crops) export(FOCUS_PELMO_location_codes) export(FOMC_actual_twa) export(GUS) +export(PEC_FOMC_accu_rel) export(PEC_soil) export(PEC_sw_drainage_UK) export(PEC_sw_drift) diff --git a/R/PEC_soil.R b/R/PEC_soil.R index 513136e..091149c 100644 --- a/R/PEC_soil.R +++ b/R/PEC_soil.R @@ -302,7 +302,7 @@ PEC_soil <- function(rate, rate_units = "g/ha", interception = 0, f_accu = get_vertex(x = 8:10, y = PEC_FOMC_accu_rel(n = 10, interval, FOMC)[8:10])$yv warning("The long term calculation is based on a pseudo-plateau constructed\n ", "by fitting a parabola through the residues after 8, 9 and 10 years.\n ", - "This is the method used by the ESCAPE software tool.\n ", + "This is the method used by the ESCAPE software tool for separate consideration of residues.\n ", "Please check the validity by specifying e.g. n_periods = 20 or 50.") } else { f_accu = X/(1 - X) # part of (A2) @@ -367,7 +367,7 @@ PEC_soil <- function(rate, rate_units = "g/ha", interception = 0, PEC_FOMC_accu_rel <- function(n, interval, FOMC) { PEC_accu_rel <- 0 for (i in 1:(n - 1)) { - PEC_accu_rel[i + 1] <- PEC_accu_rel[i] + mkin::FOMC.solution(i * interval, 1, + PEC_accu_rel[i + 1] <- PEC_accu_rel[i] + mkin::FOMC.solution(i * interval, 1, FOMC[["alpha"]], FOMC[["beta"]]) } return(PEC_accu_rel) @@ -376,7 +376,7 @@ PEC_FOMC_accu_rel <- function(n, interval, FOMC) { #' Fit a parabola through three points #' #' This was inspired by an answer on stackoverflow -#' https://stackoverflow.com/a/717791 +#' https://stackoverflow.com/a/717791 get_vertex <- function(x, y) { m <- cbind(x^2, x, 1) m_inv <- solve(m) diff --git a/docs/authors.html b/docs/authors.html index e128b4d..718d419 100644 --- a/docs/authors.html +++ b/docs/authors.html @@ -58,7 +58,7 @@ pfm - 0.5.1 + 0.5.2 diff --git a/docs/index.html b/docs/index.html index 70a1fed..a6429d3 100644 --- a/docs/index.html +++ b/docs/index.html @@ -31,7 +31,7 @@ pfm - 0.5.1 + 0.5.2 @@ -69,28 +69,28 @@

The R package pfm provides some utilities for fate modelling, including dealing with FOCUS pesticide fate modelling tools, (currently only TOXSWA cwa and out files), made available under the GNU public license. This means:

-
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/>
+

Installation

The easiest way to install the package is probably to use drat:

-
install.packages("drat")
-drat::addRepo("jranke")
-install.packages("pfm")
+

Alternatively you can install the package using the devtools package. Using quick = TRUE skips docs, multiple-architecture builds, demos, and vignettes.

-
library(devtools)
-install_github("jranke/pfm", quick = TRUE)
+
library(devtools)
+install_github("jranke/pfm", quick = TRUE)

diff --git a/docs/pkgdown.yml b/docs/pkgdown.yml index 6e67788..7908647 100644 --- a/docs/pkgdown.yml +++ b/docs/pkgdown.yml @@ -1,4 +1,4 @@ -pandoc: 1.19.2.4 +pandoc: 2.2.1 pkgdown: 1.1.0 pkgdown_sha: ~ articles: [] diff --git a/docs/reference/FOCUS_GW_scenarios_2012.html b/docs/reference/FOCUS_GW_scenarios_2012.html index af6d243..65a6df2 100644 --- a/docs/reference/FOCUS_GW_scenarios_2012.html +++ b/docs/reference/FOCUS_GW_scenarios_2012.html @@ -62,7 +62,7 @@ soil definitions are from page 46ff. from FOCUS (2012)." /> pfm - 0.5.1 + 0.5.2

diff --git a/docs/reference/FOCUS_PELMO_crop_sze_names.html b/docs/reference/FOCUS_PELMO_crop_sze_names.html index 4eed679..4612df6 100644 --- a/docs/reference/FOCUS_PELMO_crop_sze_names.html +++ b/docs/reference/FOCUS_PELMO_crop_sze_names.html @@ -64,7 +64,7 @@ files used for Beans (field) and Beans (vegetable) are the same." /> pfm - 0.5.1 + 0.5.2 diff --git a/docs/reference/FOCUS_PELMO_crops.html b/docs/reference/FOCUS_PELMO_crops.html index e4928cd..77b5c01 100644 --- a/docs/reference/FOCUS_PELMO_crops.html +++ b/docs/reference/FOCUS_PELMO_crops.html @@ -65,7 +65,7 @@ in the three letter code, i.e. 'Peas (animals)' has the code ape." /> pfm - 0.5.1 + 0.5.2 diff --git a/docs/reference/FOCUS_PELMO_location_codes.html b/docs/reference/FOCUS_PELMO_location_codes.html index 8177747..c06c729 100644 --- a/docs/reference/FOCUS_PELMO_location_codes.html +++ b/docs/reference/FOCUS_PELMO_location_codes.html @@ -62,7 +62,7 @@ indexed by three letter acronyms." /> pfm - 0.5.1 + 0.5.2 diff --git a/docs/reference/FOCUS_Step_12_scenarios.html b/docs/reference/FOCUS_Step_12_scenarios.html index b9f2e0d..3b92377 100644 --- a/docs/reference/FOCUS_Step_12_scenarios.html +++ b/docs/reference/FOCUS_Step_12_scenarios.html @@ -62,7 +62,7 @@ The text file is not included in the package as its licence is not clear." /> pfm - 0.5.1 + 0.5.2 diff --git a/docs/reference/FOMC_actual_twa.html b/docs/reference/FOMC_actual_twa.html index 685edc3..070788b 100644 --- a/docs/reference/FOMC_actual_twa.html +++ b/docs/reference/FOMC_actual_twa.html @@ -61,7 +61,7 @@ pfm - 0.5.1 + 0.5.2 diff --git a/docs/reference/GUS.html b/docs/reference/GUS.html index 65763bc..59fd888 100644 --- a/docs/reference/GUS.html +++ b/docs/reference/GUS.html @@ -63,7 +63,7 @@ $$GUS = \log_{10} DT50_{soil} (4 - \log_{10} K_{oc})$$" /> pfm - 0.5.1 + 0.5.2 diff --git a/docs/reference/PEC_FOMC_accu_rel.html b/docs/reference/PEC_FOMC_accu_rel.html new file mode 100644 index 0000000..7999e32 --- /dev/null +++ b/docs/reference/PEC_FOMC_accu_rel.html @@ -0,0 +1,163 @@ + + + + + + + + +Get the relative accumulation of an FOMC model over multiples of an interval — PEC_FOMC_accu_rel • pfm + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + +
+ +
+
+ + +
+ +

Get the relative accumulation of an FOMC model over multiples of an interval

+ +
+ +
PEC_FOMC_accu_rel(n, interval, FOMC)
+ +

Arguments

+ + + + + + + + + + + + + + +
n

number of applications

interval

Time between applications

FOMC

Named numeric vector containing the FOMC parameters alpha and beta

+ +

Value

+ +

A numeric vector containing all n accumulation factors for the n applications

+ + +
+ +
+ +
+ + +
+

Site built with pkgdown.

+
+ +
+
+ + + + + + diff --git a/docs/reference/PEC_soil.html b/docs/reference/PEC_soil.html index 8903470..d746c2d 100644 --- a/docs/reference/PEC_soil.html +++ b/docs/reference/PEC_soil.html @@ -65,7 +65,7 @@ and in the EFSA guidance on PEC soil calculations (EFSA, 2015, 2017)." /> pfm - 0.5.1 + 0.5.2 @@ -120,9 +120,9 @@ and in the EFSA guidance on PEC soil calculations (EFSA, 2015, 2017).

PEC_units = "mg/kg", PEC_pw_units = "mg/L", interval = NA, n_periods = Inf, tillage_depth = 20, leaching_depth = tillage_depth, crop = "annual", cultivation = FALSE, chent = NA, DT50 = NA, - Koc = NA, Kom = Koc/1.724, t_avg = 0, scenarios = c("default", - "EFSA_2017", "EFSA_2015"), leaching = scenarios == "EFSA_2017", - porewater = FALSE) + FOMC = NA, Koc = NA, Kom = Koc/1.724, t_avg = 0, + scenarios = c("default", "EFSA_2017", "EFSA_2015"), leaching = scenarios + == "EFSA_2017", porewater = FALSE)

Arguments

@@ -153,8 +153,9 @@ and in the EFSA guidance on PEC soil calculations (EFSA, 2015, 2017).

- + @@ -168,7 +169,7 @@ degradation rate units are in days

@@ -193,6 +194,13 @@ also be a name for the substance as a character string

+ + + + @@ -255,7 +263,7 @@ from 2017 (p. 92).

taken into account for the EFSA 2017 scenarios, using the evaluation depth (here mixing depth) as the depth of the layer from which leaching takes place. However, as the amount leaching below the evaluation depth - (often 5 cm) will partly be mixed back during tillage, the default in this function + (often 5 cm) will partly be mixed back during tillage, the default in this function is to use the tillage depth for the calculation of the leaching rate.

If temperature information is available in the selected scenarios, as e.g. in the EFSA scenarios, the DT50 for groundwater modelling diff --git a/docs/reference/PEC_sw_drainage_UK.html b/docs/reference/PEC_sw_drainage_UK.html index e183ae2..80dd7fa 100644 --- a/docs/reference/PEC_sw_drainage_UK.html +++ b/docs/reference/PEC_sw_drainage_UK.html @@ -62,7 +62,7 @@ published on the CRC website" /> pfm - 0.5.1 + 0.5.2 diff --git a/docs/reference/PEC_sw_drift.html b/docs/reference/PEC_sw_drift.html index b5608db..f537d5d 100644 --- a/docs/reference/PEC_sw_drift.html +++ b/docs/reference/PEC_sw_drift.html @@ -63,7 +63,7 @@ with input via spray drift." /> pfm - 0.5.1 + 0.5.2 diff --git a/docs/reference/PEC_sw_exposit_runoff.html b/docs/reference/PEC_sw_exposit_runoff.html index 9fab616..b57c2f9 100644 --- a/docs/reference/PEC_sw_exposit_runoff.html +++ b/docs/reference/PEC_sw_exposit_runoff.html @@ -62,7 +62,7 @@ in the worksheet "Konzept Runoff". Calculation of sediment PEC values pfm - 0.5.1 + 0.5.2 diff --git a/docs/reference/PEC_sw_focus.html b/docs/reference/PEC_sw_focus.html index 88f5b43..93d5d44 100644 --- a/docs/reference/PEC_sw_focus.html +++ b/docs/reference/PEC_sw_focus.html @@ -67,7 +67,7 @@ to be used with the FOCUS calculator." /> pfm - 0.5.1 + 0.5.2 diff --git a/docs/reference/PEC_sw_sed.html b/docs/reference/PEC_sw_sed.html index 01ccf29..28dae7c 100644 --- a/docs/reference/PEC_sw_sed.html +++ b/docs/reference/PEC_sw_sed.html @@ -64,7 +64,7 @@ PEC calculator" /> pfm - 0.5.1 + 0.5.2 diff --git a/docs/reference/PELMO_path.html b/docs/reference/PELMO_path.html index b390917..a67084c 100644 --- a/docs/reference/PELMO_path.html +++ b/docs/reference/PELMO_path.html @@ -61,7 +61,7 @@ pfm - 0.5.1 + 0.5.2 diff --git a/docs/reference/PELMO_runs.html b/docs/reference/PELMO_runs.html index 12a4244..2a75191 100644 --- a/docs/reference/PELMO_runs.html +++ b/docs/reference/PELMO_runs.html @@ -67,7 +67,7 @@ and run using wine." /> pfm - 0.5.1 + 0.5.2 @@ -229,7 +229,7 @@ the period.plm file generated by the FOCUS PELMO GUI.

#> #>
# We get exactly the same PECgw values (on Linux, calling PELMO using Wine). print(time_1)
#> User System verstrichen -#> 0.383 0.129 30.547
if(!inherits(try(cpuinfo <- readLines("/proc/cpuinfo")), "try-error")) { +#> 0.395 0.093 30.590
if(!inherits(try(cpuinfo <- readLines("/proc/cpuinfo")), "try-error")) { cat(gsub("model name\t: ", "CPU model: ", cpuinfo[grep("model name", cpuinfo)[1]])) }
#> CPU model: AMD Ryzen 7 1700 Eight-Core Processor
# Demonstrate some results with metabolites. diff --git a/docs/reference/SFO_actual_twa.html b/docs/reference/SFO_actual_twa.html index b7b65f5..65ca58e 100644 --- a/docs/reference/SFO_actual_twa.html +++ b/docs/reference/SFO_actual_twa.html @@ -61,7 +61,7 @@ pfm - 0.5.1 + 0.5.2
diff --git a/docs/reference/SSLRC_mobility_classification.html b/docs/reference/SSLRC_mobility_classification.html index 06be24e..a0e592a 100644 --- a/docs/reference/SSLRC_mobility_classification.html +++ b/docs/reference/SSLRC_mobility_classification.html @@ -62,7 +62,7 @@ checked against the spreadsheet published on the CRC website" /> pfm - 0.5.1 + 0.5.2 diff --git a/docs/reference/TOXSWA_cwa.html b/docs/reference/TOXSWA_cwa.html index a1b6bfe..6941fa9 100644 --- a/docs/reference/TOXSWA_cwa.html +++ b/docs/reference/TOXSWA_cwa.html @@ -62,7 +62,7 @@ Usually, an instance of this class will be generated by read.TOXSWA_cwa." /> pfm - 0.5.1 + 0.5.2 diff --git a/docs/reference/chent_focus_sw.html b/docs/reference/chent_focus_sw.html index 39b3c9e..680efa6 100644 --- a/docs/reference/chent_focus_sw.html +++ b/docs/reference/chent_focus_sw.html @@ -61,7 +61,7 @@ pfm - 0.5.1 + 0.5.2 diff --git a/docs/reference/create_run_list.html b/docs/reference/create_run_list.html index c52719d..d3c5a97 100644 --- a/docs/reference/create_run_list.html +++ b/docs/reference/create_run_list.html @@ -61,7 +61,7 @@ pfm - 0.5.1 + 0.5.2 diff --git a/docs/reference/drift_data_JKI.html b/docs/reference/drift_data_JKI.html index c3f1f4d..71cd2d9 100644 --- a/docs/reference/drift_data_JKI.html +++ b/docs/reference/drift_data_JKI.html @@ -64,7 +64,7 @@ published by the German Julius-Kühn Institute (JKI)." /> pfm - 0.5.1 + 0.5.2 diff --git a/docs/reference/endpoint.html b/docs/reference/endpoint.html index 819d8bc..0c0eb66 100644 --- a/docs/reference/endpoint.html +++ b/docs/reference/endpoint.html @@ -64,7 +64,7 @@ this function." /> pfm - 0.5.1 + 0.5.2 diff --git a/docs/reference/focus_80th.html b/docs/reference/focus_80th.html index 0604fa7..60ecbdd 100644 --- a/docs/reference/focus_80th.html +++ b/docs/reference/focus_80th.html @@ -64,7 +64,7 @@ values obtained by PELMO." /> pfm - 0.5.1 + 0.5.2 diff --git a/docs/reference/geomean.html b/docs/reference/geomean.html index dfcd15e..b676773 100644 --- a/docs/reference/geomean.html +++ b/docs/reference/geomean.html @@ -64,7 +64,7 @@ returns 0 if at least one element of the vector is 0." /> pfm - 0.5.1 + 0.5.2 diff --git a/docs/reference/get_flux.html b/docs/reference/get_flux.html index 518b09c..2b138f8 100644 --- a/docs/reference/get_flux.html +++ b/docs/reference/get_flux.html @@ -61,7 +61,7 @@ pfm - 0.5.1 + 0.5.2 diff --git a/docs/reference/get_interval.html b/docs/reference/get_interval.html index 4b73ca2..b6561fb 100644 --- a/docs/reference/get_interval.html +++ b/docs/reference/get_interval.html @@ -61,7 +61,7 @@ pfm - 0.5.1 + 0.5.2 diff --git a/docs/reference/get_vertex.html b/docs/reference/get_vertex.html new file mode 100644 index 0000000..6878553 --- /dev/null +++ b/docs/reference/get_vertex.html @@ -0,0 +1,141 @@ + + + + + + + + +Fit a parabola through three points — get_vertex • pfm + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + +
+ +
+
+ + +
+ +

This was inspired by an answer on stackoverflow +https://stackoverflow.com/a/717791

+ +
+ +
get_vertex(x, y)
+ + +
+ +
+ +
+ + +
+

Site built with pkgdown.

+
+ +
+
+ + + + + + diff --git a/docs/reference/index.html b/docs/reference/index.html index 12abbd4..d57bc84 100644 --- a/docs/reference/index.html +++ b/docs/reference/index.html @@ -58,7 +58,7 @@ pfm - 0.5.1 + 0.5.2 diff --git a/docs/reference/max_twa.html b/docs/reference/max_twa.html index c603fb4..838b00f 100644 --- a/docs/reference/max_twa.html +++ b/docs/reference/max_twa.html @@ -65,7 +65,7 @@ max_twa." /> pfm - 0.5.1 + 0.5.2 diff --git a/docs/reference/one_box.html b/docs/reference/one_box.html index f3a6324..78daced 100644 --- a/docs/reference/one_box.html +++ b/docs/reference/one_box.html @@ -61,7 +61,7 @@ pfm - 0.5.1 + 0.5.2 diff --git a/docs/reference/perc_runoff_exposit.html b/docs/reference/perc_runoff_exposit.html index 2c7dd2a..2899a26 100644 --- a/docs/reference/perc_runoff_exposit.html +++ b/docs/reference/perc_runoff_exposit.html @@ -61,7 +61,7 @@ pfm - 0.5.1 + 0.5.2 diff --git a/docs/reference/perc_runoff_reduction_exposit.html b/docs/reference/perc_runoff_reduction_exposit.html index 9a8f10a..865f1cf 100644 --- a/docs/reference/perc_runoff_reduction_exposit.html +++ b/docs/reference/perc_runoff_reduction_exposit.html @@ -61,7 +61,7 @@ pfm - 0.5.1 + 0.5.2 diff --git a/docs/reference/pesticide.txt b/docs/reference/pesticide.txt index 1f9181a..e524f3c 100644 --- a/docs/reference/pesticide.txt +++ b/docs/reference/pesticide.txt @@ -41,3 +41,5 @@ Dummy 1 cereals, spring n NA Dummy 1 cereals, winter s of Dummy 1 citrus n mm Du M1 cereals, winter n NA M1 cereals, winter s of M1 cereals, winter n mm M1 cereals, winter s js M1 cereals, winter n NA M1 cereals, winter s of M1 cereals, winter n mm M1 cereals, winter s js 250.00 100.00 100.00 50.00 100.00 100.00 0.00E+00 50.00 1000.00 1.00 0.00E+00 1.00 -99.00 -99.00 -99.00 -99.00 0.00E+00 1.00 Dummy 1 cereals, spring n NA Dummy 1 cereals, winter s of Dummy 1 citrus n mm Dummy 1 cotton s js Dummy 1 field beans n NA Dummy 1 grass / alfalfa s of Dummy 1 hops n mm Dummy 1 legumes s js Dummy 1 maize n NA Dummy 1 oil seed rape, spring s of Dummy 1 oil seed rape, winter n mm Dummy 1 olives s js Dummy 1 pome / stone fruit, early applns n NA Dummy 1 pome / stone fruit, late applns s of Dummy 1 potatoes n mm Dummy 1 soybeans s js Dummy 1 sugar beets n NA Dummy 1 sunflowers s of Dummy 1 tobacco n mm Dummy 1 vegetables, bulb s js Dummy 1 vegetables, fruiting n NA Dummy 1 vegetables, leafy s of Dummy 1 vegetables, root n mm Dummy 1 vines, early applns s js Dummy 1 vines, late applns n NA Dummy 1 appln, aerial s of Dummy 1 appln, hand (crop < 50 cm) n mm Dummy 1 appln, hand (crop > 50 cm) s js Dummy 1 no drift (incorp or seed trtmt) n NA Dummy 1 cereals, spring n NA Dummy 1 cereals, winter s of Dummy 1 citrus n mm Dummy 1 cotton s js Dummy 1 field beans n NA Dummy 1 grass / alfalfa s of Dummy 1 hops n mm Dummy 1 legumes s js Dummy 1 maize n NA Dummy 1 oil seed rape, spring s of Dummy 1 oil seed rape, winter n mm Dummy 1 olives s js Dummy 1 pome / stone fruit, early applns n NA Dummy 1 pome / stone fruit, late applns s of Dummy 1 potatoes n mm Dummy 1 soybeans s js Dummy 1 sugar beets n NA Dummy 1 sunflowers s of Dummy 1 tobacco n mm Dummy 1 vegetables, bulb s js Dummy 1 vegetables, fruiting n NA Dummy 1 vegetables, leafy s of Dummy 1 vegetables, root n mm Dummy 1 vines, early applns s js Dummy 1 vines, late applns n NA Dummy 1 appln, aerial s of Dummy 1 appln, hand (crop < 50 cm) n mm Dummy 1 appln, hand (crop > 50 cm) s js Dummy 1 no drift (incorp or seed trtmt) n NA -99.00 -99.00 6000.00 344.80 0.00E+00 6.00 0.00E+00 0.00E+00 3000.00 1.00 0.00E+00 0.00E+00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 22.00 23.00 24.00 25.00 26.00 27.00 28.00 0.00E+00 -99.00 -99.00 -99.00 0.00E+00 1.00 M1 cereals, winter n NA M1 cereals, winter s of M1 cereals, winter n mm M1 cereals, winter s js M1 cereals, winter n NA M1 cereals, winter s of M1 cereals, winter n mm M1 cereals, winter s js 250.00 100.00 100.00 50.00 100.00 100.00 0.00E+00 50.00 1000.00 1.00 0.00E+00 1.00 -99.00 -99.00 -99.00 -99.00 0.00E+00 1.00 +Dummy 1 cereals, spring n NA Dummy 1 cereals, winter s of Dummy 1 citrus n mm Dummy 1 cotton s js Dummy 1 field beans n NA Dummy 1 grass / alfalfa s of Dummy 1 hops n mm Dummy 1 legumes s js Dummy 1 maize n NA Dummy 1 oil seed rape, spring s of Dummy 1 oil seed rape, winter n mm Dummy 1 olives s js Dummy 1 pome / stone fruit, early applns n NA Dummy 1 pome / stone fruit, late applns s of Dummy 1 potatoes n mm Dummy 1 soybeans s js Dummy 1 sugar beets n NA Dummy 1 sunflowers s of Dummy 1 tobacco n mm Dummy 1 vegetables, bulb s js Dummy 1 vegetables, fruiting n NA Dummy 1 vegetables, leafy s of Dummy 1 vegetables, root n mm Dummy 1 vines, early applns s js Dummy 1 vines, late applns n NA Dummy 1 appln, aerial s of Dummy 1 appln, hand (crop < 50 cm) n mm Dummy 1 appln, hand (crop > 50 cm) s js Dummy 1 no drift (incorp or seed trtmt) n NA Dummy 1 cereals, spring n NA Dummy 1 cereals, winter s of Dummy 1 citrus n mm Dummy 1 cotton s js Dummy 1 field beans n NA Dummy 1 grass / alfalfa s of Dummy 1 hops n mm Dummy 1 legumes s js Dummy 1 maize n NA Dummy 1 oil seed rape, spring s of Dummy 1 oil seed rape, winter n mm Dummy 1 olives s js Dummy 1 pome / stone fruit, early applns n NA Dummy 1 pome / stone fruit, late applns s of Dummy 1 potatoes n mm Dummy 1 soybeans s js Dummy 1 sugar beets n NA Dummy 1 sunflowers s of Dummy 1 tobacco n mm Dummy 1 vegetables, bulb s js Dummy 1 vegetables, fruiting n NA Dummy 1 vegetables, leafy s of Dummy 1 vegetables, root n mm Dummy 1 vines, early applns s js Dummy 1 vines, late applns n NA Dummy 1 appln, aerial s of Dummy 1 appln, hand (crop < 50 cm) n mm Dummy 1 appln, hand (crop > 50 cm) s js Dummy 1 no drift (incorp or seed trtmt) n NA -99.00 -99.00 6000.00 344.80 0.00E+00 6.00 0.00E+00 0.00E+00 3000.00 1.00 0.00E+00 0.00E+00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00 21.00 22.00 23.00 24.00 25.00 26.00 27.00 28.00 0.00E+00 -99.00 -99.00 -99.00 0.00E+00 1.00 +M1 cereals, winter n NA M1 cereals, winter s of M1 cereals, winter n mm M1 cereals, winter s js M1 cereals, winter n NA M1 cereals, winter s of M1 cereals, winter n mm M1 cereals, winter s js 250.00 100.00 100.00 50.00 100.00 100.00 0.00E+00 50.00 1000.00 1.00 0.00E+00 1.00 -99.00 -99.00 -99.00 -99.00 0.00E+00 1.00 diff --git a/docs/reference/pfm_degradation.html b/docs/reference/pfm_degradation.html index 16df913..e09eff8 100644 --- a/docs/reference/pfm_degradation.html +++ b/docs/reference/pfm_degradation.html @@ -61,7 +61,7 @@ pfm - 0.5.1 + 0.5.2 diff --git a/docs/reference/plot.TOXSWA_cwa.html b/docs/reference/plot.TOXSWA_cwa.html index 65703e8..6a98359 100644 --- a/docs/reference/plot.TOXSWA_cwa.html +++ b/docs/reference/plot.TOXSWA_cwa.html @@ -62,7 +62,7 @@ segment of a TOXSWA surface water body." /> pfm - 0.5.1 + 0.5.2 diff --git a/docs/reference/plot.one_box.html b/docs/reference/plot.one_box.html index 473243a..6081c71 100644 --- a/docs/reference/plot.one_box.html +++ b/docs/reference/plot.one_box.html @@ -61,7 +61,7 @@ pfm - 0.5.1 + 0.5.2 diff --git a/docs/reference/read.TOXSWA_cwa.html b/docs/reference/read.TOXSWA_cwa.html index 5f6aba2..2f036de 100644 --- a/docs/reference/read.TOXSWA_cwa.html +++ b/docs/reference/read.TOXSWA_cwa.html @@ -66,7 +66,7 @@ renamed to ConLiqWatLay in the out file." /> pfm - 0.5.1 + 0.5.2 diff --git a/docs/reference/sawtooth.html b/docs/reference/sawtooth.html index 87dcab2..128d1f9 100644 --- a/docs/reference/sawtooth.html +++ b/docs/reference/sawtooth.html @@ -63,7 +63,7 @@ times, with an interval i." /> pfm - 0.5.1 + 0.5.2 diff --git a/docs/reference/soil_scenario_data_EFSA_2015.html b/docs/reference/soil_scenario_data_EFSA_2015.html index 23fe106..7565ef7 100644 --- a/docs/reference/soil_scenario_data_EFSA_2015.html +++ b/docs/reference/soil_scenario_data_EFSA_2015.html @@ -63,7 +63,7 @@ scenario and model adjustment factors from p. 15 and p. 17 are included." /> pfm - 0.5.1 + 0.5.2 diff --git a/docs/reference/soil_scenario_data_EFSA_2017.html b/docs/reference/soil_scenario_data_EFSA_2017.html index be49263..21bf797 100644 --- a/docs/reference/soil_scenario_data_EFSA_2017.html +++ b/docs/reference/soil_scenario_data_EFSA_2017.html @@ -63,7 +63,7 @@ scenario and model adjustment factors from p. 16 and p. 18 are included." /> pfm - 0.5.1 + 0.5.2 diff --git a/docs/reference/sum_periods.html b/docs/reference/sum_periods.html index 109d9e7..45d35c4 100644 --- a/docs/reference/sum_periods.html +++ b/docs/reference/sum_periods.html @@ -61,7 +61,7 @@ pfm - 0.5.1 + 0.5.2 diff --git a/docs/reference/twa.html b/docs/reference/twa.html index f74399c..f493a29 100644 --- a/docs/reference/twa.html +++ b/docs/reference/twa.html @@ -63,7 +63,7 @@ is after one window has passed." /> pfm - 0.5.1 + 0.5.2 diff --git a/man/PEC_FOMC_accu_rel.Rd b/man/PEC_FOMC_accu_rel.Rd new file mode 100644 index 0000000..ab0ddd9 --- /dev/null +++ b/man/PEC_FOMC_accu_rel.Rd @@ -0,0 +1,21 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/PEC_soil.R +\name{PEC_FOMC_accu_rel} +\alias{PEC_FOMC_accu_rel} +\title{Get the relative accumulation of an FOMC model over multiples of an interval} +\usage{ +PEC_FOMC_accu_rel(n, interval, FOMC) +} +\arguments{ +\item{n}{number of applications} + +\item{interval}{Time between applications} + +\item{FOMC}{Named numeric vector containing the FOMC parameters alpha and beta} +} +\value{ +A numeric vector containing all n accumulation factors for the n applications +} +\description{ +Get the relative accumulation of an FOMC model over multiples of an interval +} diff --git a/man/PEC_soil.Rd b/man/PEC_soil.Rd index c8c93ac..e85f33c 100644 --- a/man/PEC_soil.Rd +++ b/man/PEC_soil.Rd @@ -35,7 +35,7 @@ units are in days} \item{leaching_depth}{EFSA (2017) uses the mixing depth (ecotoxicological evaluation depth) to calculate leaching for annual crops where tillage -takes place. By default, losses from the layer down to the tillage +takes place. By default, losses from the layer down to the tillage depth are taken into account in this implementation.} \item{crop}{Ignored for scenarios other than EFSA_2017. Only annual crops @@ -53,7 +53,7 @@ also be a name for the substance as a character string} If DT50 is not specified here and not available from the chent object, zero degradation is assumed} -\item{FOMC}{If specified, it should be a named numeric vector containing +\item{FOMC}{If specified, it should be a named numeric vector containing the FOMC parameters alpha and beta. This overrides any other degradation endpoints, and the degradation during the interval and after the maximum PEC is calculated using these parameters without temperature correction} @@ -111,7 +111,7 @@ According to the EFSA guidance (EFSA, 2017, p. 43), leaching should be taken into account for the EFSA 2017 scenarios, using the evaluation depth (here mixing depth) as the depth of the layer from which leaching takes place. However, as the amount leaching below the evaluation depth - (often 5 cm) will partly be mixed back during tillage, the default in this function + (often 5 cm) will partly be mixed back during tillage, the default in this function is to use the tillage depth for the calculation of the leaching rate. If temperature information is available in the selected scenarios, as diff --git a/man/get_vertex.Rd b/man/get_vertex.Rd new file mode 100644 index 0000000..fe2f5c0 --- /dev/null +++ b/man/get_vertex.Rd @@ -0,0 +1,12 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/PEC_soil.R +\name{get_vertex} +\alias{get_vertex} +\title{Fit a parabola through three points} +\usage{ +get_vertex(x, y) +} +\description{ +This was inspired by an answer on stackoverflow +https://stackoverflow.com/a/717791 +} diff --git a/tests/testthat/test_PEC_soil.R b/tests/testthat/test_PEC_soil.R index 34b4749..6e4e30b 100644 --- a/tests/testthat/test_PEC_soil.R +++ b/tests/testthat/test_PEC_soil.R @@ -127,3 +127,23 @@ test_that("Tier 1 PEC soil example for Pesticide F in EFSA guidance from 2015 ca expect_equivalent(round(results_pfm, 2), results_guidance) expect_equivalent(round(results_pfm_pw, 2), results_guidance_pw) }) + +test_that("Long term FOMC PEC soil from ESCAPE can be reproduced", { + # Application of 100 g/ha with 25% interception and FOMC degradation type a + fomc_50_a <- PEC_soil(100, interception = 0.25, FOMC = c(alpha = 1, beta = 10), + interval = 365, tillage_depth = 20, n_periods = 50) + fomc_long_a <- PEC_soil(100, interception = 0.25, FOMC = c(alpha = 1, beta = 10), + interval = 365, tillage_depth = 20) + + # Application of 100 g/ha with 25% interception and FOMC degradation type b + # The long term PEC is much lower than when adding FOMC curves for 50 years + fomc_50_b <- PEC_soil(100, interception = 0.25, FOMC = c(alpha = 0.5, beta = 20), + interval = 365, tillage_depth = 20, n_periods = 50) + fomc_long_b <- PEC_soil(100, interception = 0.25, FOMC = c(alpha = 0.5, beta = 20), + interval = 365, tillage_depth = 20) + + expect_true(fomc_50_b > fomc_long_b) + + # The benchmark results were obtained with ESCAPE + expect_equivalent(round(fomc_long_b, 4), 0.1424) +}) -- cgit v1.2.1
interval

Period of the deeper mixing, defaults to 365, which is a year if -degradation rate units are in days

Period of the deeper mixing. The default is NA, i.e. no +deeper mixing. For annual deeper mixing, set this to 365 when degradation +units are in days

n_periods leaching_depth

EFSA (2017) uses the mixing depth (ecotoxicological evaluation depth) to calculate leaching for annual crops where tillage -takes place. By default, losses from the layer down to the tillage +takes place. By default, losses from the layer down to the tillage depth are taken into account in this implementation.

If specified, overrides soil DT50 endpoints from a chent object If DT50 is not specified here and not available from the chent object, zero degradation is assumed

FOMC

If specified, it should be a named numeric vector containing +the FOMC parameters alpha and beta. This overrides any other degradation +endpoints, and the degradation during the interval and after the maximum PEC +is calculated using these parameters without temperature correction

Koc