Returns the indices of the provided time series for the start/end of the water year. The month/day of the water year defaults to September 30 for an October 1 water year cycle. However, this may be supplied as other values, for example as June 30th for a July 1 water year (i.e. the Australian water year). This function is useful in supplying endpoints for water year evaluations.

rvn_wyear_indices(x, mm = 9, dd = 30)

Arguments

x

xts object or Date/POSITXtc series to obtain indices for

mm

month of water year (default 9)

dd

day of water year (default 30)

Value

ep

array of indices corresponding to start/end of water years

Details

Emulates the endpoints function for a water year period. The first and last points are included in all supplied endpoints, which may introduce partial periods to the analysis.#'

See also

rvn_apply_wyearly to apply functions over the water year endpoints workhorse function for generating endpoints in xts for other periods

Examples


# read in sample forcings data
data(rvn_forcing_data)

# get the indices of the water year for October 1 (the default)
rvn_wyear_indices(rvn_forcing_data$forcings)
#> [1]   0 365 731
rvn_wyear_indices(rvn_forcing_data$forcings) %>%
rvn_forcing_data$forcings[., 1:2]
#>                     day_angle     rain
#> 2003-09-30 04:00:00   4.67366 0.291778
#> 2004-09-30 04:00:00   4.67805 0.000000

# get the indices of the start of the water year for July 1
## note that the last period is the last index, and not a complete water year period
rvn_wyear_indices(rvn_forcing_data$forcings, mm=6, dd=30) %>%
rvn_forcing_data$forcings[., 1:2]
#>                     day_angle    rain
#> 2003-06-30 04:00:00   3.08995 2.10339
#> 2004-06-30 04:00:00   3.09867 0.00000
#> 2004-09-30 04:00:00   4.67805 0.00000