From d6b230cd1b415a112009227bc9e0ff50316c42f7 Mon Sep 17 00:00:00 2001 From: Johannes Ranke Date: Fri, 15 Jul 2016 15:05:22 +0200 Subject: 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 --- pkg/DESCRIPTION | 4 ++-- 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") -- cgit v1.2.1