get_lag_file | R Documentation |
Given a file path it reads a data frame (time series)
of measurements which combines several gauging station ID's and calls
get_lag()
. The relation (ID's) of
gauging stations is read from a file (provided through the file path).
The file with Q
data and the relation file need to
have the same separator (inputsep
) and character for
decimal points (inputdec
). Gauging station ID's have to
be in order of their location in downstream direction. The
resulting lag is appended to the relation file. This can be
saved to a file.
get_lag_file( Q_file, relation_file, steplength = 15, lag.max = 20, na.action = na.pass, tz = "Etc/GMT-1", format = "%Y.%m.%d %H:%M", cols = c(1, 2, 3), inputsep = ";", inputdec = ".", save = FALSE, outfile = file.path(tempdir(), "relation.csv"), mc.cores = getOption("mc.cores", 2L), overwrite = FALSE )
Q_file |
Data frame or character string. If it is a data
frame, it corresponds to the |
relation_file |
A character string containing the path to the
relation file. It is read within the function with
|
steplength |
Numeric value that specifies the length between
time steps in minutes (default: |
lag.max |
Maximum lag at which to calculate the ccf in
|
na.action |
Function to be called to handle missing values in
|
tz |
Character string specifying the time zone to be used for
internal conversion (default: |
format |
Character string giving the date-time format of the
date-time column in the input data frame |
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). |
inputsep |
Character string for the field separator in input data. |
inputdec |
Character string for decimal points in input data. |
save |
A logical. If |
outfile |
A character string naming a file path and name where the output file should be written to. |
mc.cores |
Number of cores to use with
|
overwrite |
A logical. If |
Returns invisibly the data frame of the relation data with
the estimated cumulative lag between neighboring gauging
stations in the format HH:MM
appended.
Q_file <- system.file("testdata", "Q.csv", package = "hydroroute") relation_file <- system.file("testdata", "relation.csv", package = "hydroroute") get_lag_file(Q_file, relation_file, inputsep = ",", inputdec = ".", format = "%Y-%m-%d %H:%M", save = FALSE, overwrite = TRUE) Q_file <- read.csv(Q_file) get_lag_file(Q_file, relation_file, inputsep = ",", inputdec = ".", format = "%Y-%m-%d %H:%M", save = FALSE, overwrite = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.