diff options
author | Johannes Ranke <jranke@uni-bremen.de> | 2016-07-15 15:05:22 +0200 |
---|---|---|
committer | Johannes Ranke <jranke@uni-bremen.de> | 2016-07-15 15:07:29 +0200 |
commit | d6b230cd1b415a112009227bc9e0ff50316c42f7 (patch) | |
tree | b1f5b5bf09388a35b24c2f5e6da1357694a84c62 | |
parent | b45c9bfae9e5578dd455ed417363b4996cffd46a (diff) |
Fix calculation of t_firstjan
There is an inconsistency in (some?) output files, so the first
datetime needs to be fixed before reading it into a data frame
-rw-r--r-- | pkg/DESCRIPTION | 4 | ||||
-rw-r--r-- | pkg/R/TOXSWA_cwa.R | 6 |
2 files changed, 8 insertions, 2 deletions
diff --git a/pkg/DESCRIPTION b/pkg/DESCRIPTION index 6adca34..e24d04f 100644 --- a/pkg/DESCRIPTION +++ b/pkg/DESCRIPTION @@ -1,8 +1,8 @@ Package: pfm Type: Package Title: Utilities for Pesticide Fate Modelling -Version: 0.3-5 -Date: 2016-06-08 +Version: 0.3-6 +Date: 2016-07-15 Authors@R: person("Johannes Ranke", email = "jranke@uni-bremen.de", role = c("aut", "cre", "cph")) Description: Utilities for simple calculations of predicted environmental diff --git a/pkg/R/TOXSWA_cwa.R b/pkg/R/TOXSWA_cwa.R index 5f32860..fd056b2 100644 --- a/pkg/R/TOXSWA_cwa.R +++ b/pkg/R/TOXSWA_cwa.R @@ -232,6 +232,12 @@ TOXSWA_cwa <- R6Class("TOXSWA_cwa", cwa_all_segments <- read_fwf(paste(cwa_lines, collapse = "\n"), fwf_empty(paste(tail(cwa_lines), collapse = "\n"))) + # Append time "-00h00" to datetime in first row, as this is not (always?) present + # in the line ConLiqWatLayCur + if (nchar(cwa_all_segments[1, "X2"]) == 11) { + cwa_all_segments[1, "X2"] = paste0(cwa_all_segments[1, "X2"], "-00h00") + } + available_segments = 1:(ncol(cwa_all_segments) - 3) if (segment == "last") segment = max(available_segments) if (!segment %in% available_segments) stop("Invalid segment specified") |