find_droughts: Identifying Low Flow Periods

View source: R/pooling.R

find_droughtsR Documentation

Identifying Low Flow Periods

Description

A streamflow deficit is defined as an event where discharges are below a given threshold.

Usage

find_droughts(x, threshold = vary_threshold, varying = "constant", interval = "day", ...)

Arguments

x

an object which can be coerced to class 'xts'. Either with a single column or with a column named 'discharge'. Units of 'x' are retrieved from the attributes. If it fails, an error is raised.

threshold

The threshold can either be a constant value, a time series with the same length as x or a function (taking a single argument) returning either of these. Furthermore threshold can be a character vector of length one specifying a quantile of x like threshold = 'Q80' as a shortcut of threshold = function(x) quantile(x, 0.2, na.rm = TRUE). See vary_threshold for varying a threshold in time.

varying

if varying is a character vector of length one, values of "constant", "daily", "weekly" and "monthly" are allowed. If a vector of class POSIX is provided, a seasonal varying threshold is computed, where the times provided define the start of the season. Only the day of the year is taken, the year itself doesn't have a meaning.

interval

A character string, containing one of "day", "week", "month", "quarter" or "year" as accepted by seq.Date.

...

if threshold is a function, these additional arguments are passed on to the function

Value

an object of class 'deficit', which is basically an 'xts' object with the columns

discharge

discharges as provided with x

threshold

the threshold

def.increase

The increase of the deficit volume in m^3 per day.

event.no

an event id. If an event is numbered "0" this period not considered as a streamflow deficit.

See Also

There are summary and plot methods, see summary.deficit and plot.deficit.

pooling, summary.deficit, plot.deficit

Examples

data(ray)
ray <- as.xts(ray)["1970::1979", ]
r <- find_droughts(ray)
head(r)
summary(r)


plot(r)


# threshold is to low, because there are many days with
# zero flow observations
# provide threshold as a constant value
r <- find_droughts(ray, threshold = 0.02)
head(r)
summary(r)

plot(r)



# provide threshold as a function
r <- find_droughts(ray,
                   threshold = function(x) quantile(x, 0.2, na.rm = TRUE))
head(r)
summary(r)

lfstat documentation built on Nov. 10, 2022, 5:42 p.m.