get_events_file {hydropeak}R Documentation

Flow Fluctuation Events and Metrics from Input File

Description

Given a file path it reads a data frame (time series) of stage measurements and calls get_events(). The resulting events can be optionally written to a single file or to separate files for each gauging station ID (ID) and Event_Type. Files which produce errors return NULL.

Usage

get_events_file(
  Q_file,
  inputsep = ";",
  inputdec = ".",
  save = FALSE,
  split = TRUE,
  outdir = file.path(tempdir(), "Events"),
  mc.cores = 2L,
  return = TRUE,
  ...
)

Arguments

Q_file

A character string containing the name of the file which the data are to be read from with utils::read.csv().

inputsep

Field separator character string for input data.

inputdec

Character string for decimal points in input data.

save

A logical. If FALSE (default) events (results from get_events()) are not written to file(s), otherwise events are written to outdir.

split

A logical. If TRUE (default) output files are separated by their gauging station ID (ID) and by Event_Type, otherwise all events are written to a single file.

outdir

A character string naming a directory where the output file(s) should be written to.

mc.cores

Number of cores to use with parallel::mclapply(). On Windows, this will be set to 1.

return

A logical. If TRUE (default) it returns the resulting data frame or list of data frames. Otherwise it returns NULL.

...

Arguments to be passed to get_events() and further to flow().

Value

A data frame which contains for every increase or decrease event in a given time series all metrics (all_metrics()), gauging station ID, event type, and starting time of an event. Included metrics are amp(), mafr(), mefr(), dur(), ratio(). The returned data frame is not split. Returns NULL, if argument return is set to FALSE.

Examples

Q_file <- system.file("extdata", "Q.csv", package = "hydropeak")
# save to tempdir()
events <- get_events_file(Q_file, inputsep = ",", inputdec = ".",
save = TRUE, split = TRUE, return = TRUE)

[Package hydropeak version 0.1.2 Index]