flow {hydropeak}R Documentation

'flow' S3 Class for Flow Rate Time Series

Description

The function flow() creates a flow rate time series object which is formatted to be compatible with the functions in the hydropeak package.

Usage

flow(
  x,
  format = "%d.%m.%Y %H:%M",
  tz = "Etc/GMT-1",
  cols = c(1, 2, 3),
  steplength = 15,
  full = TRUE
)

validate_flow(x)

Arguments

x

Data frame which contains at least a column with an ID of the gauging station, a column with date-time values in character representation and a column with flow rates

format

Character string giving the date-time format of the date-time column in the input data frame (default: dd.mm.YYYY HH:MM)

tz

Character string specifying the time zone to be used for the conversion (default: Etc/GMT-1).

cols

Integer vector specifying column indices in the input data frame which contain gauging station ID, date-time and flow rate to be renamed. The default indices are 1 (ID), 2 (date-time) and 3 (flow rate, Q).

steplength

Numeric value which specifies the distance between (equispaced) time steps in minutes. (default: 15, which refers to 15 minutes). Non-equispaced time steps are not supported and missing time steps are imputed if argument full is set to TRUE (default), Q values are assumed to be NA.

full

A logical. If TRUE (default) imputes missing time step values so the time series is complete. Imputed Q values are set to NA. It should only be set to FALSE, if it is known, that the time series is complete.

Value

Returns a flow object which inherits from data frame (time series). It contains at least a gauging station ID column (ID) converted to character values, a date-time column (Time) converted to class "POSIXlt" (see base::strptime()) and a flow rate column (Q), which is converted to numeric values. The flow() object ensures that input flow fluctuation time series data can be processed with the functions in the hydropeak package. Therefore, it is mandatory to provide the correct indices (see argument cols) and the correct date-time format (see argument format) of the input data frame.

Examples

data(Q)
Q <- flow(Q)

[Package hydropeak version 0.1.2 Index]