baseDur: Daily Value Durations

View source: R/baseDur.R

baseDurR Documentation

Daily Value Durations

Description

Identify and compute durations for baseflow or other flow conditions.

Usage

baseDur(x, Dates, Start = NULL, End = NULL, base = quantile(x, probs =
  0.1, na.rm = TRUE), test = "<=", STAID = "")

Arguments

x

the daily value data to be summarized. Missing values are permitted, but are treated as gaps—durations are reset.

Dates

the date for each x, should be of class "Date." Missing values are not permitted.

Start

the start date for the analysis, can be either a character string or class "Date."

End

the end date for the analysis, can be either a character string or class "Date."

base

the base or threshold value for the test.

test

a character string indicating the comparison between x and base. Should be one of "<=," "<," ">=," or ">."

STAID

the station identifier for the data.

Value

A data.frame containing the STAID, the date on which the duration started, the length of the duration period, and the minimum or maximum, depending on the test, during the period of the duration.

Examples


## Not run: 
# Get daily flow values for 05078470 for 2003
library(smwrData)
data(Q05078470)
# When are 0 flows?
with(Q05078470, baseDur(FLOW, DATES, base=0, STAID="05078470"))
# Peak flows?
with(Q05078470, baseDur(FLOW, DATES, base=3, test=">=", 
STAID="05078470"))

## End(Not run)

USGS-R/DVstats documentation built on Oct. 11, 2022, 6:03 a.m.