[R-sig-Geo] How to calculate climatology in rasterbricks
Thiago V. dos Santos
thi_veloso at yahoo.com.br
Thu Jun 2 22:30:48 CEST 2016
Dear all,
I am working with daily time series of meteorological variables. This is an example of the dataset:
library(raster)
# Create date sequence
idx <- seq(as.Date("1961/1/1"), as.Date("1990/12/31"), by = "day")
# Create raster stack and assign dates
r <- raster(ncol=20, nrow=20)
s <- stack(lapply(1:length(idx), function(x) setValues(r, runif(ncell(r)))))
s <- setZ(s, idx)
Now, let's assume those values represent daily precipitation. What I need to do is to integrate daily to monthly values,
and then take a monthly climatology. Climatology in this case means multi-year average of selected months, e.g., an average of the 30 Octobers from 1961 to 1990, an average of the 30 Novembers from 1961 to 1990 and etc.
On the other hand, let's assume the raster values represent daily temperature. Integrating daily to monthly temperature doesn't make sense. Hence, instead of integrating daily values, I need to take monthly means (e.g. mean value of all days in every month), and then calculate the climatology.
What would be the best approach to achieve that using the raster package?
Greetings,
-- Thiago V. dos Santos
PhD student
Land and Atmospheric Science
University of Minnesota
More information about the R-sig-Geo
mailing list