Computes six quarterly/seasonal variables for an arbitrary set of months.
Usage
quarterly_variables(tas, tasmax, tasmin, pr, months, na.rm = FALSE, ...)
# Default S3 method
quarterly_variables(tas, tasmax, tasmin, pr, months, na.rm = FALSE, ...)Arguments
- tas
Numeric vector (length 12), matrix (pixels x 12), SpatRaster with 12 layers, or BioclimData.
- tasmax
Same form as
tas: monthly maximum temperature.- tasmin
Same form as
tas: monthly minimum temperature.- pr
Same form as
tas: monthly precipitation.- months
Integer vector of 1-based month indices to include (e.g.
c(1, 2, 3)for a fixed quarter, orc(12, 1, 2)for DJF).- na.rm
Logical. If
FALSE(default), a singleNAamong the selected months makes all outputsNAfor that pixel. IfTRUE, missing months are skipped.- ...
Not currently used.
Value
Vector input: a named numeric vector of length 6.
Matrix / BioclimData input: a numeric matrix (pixels x 6) with columns
tmean_s,tmax_max,tmin_min,trange,pr_tot,pr_cv.SpatRaster input: a 6-layer SpatRaster with the same geometry and the same names.
Details
The output variables are:
tmean_s— meantasover the selected months.tmax_max— maximum monthlytasmaxamong the selected months.tmin_min— minimum monthlytasminamong the selected months.trange—tmax_max - tmin_min.pr_tot— totalprover the selected months.pr_cv— coefficient of variation of monthlypr(100 * sd_pop / mean), matching the BIO15 scaling.
Use quarterly_fixed() for the four standard fixed quarters and
quarterly_rolling() for rolling 3-month windows.