nQy | R Documentation |
Calculates n-day rolling averages & minimum annual n-day averages, fits a probability distribution to minimum annual average flows, and calculates low flow statistics (nQy) for discharge data. See https://vt-hydroinformatics.github.io/lfas.html#fit-to-pearson-type-iii-distribution for information on the probability fitting approach used to calculate nQy in this function.
nQy(
data,
n = 7,
y = 10,
date_col = "Date",
q_col = "discharge_cfs",
min_days = 328,
plot_fit = TRUE
)
data |
Input data. A dataframe columns of daily discharge values and dates. |
n |
Numeric. Days for rolling time period averages. Default 7. |
y |
Numeric. Recurrence interval in years |
date_col |
Column name containing date values. Must be in standard "YYYY-MM-DD" date format. |
q_col |
Column name containing discharge values. Any appropriate and uniform discharge units are OK. The result will be in the same units as the input. |
min_days |
Minimum number of days required to include a year in the n-day annual minima. Recommend 328 for annual statistics and 82 for seasonal (~90%). |
Returns a list of results including the calculated nQy statistics (from fitted probability and 1/y percentile), a data frame of annual n-day flow minima and distribution information, and a plot to examine the fit.
# Basic usage
## Get data
library(dplyr)
gauge_data=dataRetrieval::readNWISdv(siteNumbers="10171000", startDate="2000-01-01", parameterCd="00060") %>% dplyr::rename(discharge_cfs=X_00060_00003)# Parameter code 00060 = discharge in cfs.
### Also try wqTools::findSites() to find other gauge locations.
## Run the function
JR_1700S_7Q10=nQy(data=gauge_data, n=7, y=10, date_col="Date", q_col="discharge_cfs")
JR_1700S_7Q10
## Other nQy types
JR1700S_1Q10=nQy(data=gauge_data, n=1, y=10, date_col="Date", q_col="discharge_cfs")
JR1700S_1Q10
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.