
Build a stress-test series by ordering whole years
Source:R/analysis-scenarios.R
rh_scenarios_from_years.RdReorders the years of a precipitation series by their annual total to create increasing (dry to wet) or decreasing (wet to dry) sequences, useful to stress-test a system against runs of dry years. Note: partial boundary years (a series starting or ending mid-year) are included as-is, so their totals reflect only the observed days; trim the series to whole years first if that matters for the ordering.
Usage
rh_scenarios_from_years(
data,
order = c("increasing", "decreasing", "asis"),
value_col = "value",
date_col = "date"
)Value
A data frame with columns step, year, date, value (years
concatenated in the requested order). Feed precip = result$value to
rh_simulate().
Examples
s <- rh_scenarios_from_years(precip_pi, order = "increasing")
head(s)
#> step year date value
#> 1 1 1919 1919-01-01 0.0
#> 2 2 1919 1919-01-02 8.2
#> 3 3 1919 1919-01-03 0.0
#> 4 4 1919 1919-01-04 0.0
#> 5 5 1919 1919-01-05 0.0
#> 6 6 1919 1919-01-06 0.0