From 4284c57c7d53a9aef0c917a050ccf2ab779cfce3 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 +++++--- pkg/man/read.TOXSWA_cwa.Rd | 4 +++- 2 files changed, 8 insertions(+), 4 deletions(-) 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"))) diff --git a/pkg/man/read.TOXSWA_cwa.Rd b/pkg/man/read.TOXSWA_cwa.Rd index 44a7542..aca2a56 100644 --- a/pkg/man/read.TOXSWA_cwa.Rd +++ b/pkg/man/read.TOXSWA_cwa.Rd @@ -35,7 +35,9 @@ An instance of an R6 object of class \description{ 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). } \examples{ H_sw_D4_pond <- read.TOXSWA_cwa("00001p_pa.cwa", -- cgit v1.2.1