compute_frequency_quantile: Calculate an annual frequency analysis quantile

Description Usage Arguments Value See Also Examples

View source: R/compute_frequency_quantile.R

Description

Performs a volume frequency analysis on annual statistics from a daily streamflow data set and calculates a statistic based on the provided mean n-days and return period of the statistic, defaults to minimum flows. For example, to determine the 7Q10 of a data set, set the roll_days to 7 and the return_period to 10. Function will calculate using all values in 'Values' column (no grouped analysis), unless specified. Analysis methodology replicates that from HEC-SSP. Returns a tibble with statistics.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
compute_frequency_quantile(
  data,
  dates = Date,
  values = Value,
  station_number,
  roll_days = NA,
  roll_align = "right",
  return_period = NA,
  use_max = FALSE,
  use_log = FALSE,
  fit_distr = c("PIII", "weibull"),
  fit_distr_method = ifelse(fit_distr == "PIII", "MOM", "MLE"),
  water_year_start = 1,
  start_year,
  end_year,
  exclude_years,
  months = 1:12,
  ignore_missing = FALSE,
  allowed_missing = ifelse(ignore_missing, 100, 0)
)

Arguments

data

A data frame of data that contains columns of events, flow values, and measures (data type).

dates

Name of column in data that contains dates formatted YYYY-MM-DD. Only required if dates column name is not 'Date' (default). Leave blank or set to NULL if using station_number argument.

values

Column in data that contains numeric flow values, in units of cubic metres per second. Default 'Value'.

station_number

Character string vector of seven digit Water Survey of Canada station numbers (e.g. "08NM116") of which to extract daily streamflow data from a HYDAT database. Requires tidyhydat package and a HYDAT database. Leave blank if using data argument.

roll_days

Numeric value of the number of days to apply a rolling mean. Required.

roll_align

Character string identifying the direction of the rolling mean from the specified date, either by the first ('left'), last ('right'), or middle ('center') day of the rolling n-day group of observations. Default 'right'.

return_period

Numeric vector of the estimated time interval, in years, between flow events of a similar size, inverse of probability, used to estimate the frequency statistic. Required.

use_max

Logical value to indicate using maximums rather than the minimums for analysis. Default FALSE.

use_log

Logical value to indicate log-scale transforming of flow data before analysis. Default FALSE.

fit_distr

Character string identifying the distribution to fit annual data, one of 'PIII' (Log Pearson Type III) or 'weibull' (Weibull) distributions. Default 'PIII'.

fit_distr_method

Character string identifying the method used to fit the distribution, one of 'MOM' (method of moments) or 'MLE' (maximum likelihood estimation). Selected as 'MOM' if fit_distr ='PIII' (default) or 'MLE' if fit_distr = 'weibull'.

water_year_start

Numeric value indicating the month (1 through 12) of the start of water year for analysis. Default 1.

start_year

Numeric value of the first year to consider for analysis. Leave blank or set well before start date (i.e. 1800) to use from the first year of the source data.

end_year

Numeric value of the last year to consider for analysis. Leave blank or set well after end date (i.e. 2100) to use up to the last year of the source data.

exclude_years

Numeric vector of years to exclude from analysis. Leave blank or set to NULL to include all years.

months

Numeric vector of months to include in analysis. For example, 3 for March, 6:8 for Jun-Aug or c(10:12,1) for first four months (Oct-Jan) when water_year_start = 10 (Oct). Default summarizes all months (1:12).

ignore_missing

Logical value indicating whether dates with missing values should be included in the calculation. If TRUE then a statistic will be calculated regardless of missing dates. If FALSE then only those statistics from time periods with no missing dates will be returned. Default FALSE.

allowed_missing

Numeric value between 0 and 100 indicating the percentage of missing dates allowed to be included to calculate a statistic (0 to 100 percent). If 'ignore_missing = FALSE' then it defaults to 0 (zero missing dates allowed), if 'ignore_missing = TRUE' then it defaults to 100 (any missing dates allowed); consistent with ignore_missing usage. Supersedes ignore_missing when used.

Value

A numeric value of the frequency analysis quantile, given the roll_days and return_period.

See Also

compute_frequency_analysis

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
## Not run: 

# Working example:

# Compute the annual 7-day flow value with a 1 in 10 year return interval
compute_frequency_quantile(station_number = "08NM116",
                           roll_days = 7,
                           return_period = 10)
                            

## End(Not run)

fasstr documentation built on Dec. 11, 2021, 9:55 a.m.