AnsweredAssumed Answered

Looping over the list of rasters

Question asked by lpalao on Sep 14, 2014
Latest reply on Sep 16, 2014 by lpalao

Hi GeoNet community,


I have a little bit of problem in my code. I have a raster list from 0-365 representing day of year (doy1-doy366). I would like to calculate the mean of my rasters using the last three rasters (these are raster364, raster365, raster366, which are indexed as 363,364,365) and the first three rasters of my list (raster1, raster2, and raster3, which are indexed as 0, 1, 2).


this is my initial code:


rasters = arcpy.ListRasters("*", "tif")
last3 = range(363,366)
first3 = range(0,3)

lastdek = (last5, first1)

lastDekad = []

# process only the 6 rasters - last and first three rasters
for l in range(0,7):
    print l
    dek37 = CellStatistics(lastDekad, "MEAN", "NODATA")
    output = 'E:/Test/Temp/tmax_dek_037.tif'


Any help is much appreciated.


Hope my query is clear.