From 234a20018fe9fe9824bcfaae2c391e59d09f9871 Mon Sep 17 00:00:00 2001 From: Johannes Ranke Date: Wed, 8 Jun 2016 08:29:39 +0200 Subject: Use the concentration at the end of the hour This is also what TOXSWA presents in the summary files --- pkg/R/TOXSWA_cwa.R | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'pkg/R/TOXSWA_cwa.R') diff --git a/pkg/R/TOXSWA_cwa.R b/pkg/R/TOXSWA_cwa.R index d2720a9..5f32860 100644 --- a/pkg/R/TOXSWA_cwa.R +++ b/pkg/R/TOXSWA_cwa.R @@ -1,4 +1,4 @@ -# Copyright (C) 2014,2015 Johannes Ranke +# Copyright (C) 2014,2015,2016 Johannes Ranke # Contact: jranke@uni-bremen.de # This file is part of the R package pfm @@ -19,7 +19,9 @@ #' #' Read TOXSWA hourly concentrations of a chemical substance in a specific #' segment of a TOXSWA surface water body. Per default, the data for the last -#' segment are imported. +#' segment are imported. As TOXSWA reports the values at the end of the hour +#' (ConLiqWatLayCur) in its summary file, we use this value as well instead +#' of the hourly averages (ConLiqWatLay). #' #' @param filename The filename of the cwa file (TOXSWA 2.x.y or similar) or the #' out file (FOCUS TOXSWA 4, i.e. TOXSWA 4.4.2 or similar). @@ -225,7 +227,7 @@ TOXSWA_cwa <- R6Class("TOXSWA_cwa", if (inherits(outfile, "try-error")) { stop("Could not read ", filename) } else { - cwa_lines <- outfile[grep("ConLiqWatLay_", outfile)] # hourly concentrations + cwa_lines <- outfile[grep("ConLiqWatLayCur_", outfile)] # concentrations at end of hour cwa_all_segments <- read_fwf(paste(cwa_lines, collapse = "\n"), fwf_empty(paste(tail(cwa_lines), collapse = "\n"))) -- cgit v1.2.1