aboutsummaryrefslogtreecommitdiff
path: root/pkg/R/TOXSWA_cwa.R
diff options
context:
space:
mode:
authorJohannes Ranke <jranke@uni-bremen.de>2016-07-15 15:05:22 +0200
committerJohannes Ranke <jranke@uni-bremen.de>2016-07-15 15:07:29 +0200
commitd6b230cd1b415a112009227bc9e0ff50316c42f7 (patch)
treeb1f5b5bf09388a35b24c2f5e6da1357694a84c62 /pkg/R/TOXSWA_cwa.R
parentb45c9bfae9e5578dd455ed417363b4996cffd46a (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
Diffstat (limited to 'pkg/R/TOXSWA_cwa.R')
-rw-r--r--pkg/R/TOXSWA_cwa.R6
1 files changed, 6 insertions, 0 deletions
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")

Contact - Imprint