I have downloaded the netcdf files of climate water deficit (def) from TerraClimate, years 1981-2010. Each raster is a monthly def for my region of interest, that being entire India.
I created a stack of 12 rasters, which is a stack of monthly def for year 1981 only and want to find the moving/rolling max value, considering a window of 3 months. I have a very straightforward single line of code-
trial<-calc(rasterstack, funtion (x) movingFun(x,3,max, circular=FALSE, na.rm=TRUE, type='around')
It works and everything. However, I do not understand how are there 12 rasters, when there should be only 10 rasters i.e. no rolling max values for 1st month Jan 1981 and last month dec 1981, since I speciefied circular=FALSE and 'around'.
Why are there 12 rasters instead of 10? Any other ways to calcualte moving/rolling max values?