Get the water year from a year-month (yearmon) value
Get the water year from a year-month (yearmon) value
ym_get_wateryear() returns the water year (assumed to be October - September) from a zoo::yearmon object.
ym_get_wateryear(ym)getWYFromYearmon(ym)
Arguments
ym: An object of class zoo::yearmon , or something that can be successfully converted to zoo::yearmon .
Returns
The water year as a numeric.
Details
If the argument is not already a yearmon object, it will attempt to convert it to a zoo::yearmon . This may result in unexpected results. For example, the string "12-1-1906" can be converted to a zoo::yearmon , however, it will not convert to "Dec 1906" as you might desire. It will convert to "Jan 0012" since it is not a format expected by zoo::as.yearmon(). Therefore, a warning is posted when the function attempts to convert to zoo::yearmon , and it is safer to ensure ym is already a zoo::yearmon .