diff options
-rw-r--r-- | ChangeLog | 32 | ||||
-rw-r--r-- | DESCRIPTION | 2 | ||||
-rw-r--r-- | R/FOMC_actual_twa.R | 17 | ||||
-rw-r--r-- | R/GUS.R | 17 | ||||
-rw-r--r-- | R/PEC_soil.R | 17 | ||||
-rw-r--r-- | R/PEC_sw_drainage_UK.R | 17 | ||||
-rw-r--r-- | R/PEC_sw_drift.R | 17 | ||||
-rw-r--r-- | R/PEC_sw_sed.R | 17 | ||||
-rw-r--r-- | R/SFO_actual_twa.R | 17 | ||||
-rw-r--r-- | R/SSLRC_mobility_classification.R | 17 | ||||
-rw-r--r-- | R/TOXSWA_cwa.R | 16 | ||||
-rw-r--r-- | R/geomean.R | 17 | ||||
-rw-r--r-- | R/twa.R | 28 | ||||
-rw-r--r-- | build.log | 5 | ||||
-rw-r--r-- | man/pfm_degradation.Rd | 2 | ||||
-rw-r--r-- | man/sawtooth.Rd | 2 | ||||
-rw-r--r-- | test.log | 17 | ||||
-rw-r--r-- | tests/testthat/H_sw_R1_stream_events.rds | bin | 334 -> 0 bytes | |||
-rw-r--r-- | tests/testthat/H_sw_R1_stream_events.txt | 0 | ||||
-rw-r--r-- | tests/testthat/H_sw_R1_stream_windows.rds | bin | 235 -> 0 bytes | |||
-rw-r--r-- | tests/testthat/H_sw_R1_stream_windows.txt | 0 | ||||
-rw-r--r-- | tests/testthat/test_TOXSWA.R | 6 |
22 files changed, 50 insertions, 213 deletions
@@ -1,3 +1,35 @@ +commit 58c6214f459b28b899794f32a60836aef97ac01b +Author: Johannes Ranke <jranke@uni-bremen.de> +Date: 2020-07-07 11:27:44 +0200 + + Adapt pfm_degradation to current mkin + + use_of_ff = "max" is now the default + +commit e3bc264df69f892e9ad990be22d3ec1b22041daa +Author: Johannes Ranke <jranke@uni-bremen.de> +Date: 2020-06-17 13:37:59 +0200 + + TSCF estimation equations, update docs + + Briggs et al. (1982) and Dettenmaier et al. (2009) + +commit e505ecc4aba0f6719fd772faa2655dd824a6930d +Author: Johannes Ranke <jranke@uni-bremen.de> +Date: 2020-04-17 09:51:33 +0200 + + Skip testing on R-devel + + it currently fails with + + ✖ | 6 1 | Read and analyse TOXSWA cwa files [6.4 s] + ──────────────────────────────────────────────────────────────────────────────────────────────────── + test_TOXSWA.R:68: failure: Getting events and moving window analysis works + H_sw_R1_stream$windows has changed from known value recorded in 'H_sw_R1_stream_windows.rds'. + Component "window": Modes: character, numeric + Component "window": Attributes: < target is NULL, current is list > + Component "window": target is character, current is factor + commit d81550d0cccae824cc748de48e7fd50ea8d8033a Author: Johannes Ranke <jranke@uni-bremen.de> Date: 2020-04-16 18:02:18 +0200 diff --git a/DESCRIPTION b/DESCRIPTION index 8d0ebeb..e877629 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -2,7 +2,7 @@ Package: pfm Type: Package Title: Utilities for Pesticide Fate Modelling Version: 0.5.7 -Date: 2020-06-17 +Date: 2020-07-07 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/R/FOMC_actual_twa.R b/R/FOMC_actual_twa.R index dc869b5..0ccf315 100644 --- a/R/FOMC_actual_twa.R +++ b/R/FOMC_actual_twa.R @@ -1,20 +1,3 @@ -# Copyright (C) 2018 Johannes Ranke -# Contact: jranke@uni-bremen.de -# This file is part of the R package pfm - -# 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/> - #' Actual and maximum moving window time average concentrations for FOMC kinetics #' #' @param alpha Parameter of the FOMC model @@ -1,20 +1,3 @@ -# Copyright (C) 2015 Johannes Ranke -# Contact: jranke@uni-bremen.de -# This file is part of the R package pfm - -# 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/> - #' Groundwater ubiquity score based on Gustafson (1989) #' #' The groundwater ubiquity score GUS is calculated according to diff --git a/R/PEC_soil.R b/R/PEC_soil.R index 541184f..b29ff13 100644 --- a/R/PEC_soil.R +++ b/R/PEC_soil.R @@ -1,20 +1,3 @@ -# Copyright (C) 2015,2016,2018,2019 Johannes Ranke -# Contact: jranke@uni-bremen.de -# This file is part of the R package pfm - -# 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/> - # Register global variables if(getRversion() >= '2.15.1') utils::globalVariables(c("destination", "study_type", "TP_identifier", "soil_scenario_data_EFSA_2015", diff --git a/R/PEC_sw_drainage_UK.R b/R/PEC_sw_drainage_UK.R index 3be4c97..d773f40 100644 --- a/R/PEC_sw_drainage_UK.R +++ b/R/PEC_sw_drainage_UK.R @@ -1,20 +1,3 @@ -# Copyright (C) 2015 Johannes Ranke -# Contact: jranke@uni-bremen.de -# This file is part of the R package pfm - -# 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/> - #' Calculate initial predicted environmental concentrations in surface water due to drainage using the UK method #' #' This implements the method specified in the UK data requirements handbook and was checked against the spreadsheet diff --git a/R/PEC_sw_drift.R b/R/PEC_sw_drift.R index 261706c..6fcaecf 100644 --- a/R/PEC_sw_drift.R +++ b/R/PEC_sw_drift.R @@ -1,20 +1,3 @@ -# Copyright (C) 2015 Johannes Ranke -# Contact: jranke@uni-bremen.de -# This file is part of the R package pfm - -# 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/> - #' Calculate predicted environmental concentrations in surface water due to drift #' #' This is a basic, vectorised form of a simple calculation of a contaminant diff --git a/R/PEC_sw_sed.R b/R/PEC_sw_sed.R index a4a3d6a..2865ab7 100644 --- a/R/PEC_sw_sed.R +++ b/R/PEC_sw_sed.R @@ -1,20 +1,3 @@ -# Copyright (C) 2015 Johannes Ranke -# Contact: jranke@uni-bremen.de -# This file is part of the R package pfm - -# 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/> - #' Calculate predicted environmental concentrations in sediment from surface #' water concentrations #' diff --git a/R/SFO_actual_twa.R b/R/SFO_actual_twa.R index 0d2015b..63a53f3 100644 --- a/R/SFO_actual_twa.R +++ b/R/SFO_actual_twa.R @@ -1,20 +1,3 @@ -# Copyright (C) 2015,2018 Johannes Ranke -# Contact: jranke@uni-bremen.de -# This file is part of the R package pfm - -# 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/> - #' Actual and maximum moving window time average concentrations for SFO kinetics #' #' @param DT50 The half-life. diff --git a/R/SSLRC_mobility_classification.R b/R/SSLRC_mobility_classification.R index 602f166..b78de98 100644 --- a/R/SSLRC_mobility_classification.R +++ b/R/SSLRC_mobility_classification.R @@ -1,20 +1,3 @@ -# Copyright (C) 2015,2018,2019 Johannes Ranke -# Contact: jranke@uni-bremen.de -# This file is part of the R package pfm - -# 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/> - #' Determine the SSLRC mobility classification for a chemical substance from its Koc #' #' This implements the method specified in the UK data requirements handbook and was diff --git a/R/TOXSWA_cwa.R b/R/TOXSWA_cwa.R index 5b1e8f2..42cdd35 100644 --- a/R/TOXSWA_cwa.R +++ b/R/TOXSWA_cwa.R @@ -1,19 +1,3 @@ -# Copyright (C) 2014,2015,2016,2017,2018 Johannes Ranke -# Contact: jranke@uni-bremen.de -# This file is part of the R package pfm - -# 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/> if(getRversion() >= '2.15.1') utils::globalVariables(c("cwa")) #' Read TOXSWA surface water concentrations diff --git a/R/geomean.R b/R/geomean.R index 04328c8..34c5caf 100644 --- a/R/geomean.R +++ b/R/geomean.R @@ -1,20 +1,3 @@ -# Copyright (C) 2015,2020 Johannes Ranke -# Contact: jranke@uni-bremen.de -# This file is part of the R package pfm - -# 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/> - #' Calculate the geometric mean #' #' Based on some posts in a thread on Stackoverflow @@ -1,28 +1,10 @@ -# Copyright (C) 2016,2017 Johannes Ranke - -# Contact: jranke@uni-bremen.de -# This file is part of the R package pfm - -# 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/> - #' Create a time series of decline data #' #' @param x When numeric, this is the half-life to be used for an exponential #' decline. When a character string specifying a parent decline model is given #' e.g. \code{FOMC}, \code{parms} must contain the corresponding parameters. #' If x is an \code{\link{mkinfit}} object, the decline is calculated from this -#' object. +#' object. #' @param ini The initial amount. If x is an \code{\link{mkinfit}} object, and #' ini is 'model', the fitted initial concentrations are used. Otherwise, ini #' must be numeric. If it has length one, it is used for the parent and @@ -93,7 +75,7 @@ one_box.character <- function(x, ini = 1, parms, ..., t_out <- seq(0, t_end, by = res) pred <- mkinpredict(m, odeparms = parms, odeini = c(parent = ini), - outtimes = t_out, solution_type = "analytical")[-1] + outtimes = t_out, solution_type = "analytical")[, -1, drop = FALSE] result <- ts(pred, 0, t_end, frequency = 1/res) class(result) <- c("one_box", "ts") return(result) @@ -118,7 +100,7 @@ one_box.mkinfit <- function(x, ini = "model", ..., t_end = 100, res = 0.01) { else solution_type = "deSolve" tmp <- mkinpredict(fit$mkinmod, odeparms = fit$bparms.ode, odeini = odeini, - outtimes = t_out, solution_type = solution_type)[-1] + outtimes = t_out, solution_type = solution_type)[, -1, drop = FALSE] result <- ts(tmp, 0, t_end, frequency = 1/res) class(result) <- c("one_box", "ts") return(result) @@ -172,7 +154,7 @@ plot.one_box <- function(x, #' Create decline time series for multiple applications #' -#' If the application pattern is specified in \code{applications}, +#' If the application pattern is specified in \code{applications}, #' \code{n} and \code{i} are disregarded. #' @param x A \code{\link{one_box}} object #' @param n The number of applications. If \code{applications} is specified, \code{n} is ignored @@ -260,7 +242,7 @@ twa.one_box <- function(x, window = 21) #' for finding the maximum. It is therefore recommended to check this using #' \code{\link{plot.one_box}} using the window size for the argument #' \code{max_twa}. -#' +#' #' The method working directly on fitted \code{\link{mkinfit}} objects uses the #' equations given in the PEC soil section of the FOCUS guidance and is restricted #' SFO, FOMC and DFOP models and to the parent compound @@ -6,8 +6,7 @@ Removed empty directory ‘pfm/inst/testdata/SwashProjects/Project_1/MACRO’ Removed empty directory ‘pfm/inst/testdata/SwashProjects/Project_1’ Removed empty directory ‘pfm/inst/testdata/SwashProjects’ -* looking to see if a ‘data/datalist’ file should be added 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' + 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’ diff --git a/man/pfm_degradation.Rd b/man/pfm_degradation.Rd index 6684fa4..81f2e81 100644 --- a/man/pfm_degradation.Rd +++ b/man/pfm_degradation.Rd @@ -7,7 +7,7 @@ pfm_degradation( model = "SFO", DT50 = 1000, - parms = c(k_parent_sink = log(2)/DT50), + parms = c(k_parent = log(2)/DT50), years = 1, step_days = 1, times = seq(0, years * 365, by = step_days) diff --git a/man/sawtooth.Rd b/man/sawtooth.Rd index 44ab2be..0850ded 100644 --- a/man/sawtooth.Rd +++ b/man/sawtooth.Rd @@ -23,7 +23,7 @@ is ignored} the corresponding amounts applied in the second column.} } \description{ -If the application pattern is specified in \code{applications}, +If the application pattern is specified in \code{applications}, \code{n} and \code{i} are disregarded. } \examples{ @@ -7,26 +7,19 @@ Testing pfm
⠏ | 0 | Simple PEC soil calculations
⠙ | 2 | Simple PEC soil calculations
✔ | 17 | Simple PEC soil calculations [0.3 s]
⠏ | 0 | Simple PEC surface water calculations with drift entry
✔ | 2 | Simple PEC surface water calculations with drift entry
⠏ | 0 | Actual and time weighted average concentrations for SFO kinetics
✔ | 1 | Actual and time weighted average concentrations for SFO kinetics -
⠏ | 0 | Read and analyse TOXSWA cwa files
⠋ | 1 | Read and analyse TOXSWA cwa files
⠸ | 4 | Read and analyse TOXSWA cwa files
⠼ | 5 | Read and analyse TOXSWA cwa files
⠴ | 6 | Read and analyse TOXSWA cwa files
✖ | 6 1 | Read and analyse TOXSWA cwa files [6.4 s] -──────────────────────────────────────────────────────────────────────────────────────────────────── -test_TOXSWA.R:68: failure: Getting events and moving window analysis works -H_sw_R1_stream$windows has changed from known value recorded in 'H_sw_R1_stream_windows.rds'. -Component "window": Modes: character, numeric -Component "window": Attributes: < target is NULL, current is list > -Component "window": target is character, current is factor -──────────────────────────────────────────────────────────────────────────────────────────────────── +
⠏ | 0 | Read and analyse TOXSWA cwa files
⠋ | 1 | Read and analyse TOXSWA cwa files
⠸ | 4 | Read and analyse TOXSWA cwa files
⠼ | 5 | Read and analyse TOXSWA cwa files
⠴ | 6 | Read and analyse TOXSWA cwa files
✔ | 7 | Read and analyse TOXSWA cwa files [5.8 s]
⠏ | 0 | UK drainage PEC calculations
✔ | 12 | UK drainage PEC calculations
⠏ | 0 | Exposit calculations
✔ | 7 | Exposit calculations
⠏ | 0 | Geometric mean calculation
✔ | 6 | Geometric mean calculation -
⠏ | 0 | Check max_twa for parent mkinfit models against analytical solutions
⠋ | 1 | Check max_twa for parent mkinfit models against analytical solutions
✔ | 1 | Check max_twa for parent mkinfit models against analytical solutions [2.1 s] +
⠏ | 0 | Check max_twa for parent mkinfit models against analytical solutions
⠋ | 1 | Check max_twa for parent mkinfit models against analytical solutions
✔ | 1 | Check max_twa for parent mkinfit models against analytical solutions [0.9 s]
⠏ | 0 | Processing of residue series
✔ | 11 | Processing of residue series
⠏ | 0 | FOCUS Step 1 calculations
⠹ | 3 | FOCUS Step 1 calculations
✔ | 9 | FOCUS Step 1 calculations [0.1 s]
⠏ | 0 | FOCUS Steps 12 input files
✔ | 8 | FOCUS Steps 12 input files ══ Results ═════════════════════════════════════════════════════════════════════════════════════════ -Duration: 9.3 s +Duration: 7.4 s -OK: 81 -Failed: 1 +OK: 82 +Failed: 0 Warnings: 0 Skipped: 0 diff --git a/tests/testthat/H_sw_R1_stream_events.rds b/tests/testthat/H_sw_R1_stream_events.rds Binary files differdeleted file mode 100644 index ba6557b..0000000 --- a/tests/testthat/H_sw_R1_stream_events.rds +++ /dev/null diff --git a/tests/testthat/H_sw_R1_stream_events.txt b/tests/testthat/H_sw_R1_stream_events.txt new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/testthat/H_sw_R1_stream_events.txt diff --git a/tests/testthat/H_sw_R1_stream_windows.rds b/tests/testthat/H_sw_R1_stream_windows.rds Binary files differdeleted file mode 100644 index 2531189..0000000 --- a/tests/testthat/H_sw_R1_stream_windows.rds +++ /dev/null diff --git a/tests/testthat/H_sw_R1_stream_windows.txt b/tests/testthat/H_sw_R1_stream_windows.txt new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/testthat/H_sw_R1_stream_windows.txt diff --git a/tests/testthat/test_TOXSWA.R b/tests/testthat/test_TOXSWA.R index de60d48..b011288 100644 --- a/tests/testthat/test_TOXSWA.R +++ b/tests/testthat/test_TOXSWA.R @@ -1,4 +1,3 @@ -library(pfm) context("Read and analyse TOXSWA cwa files") # zipfile_test = tempfile() @@ -61,9 +60,10 @@ test_that("A TOXSWA 5.5.3 out file is correctly read and printed", { test_that("Getting events and moving window analysis works", { # Event analysis with two different thresholds H_sw_R1_stream$get_events(c(2, 10)) - expect_equal_to_reference(H_sw_R1_stream$events, file = "H_sw_R1_stream_events.rds") + expect_known_output(H_sw_R1_stream$events, file = "H_sw_R1_stream_events.txt") # Moving window analysis H_sw_R1_stream$moving_windows(c(7, 21)) - expect_equal_to_reference(H_sw_R1_stream$windows, file = "H_sw_R1_stream_windows.rds") + H_sw_R1_stream$windows + expect_known_output(H_sw_R1_stream$windows, file = "H_sw_R1_stream_windows.txt") }) |