From b24f0e8968499af833fff14834f3ed395e5e9f9b Mon Sep 17 00:00:00 2001 From: Johannes Ranke Date: Thu, 13 Feb 2025 13:46:24 +0100 Subject: Tests for 29 February in UK drainage, docs --- DESCRIPTION | 11 +++++++---- NEWS.md | 3 +++ R/PEC_sw_drainage_UK.R | 4 ++++ docs/authors.html | 4 ++++ docs/index.html | 1 + docs/news/index.html | 3 ++- docs/reference/PEC_sw_drainage_UK.html | 3 +++ docs/search.json | 2 +- log/build.log | 5 +++-- log/check.log | 25 +++++++++---------------- log/test.log | 8 ++++---- man/PEC_sw_drainage_UK.Rd | 2 ++ tests/testthat/test_UK_drainage.R | 8 ++++++++ 13 files changed, 51 insertions(+), 28 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 5633ade..0401a14 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -2,10 +2,13 @@ Package: pfm Type: Package Title: Utilities for Pesticide Fate Modelling Version: 0.6.4 -Date: 2025-01-29 -Authors@R: person("Johannes Ranke", email = "johannes.ranke@agroscope.admin.ch", - role = c("aut", "cre"), - comment = c(ORCID = "0000-0003-4371-6538")) +Date: 2025-02-13 +Authors@R: c( + person("Johannes Ranke", email = "johannes.ranke@agroscope.admin.ch", + role = c("aut", "cre"), + comment = c(ORCID = "0000-0003-4371-6538")), + person("Elisabeth Lutz", email = "elisabeth.lutz@agroscope.admin.ch", + role = "ctb")) Description: Utilities for simple calculations of predicted environmental concentrations ('PEC' values) and for dealing with data from some FOCUS pesticide fate modelling software packages. diff --git a/NEWS.md b/NEWS.md index e1c59fd..bd1888b 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,9 +1,12 @@ ## version 0.6.4 +- R/PEC_sw_drainage_uk.R: Fix a bug preventing the function to work of `latest_application` is set to 29 February. + - R/twa.R: Fix a bug in plotting one-box models of class `one_box` that affected plots that displayed a time weighted average. - R/PEC_sw_drainage_uk.R: Fix a bug leading to increased PEC values in the case the application date is after the beginning of the drainage period and `soil_DT50` was specified. + ## version 0.6.3 - R/{PEC_sw_drift,PEC_sw_exposit_runoff,PEC_sw_sed}.R: Make use of the `units` package. diff --git a/R/PEC_sw_drainage_UK.R b/R/PEC_sw_drainage_UK.R index f094624..4b3111e 100644 --- a/R/PEC_sw_drainage_UK.R +++ b/R/PEC_sw_drainage_UK.R @@ -25,6 +25,9 @@ #' @author Johannes Ranke #' @examples #' PEC_sw_drainage_UK(150, Koc = 100) +#' PEC_sw_drainage_UK(60, interception = 0.5, Koc = 550, +#' latest_application = "01 July", soil_DT50 = 200) + PEC_sw_drainage_UK <- function(rate, interception = 0, Koc, latest_application = NULL, soil_DT50 = NULL, model = NULL, model_parms = NULL) @@ -39,6 +42,7 @@ PEC_sw_drainage_UK <- function(rate, interception = 0, Koc, ref_year <- 2000 } else { ref_year <- 1999} latest <- as.Date(paste(latest_application, ref_year), "%d %b %Y") + if (is.na(latest)) stop("Please specify the latest application in the format '%d %b', e.g. '01 July'") tmp <- Sys.setlocale("LC_TIME", lct) degradation_time <- as.numeric(difftime(as.Date(paste0(ref_year,"-10-01")), units = "days", latest)) if (degradation_time > 0) { diff --git a/docs/authors.html b/docs/authors.html index 76e12b9..be0886e 100644 --- a/docs/authors.html +++ b/docs/authors.html @@ -38,6 +38,10 @@

Johannes Ranke. Author, maintainer.

+
  • +

    Elisabeth Lutz. Contributor. +

    +
  • diff --git a/docs/index.html b/docs/index.html index e2174c1..5360f39 100644 --- a/docs/index.html +++ b/docs/index.html @@ -120,6 +120,7 @@ Korkaric M, Hanke I, Grossar D, Neuweiler R, Christ B, Wirth J, Hochstrasser M,

    Developers

    diff --git a/docs/news/index.html b/docs/news/index.html index ab1b387..975d8be 100644 --- a/docs/news/index.html +++ b/docs/news/index.html @@ -34,7 +34,8 @@

    version 0.6.4

    -
    diff --git a/docs/reference/PEC_sw_drainage_UK.html b/docs/reference/PEC_sw_drainage_UK.html index 8505b9b..da84aa9 100644 --- a/docs/reference/PEC_sw_drainage_UK.html +++ b/docs/reference/PEC_sw_drainage_UK.html @@ -112,6 +112,9 @@ accessed 2019-09-27

    Examples

    PEC_sw_drainage_UK(150, Koc = 100)
     #> [1] 8.076923
    +PEC_sw_drainage_UK(60, interception = 0.5, Koc = 550,
    +  latest_application = "01 July", soil_DT50 = 200)
    +#> [1] 0.8388303