Re: [R-sig-Geo] How to perform cross-year date operations on rasters?

2015-11-06 Thread Dutrieux, Loic
Hi Thiago, Building on Michael's answer and your example, I think the following should work. The tricky part is to build the right by= argument for zApply(). You can see zApply as a wrapper of aggregate.zoo() for temporal raster bricks, and you're more likely to find answers for aggregate.zoo

Re: [R-sig-Geo] How to perform cross-year date operations on rasters?

2015-11-05 Thread Dominik Schneider
Could you use water years for your dates? so Oct-Sep is the same year and then subset based on month and water year. On Thu, Nov 5, 2015 at 11:17 AM, Thiago V. dos Santos < thi_vel...@yahoo.com.br> wrote: > Thanks for your input Michael. With slight modifications on your > suggestion, I almost

Re: [R-sig-Geo] How to perform cross-year date operations on rasters?

2015-11-05 Thread Thiago V. dos Santos
Thanks for your input Michael. With slight modifications on your suggestion, I almost got there: library(raster) library(zoo) # Create a rasterStack similar to cmip5 - same dimensions and layer names r <- raster(ncol=180, nrow=90) s <- stack(lapply(1:1825, function(x) setValues(r,

Re: [R-sig-Geo] How to perform cross-year date operations on rasters?

2015-11-04 Thread Michael Sumner
On Thu, 5 Nov 2015 at 09:38 Thiago V. dos Santos wrote: > Dear all, > > Consider that I have a raster stack with daily values. How can I perform > date operations covering a time interval that crosses years? > > For example, I want to sum the values from every