aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Ranke <jranke@uni-bremen.de>2015-06-12 02:19:38 +0200
committerJohannes Ranke <jranke@uni-bremen.de>2015-06-12 02:38:38 +0200
commitfef0bb7fe916f91dcff089c17aa3290c0ea1ab1f (patch)
tree5613d56f179d2d6031f66d7e2f6dce0e8c3322a1
parent5b32c30549bfa3cb42ffde7e13f75608b98c79c2 (diff)
Add sediment PEC calculations using the percentage method
-rw-r--r--pkg/DESCRIPTION2
-rw-r--r--pkg/NAMESPACE1
-rw-r--r--pkg/R/PEC_sw_sed.R50
-rw-r--r--pkg/man/PEC_sw_sed.Rd42
-rw-r--r--pkg/tests/testthat/test_PEC_sed.R9
5 files changed, 103 insertions, 1 deletions
diff --git a/pkg/DESCRIPTION b/pkg/DESCRIPTION
index 9c4b276..39b8c20 100644
--- a/pkg/DESCRIPTION
+++ b/pkg/DESCRIPTION
@@ -2,7 +2,7 @@ Package: pfm
Type: Package
Title: Utilities for pesticide fate modelling
Version: 0.2-1
-Date: 2015-06-11
+Date: 2015-06-12
Authors@R: person("Johannes Ranke", email = "jranke@uni-bremen.de",
role = c("aut", "cre", "cph"))
Description: Utilities for simple PEC calculations and for dealing with data
diff --git a/pkg/NAMESPACE b/pkg/NAMESPACE
index 771739a..a1796f5 100644
--- a/pkg/NAMESPACE
+++ b/pkg/NAMESPACE
@@ -5,6 +5,7 @@ export(PEC_soil)
export(PEC_sw_drainage_UK_ini)
export(PEC_sw_drift)
export(PEC_sw_drift_ini)
+export(PEC_sw_sed)
export(SFO_actual_twa)
export(SSLRC_mobility_classification)
export(TOXSWA_cwa)
diff --git a/pkg/R/PEC_sw_sed.R b/pkg/R/PEC_sw_sed.R
new file mode 100644
index 0000000..56396e8
--- /dev/null
+++ b/pkg/R/PEC_sw_sed.R
@@ -0,0 +1,50 @@
+# 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 sediment from
+#' surface water concentrations
+#'
+#' The method 'percentage' is equivalent to what is used in the CRD spreadsheet
+#' PEC calculator
+#'
+#' @param PEC_sw Numeric vector or matrix of surface water concentrations in µg/L for
+#' which the corresponding sediment concentration is to be estimated
+#' @param percentage The percentage in sediment, used for the percentage method
+#' @param method The method used for the calculation
+#' @param sediment_depth Depth of the sediment layer
+#' @param water_depth Depth of the water body in cm
+#' @param sediment_density The density of the sediment in L/kg (equivalent to
+#' g/cm3)
+#' @param PEC_sed_units The units of the estimated sediment PEC value
+#' @return The predicted concentration in sediment
+#' @export
+#' @author Johannes Ranke
+#' @examples
+#' PEC_sw_sed(PEC_sw_drift_ini(100, distances = 1), percentage = 50)
+PEC_sw_sed <- function(PEC_sw, percentage = 100, method = "percentage",
+ sediment_depth = 5, water_depth = 30,
+ sediment_density = 1.3,
+ PEC_sed_units = c("\u00B5g/kg", "mg/kg"))
+{
+ method = match.arg(method)
+ PEC_sed_units = match.arg(PEC_sed_units)
+ if (method == "percentage") {
+ PEC_sed = PEC_sw * (percentage/100) * (water_depth / sediment_depth) * (1 / sediment_density)
+ if (PEC_sed_units == "mg/kg") PEC_sed <- PEC_sed / 1000
+ }
+ return(PEC_sed)
+}
diff --git a/pkg/man/PEC_sw_sed.Rd b/pkg/man/PEC_sw_sed.Rd
new file mode 100644
index 0000000..ee496d1
--- /dev/null
+++ b/pkg/man/PEC_sw_sed.Rd
@@ -0,0 +1,42 @@
+% Generated by roxygen2 (4.1.0.9001): do not edit by hand
+% Please edit documentation in R/PEC_sw_sed.R
+\name{PEC_sw_sed}
+\alias{PEC_sw_sed}
+\title{Calculate initial predicted environmental concentrations in sediment from
+surface water concentrations}
+\usage{
+PEC_sw_sed(PEC_sw, percentage = 100, method = "percentage",
+ sediment_depth = 5, water_depth = 30, sediment_density = 1.3,
+ PEC_sed_units = c("µg/kg", "mg/kg"))
+}
+\arguments{
+\item{PEC_sw}{Numeric vector or matrix of surface water concentrations in µg/L for
+which the corresponding sediment concentration is to be estimated}
+
+\item{percentage}{The percentage in sediment, used for the percentage method}
+
+\item{method}{The method used for the calculation}
+
+\item{sediment_depth}{Depth of the sediment layer}
+
+\item{water_depth}{Depth of the water body in cm}
+
+\item{sediment_density}{The density of the sediment in L/kg (equivalent to
+g/cm3)}
+
+\item{PEC_sed_units}{The units of the estimated sediment PEC value}
+}
+\value{
+The predicted concentration in sediment
+}
+\description{
+The method 'percentage' is equivalent to what is used in the CRD spreadsheet
+PEC calculator
+}
+\examples{
+PEC_sw_sed(PEC_sw_drift_ini(100, distances = 1), percentage = 50)
+}
+\author{
+Johannes Ranke
+}
+
diff --git a/pkg/tests/testthat/test_PEC_sed.R b/pkg/tests/testthat/test_PEC_sed.R
new file mode 100644
index 0000000..d83be0f
--- /dev/null
+++ b/pkg/tests/testthat/test_PEC_sed.R
@@ -0,0 +1,9 @@
+context("Simple PEC sediment calculations")
+
+test_that("PEC_sw_sed calculates correctly using the percentage method", {
+ # Application of 100 g/ha, 1 m spray drift distance (2.77% drift input), 50% in sediment,
+ # default assumptions of CRD spreadsheet (5 cm sediment depth, 1.3 kg/L sediment density)
+ # Reference value calculated with CRD spreadsheet
+ PEC_sw_100_1_m <- PEC_sw_drift_ini(100, distances = 1)
+ expect_equivalent(round(PEC_sw_sed(PEC_sw_100_1_m, percentage = 50), 3), 2.131)
+})

Contact - Imprint