A wrapper function for preproc_precondition_data,
preproc_audit_data, and
calc_annual_flow_stats
preproc_main(
data = NULL,
Date,
value,
date_format = "%Y-%m-%d",
year_group = c("WY", "CY", "year"),
use_specific_years = FALSE,
begin_year = NULL,
end_year = NULL,
days_cutoff = 360,
calc_high = TRUE,
calc_low = TRUE,
calc_percentiles = TRUE,
calc_monthly = TRUE,
calc_WSCVD = TRUE,
longitude = NA,
calc_ICVD = FALSE,
zero_threshold = 33,
quantile_type = 8,
na.action = c("na.omit", "na.pass")
)A list of three data.frames: 1 of preconditioned data, 1 data audit, and 1 annual statistics.
'data.frame'. Optional data.frame input, with columns containing Date and value.
Column names are specified as strings in the corresponding parameter. Default is NULL.
'Date' or 'character' vector when data = NULL, or 'character' string identifying
Date column name when data is specified. Dates associated with each value in value
parameter.
'numeric' vector when data = NULL, or 'character' string identifying year column
name when data is specified. Values to precondition and calculate n-day moving averages
from. N-day moving averages only calculated for daily data.
'character' string. Format of Date. Default is "%Y-%m-%d".
'character' value. Specify either "year" for calendar year, "WY" for water
year, or "CY" for climate year. Used to select data after preconditioning for audit and
annual statistics. Default is "WY".
'boolean' value. Flag to clip data to a certain set of years in
year_group. Default is FALSE.
'numeric' value. If use_specific_years = TRUE, beginning year to clip
value. Default is NULL.
'numeric' value. If use_specific_years = TRUE, ending year to clip value.
Default is NULL.
'numeric' value. Designating the number of days required for a year to be
counted as full. Default is 360.
'boolean' value. Calculate high streamflow statistics for years in year_group.
Default is TRUE. See Details for more information.
'boolean' value. Calculate low streamflow statistics for years in year_group.
Default is TRUE. See Details for more information.
'boolean' value. Calculate percentiles for years in year_group.
Default is TRUE. See Details for more information.
'boolean' value. Calculate monthly statistics for years in year_group.
Default is TRUE. See Details for more information.
'boolean' value. Calculate winter-spring center volume date for years in
year_group. Default is TRUE. See Details for more information.
'numeric' value. Site longitude in NAD83, required in WSCVD calculation.
Default is NA. See Details for more information.
'boolean' value. Calculate inverse center volume date for years in
year_group. Default is FALSE. See Details for more information.
'numeric' value as percentage. The percentage of years of a statistic that
need to be zero in order for it to be deemed a zero streamflow site for that statistic. For
use in trend calculation. See Details on attributes. Default is 33 (33 percent) of
the annual statistic values.
'numeric' value. The distribution type used in the stats::quantile
function. Default is 8 (median-unbiased regardless of distribution). Other
types common in hydrology are 6 (Weibull) or 9 (unbiased for normal distributions).
'character' string indicating na.action passed to stats::aggregate
na.action parameter. Default is "na.omit", which removes NA values before aggregating
statistics, or "na.pass", which will pass NA values and return NA in the grouped
calculation if any NA values are present.
This is a wrapper function of preproc_precondition_data, preproc_audit_data, and
calc_annual_flow_stats. Data are first passed to the precondition function, then audited,
then annual statistics are computed.
It also checks the timestep of the data to make sure that it is daily timestep.
Other time steps are currently not supported and will return the data.frame without moving
averages computed.
preproc_audit_data, preproc_precondition_data,
calc_annual_flow_stats
preproc_main(data = example_obs, Date = "Date", value = "streamflow_cfs", longitude = -68)
Run the code above in your browser using DataLab