time2season: Date/DateTime character -> Seasonal character

Description Usage Arguments Value Note Author(s) See Also Examples

View source: R/time2season.R

Description

This function transforms a character vector of Dates or DateTimes into a character vector of seasons (summer, winter, autumn, spring), depending on the value of type:

When type=default -) winter = DJF: December, January, February
-) spring = MAM: March, April, May
-) summer = JJA: June, July, August
-) autumn = SON: September, October, November

When type=FrenchPolynesia -) winter = DJFM: December, January, February, March
-) spring = AM : April, May
-) summer = JJAS: June, July, August, September
-) autumn = ON : October, November

Usage

1
time2season(x, out.fmt = "months", type="default")

Arguments

x

vector with the dates that have to be transformed. class(x) must be Date

out.fmt

character, indicating the format of the output seasons. Possible values are:
-) seasons => c("winter", "spring", "summer", autumn")
-) months => c("DJF", "MAM", "JJA", SON") or c("DJFM", "AM", "JJAS", ON")

type

character, indicating which weather seasons will be used for computing the output. Possible values are:
-) default => "winter"= Dec, Jan, Feb; "spring"= Mar, Apr, May; "summer"=Jun, Jul, Aug; "autumn"= Sep, Oct, Nov
-) FrenchPolynesia => "winter"= Dec, Jan, Feb, Mar; "spring"= Apr, May; "summer"=Jun, Jul, Aug, Sep; "autumn"= Oct, Nov

Value

character vector with the weather season to which each date in x belongs

Note

Weather seasons corresponding to French Polynesia were defined following a comment from Lydie Sichoix

Author(s)

Mauricio Zambrano-Bigiarini, mzb.devel@gmail

See Also

dm2seasonal, seasonalfunction, extract, dip, mip

Examples

1
2
3
4
5
6
7
8
## Sequence of daily dates between "1961-01-01" and "1961-12-31"
t <- dip("1961-01-01", "1961-12-31")
time2season(t)

## Sequence of monthly dates between "1961-01-01" and "1961-12-31"
t <- mip("1961-01-01", "1961-12-31")
time2season(t)
time2season(t, out.fmt="seasons")

hydroTSM documentation built on March 13, 2020, 2:23 a.m.