Skip to contents

upstream or downstream "timeshift" of water quality data given time-series of hydraulic and water quality data in one data frame

Usage

hsTimeshift(
  hq,
  threshold,
  upstream = TRUE,
  tsField = names(hq)[1],
  valField = names(hq)[2],
  quaFields = names(hq)[-c(1, 2)],
  maxTDiff = 3600,
  valFactor = 1,
  dbg = FALSE
)

Arguments

hq

hydraulic and water quality data in one data frame

threshold

Threshold that shall be reached/exceeded by the sum of successive values in column valField of which the maximum time difference is below or equal maxTDiff.

upstream

if TRUE, the algorithm “looks” upstream, else downstream

tsField

name of timestamp field in hq

valField

name of column in hq containing the values to be summed up until the threshold is reached

quaFields

vector containing column names of water quality parameters, e.g. c("AFS", "CSB", "CSBf")

maxTDiff

Maximum allowed time difference in seconds between two related timestamps.

valFactor

factor to be applied to column valField before calculating value sums.

dbg

If TRUE, debug messages are shown