calc_water_year: calc_water_year

Description Usage Arguments Details Value Examples

View source: R/calc_water_year.R

Description

Calculate the water year given a string of dates

Usage

1
calc_water_year(date.vec)

Arguments

date.vec

Vector with a string of dates

Details

Based on the USGS definition, a water year starts on October 1 of the year before, and ends on September 30. For example, water year 2015 started on 2014-10-01 and ended on 2015-09-30. See the USGS definition at https://water.usgs.gov/nwc/explain_data.html.

Value

Vector of the water year in which the given date occurs

Examples

1
2
mydates <- seq(as.POSIXct("2010-01-01"), as.POSIXct("2011-01-01"), by="day")
waterYear <- calc_water_year(date.vec = mydates)

USGS-R/trainR documentation built on May 6, 2019, 10:12 a.m.