| Title: | ESA Miscellaneous Convenience Functions |
|---|---|
| Description: | Miscellaneous convenience functions used at ESA. |
| Authors: | Travis Hinkelman, Taylor Spaulding |
| Maintainer: | Travis Hinkelman <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.1.7 |
| Built: | 2026-06-03 11:02:45 UTC |
| Source: | https://github.com/EnvironmentalScienceAssociates/esaRmisc |
Calculate flow value that meet a vector of exceedance probabilities
exceedance_flow(flow, probs)exceedance_flow(flow, probs)
flow |
Flow time series |
probs |
Exceedance probabilities |
exceedance_flow(runif(30, 0, 10000), seq(0.1, 0.9, 0.1))exceedance_flow(runif(30, 0, 10000), seq(0.1, 0.9, 0.1))
Calculate exceedance probability for a flow time series
exceedance_prob(flow)exceedance_prob(flow)
flow |
Flow time series |
exceedance_prob(runif(30, 0, 10000))exceedance_prob(runif(30, 0, 10000))
Get water year classifications from water_year_type dataframe
get_water_year_type(water_year, valley = c("SAC", "SJR"))get_water_year_type(water_year, valley = c("SAC", "SJR"))
water_year |
numeric vector of water years |
valley |
Sacramento or San Joaquin valley (options: SAC or SJR) |
get_wy_type_table, water_year_type
get_water_year_type(1900:1906) get_water_year_type(1900:1906, "SJR") get_water_year_type(2014:2020)get_water_year_type(1900:1906) get_water_year_type(1900:1906, "SJR") get_water_year_type(2014:2020)
Get table of Water Year Hydrologic Classification Indices from CDEC.
get_wy_type_table()get_wy_type_table()
get_water_year_type, water_year_type
Split a file path copied from Windows File Explorer into parts for pasting into call to file.path(). Needs to be read from clipboard to escape the path separators.
split_egnyte_path()split_egnyte_path()
Get water year from date-time object. Warning: uses the system-specific time zone and not the time zone associated with the date-time object.
water_year(x)water_year(x)
x |
A date-time object. |
x <- c("2016-12-31", "2017-01-01", "2017-09-30", "2017-10-01") water_year(as.Date(x)) water_year(as.Date(x)) == format(as.Date(x), "%Y")x <- c("2016-12-31", "2017-01-01", "2017-09-30", "2017-10-01") water_year(as.Date(x)) water_year(as.Date(x)) == format(as.Date(x), "%Y")
Water year classifications for the Sacramento and San Joaquin valleys from CDEC.
water_year_typewater_year_type
A data frame with 4 columns:
1901-present
SAC or SJR
Water year classifications as abbreviations: C, D, BN, AN, W
Water year classifications: Critical, Dry, Below Normal, Above Normal, Wet.
Get date for day of water year
wy_date(x, y)wy_date(x, y)
x |
Day of water year |
y |
Water year |
wy_date(x = seq(1, 361, 60), y = 2011)wy_date(x = seq(1, 361, 60), y = 2011)
Get week in water year from a date-time object.
wy_week(x)wy_week(x)
x |
A date-time object. |
Returns the number of complete seven day periods that have occurred between the date and October 1st, plus one. Based on lubridate::week().
wy_week(as.Date(c("2016-10-01", "2017-01-01")))wy_week(as.Date(c("2016-10-01", "2017-01-01")))
Get day of water year from date-time object. Warning: uses the system-specific time zone and not the time zone associated with the date-time object.
wy_yday(x)wy_yday(x)
x |
A date-time object. |
wy_yday(as.Date(c("2016-01-01", "2016-10-01", "2017-01-01"))) wy_yday(as.Date(c("2016-03-01", "2017-03-01"))) # 2016 was a leap yearwy_yday(as.Date(c("2016-01-01", "2016-10-01", "2017-01-01"))) wy_yday(as.Date(c("2016-03-01", "2017-03-01"))) # 2016 was a leap year