Package 'esaRmisc'

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.6
Built: 2025-02-22 04:54:29 UTC
Source: https://github.com/EnvironmentalScienceAssociates/esaRmisc

Help Index


Exceedance Flow

Description

Calculate flow value that meet a vector of exceedance probabilities

Usage

exceedance_flow(flow, probs)

Arguments

flow

Flow time series

probs

Exceedance probabilities

Examples

exceedance_flow(runif(30, 0, 10000), seq(0.1, 0.9, 0.1))

Exceedance Probability

Description

Calculate exceedance probability for a flow time series

Usage

exceedance_prob(flow)

Arguments

flow

Flow time series

Examples

exceedance_prob(runif(30, 0, 10000))

Water year classifications

Description

Get water year classifications from water_year_type dataframe

Usage

get_water_year_type(water_year, valley = c("SAC", "SJR"))

Arguments

water_year

numeric vector of water years

valley

Sacramento or San Joaquin valley (options: SAC or SJR)

See Also

get_wy_type_table, water_year_type

Examples

get_water_year_type(1900:1906)
get_water_year_type(1900:1906, "SJR")
get_water_year_type(2014:2020)

Water year classifications

Description

Get table of Water Year Hydrologic Classification Indices from CDEC.

Usage

get_wy_type_table()

See Also

get_water_year_type, water_year_type


Water year

Description

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.

Usage

water_year(x)

Arguments

x

A date-time object.

Examples

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 type

Description

Water year classifications for the Sacramento and San Joaquin valleys from CDEC.

Usage

water_year_type

Format

A data frame with 4 columns:

WaterYear

1901-present

Valley

SAC or SJR

WYT

Water year classifications as abbreviations: C, D, BN, AN, W

WaterYearType

Water year classifications: Critical, Dry, Below Normal, Above Normal, Wet.


Water year date

Description

Get date for day of water year

Usage

wy_date(x, y)

Arguments

x

Day of water year

y

Water year

Examples

wy_date(x = seq(1, 361, 60), y = 2011)

Water year week

Description

Get week in water year from a date-time object.

Usage

wy_week(x)

Arguments

x

A date-time object.

Details

Returns the number of complete seven day periods that have occurred between the date and October 1st, plus one. Based on lubridate::week().

Examples

wy_week(as.Date(c("2016-10-01", "2017-01-01")))

Day of water year

Description

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.

Usage

wy_yday(x)

Arguments

x

A date-time object.

Examples

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 year