diff options
author | Johannes Ranke <jranke@uni-bremen.de> | 2018-06-11 16:27:22 +0200 |
---|---|---|
committer | Johannes Ranke <jranke@uni-bremen.de> | 2018-06-11 16:27:22 +0200 |
commit | cac29c8c1cc0f6004ef0cd63229cfb993a24496c (patch) | |
tree | cb24081e119a15162425872b2a9f32a31720d303 | |
parent | bd15236d5dedb4067bd29e58e655c5352aca1db4 (diff) |
Adapt to TOXSWA 5.5.3
-rw-r--r-- | ChangeLog | 9 | ||||
-rw-r--r-- | DESCRIPTION | 4 | ||||
-rw-r--r-- | R/TOXSWA_cwa.R | 18 | ||||
-rw-r--r-- | build.log | 2 |
4 files changed, 25 insertions, 8 deletions
@@ -1,3 +1,12 @@ +commit bd15236d5dedb4067bd29e58e655c5352aca1db4 +Author: Johannes Ranke <jranke@uni-bremen.de> +Date: 2018-06-08 16:20:40 +0200 + + Enable PEC porewater for the default scenario + + The default scenario uses soil parameters from the REACH guidance R.16, + Table R.16-9. + commit ec2052d68950745380c2724757b3ba8b116605fc Author: Johannes Ranke <jranke@uni-bremen.de> Date: 2018-06-08 14:54:40 +0200 diff --git a/DESCRIPTION b/DESCRIPTION index 96aea24..0851224 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,8 +1,8 @@ Package: pfm Type: Package Title: Utilities for Pesticide Fate Modelling -Version: 0.4-5 -Date: 2018-06-08 +Version: 0.4-6 +Date: 2018-06-11 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/TOXSWA_cwa.R b/R/TOXSWA_cwa.R index 4caafb6..576c7d3 100644 --- a/R/TOXSWA_cwa.R +++ b/R/TOXSWA_cwa.R @@ -259,17 +259,25 @@ TOXSWA_cwa <- R6Class("TOXSWA_cwa", stop("Could not read ", filename) } } else { - # out file from FOCUS TOXSWA 4 (TOXSWA 4.4.2 or similar) + # out file from FOCUS TOXSWA 4 or higher outfile <- try(readLines(file_connection)) + focus_toxswa_version <- gsub(".*: ", "", outfile[4]) + + if (substr(focus_toxswa_version, 1, 1) == "3") { + cwastring = "ConLiqWatLayCur" + } else { + cwastring = "ConLiqWatLay" + } + close(file_connection) # only needed for files if (inherits(outfile, "try-error")) { stop("Could not read ", filename) } else { # Get the substance name(s) - sub_lines <- grep(".*0.000.*ConLiqWatLayCur_", outfile[1:50], value = TRUE) - substances <- gsub(".*ConLiqWatLayCur_(.*?) +[0-9].*", "\\1", sub_lines) + sub_lines <- grep(paste0(".*0.000.*", cwastring, "_"), outfile[1:50], value = TRUE) + substances <- gsub(paste0(".*", cwastring, "_(.*?) +[0-9].*"), "\\1", sub_lines) if (!substance %in% c("parent", substances)) { stop("No data for substance ", substance, " present in the .out file.") } @@ -277,9 +285,9 @@ TOXSWA_cwa <- R6Class("TOXSWA_cwa", # Generate field name for the concentrations at end of hour for the # substance of interest if (substance == "parent") { - cwa_string = paste0("ConLiqWatLayCur_", substances[1]) + cwa_string = paste0(cwastring, "_", substances[1]) } else { - cwa_string = paste0("ConLiqWatLayCur_", substance) + cwa_string = paste0(cwastring, "_", substance) } cwa_lines <- grep(cwa_string, outfile, value = TRUE) @@ -4,5 +4,5 @@ * checking for LF line-endings in source and make files and shell scripts * checking for empty or unneeded directories * looking to see if a ‘data/datalist’ file should be added -* building ‘pfm_0.4-5.tar.gz’ +* building ‘pfm_0.4-6.tar.gz’ |