AnsweredAssumed Answered

Monthly Averages for 30 yr dataset

Question asked by sesmith926 on Jun 19, 2014
Latest reply on Jun 19, 2014 by sesmith926
Morning, I've been digging through the forum for a few days to find a script that could help me. I've currently found:

import arcpy arcpy.CheckOutExtension("spatial") arcpy.env.workspace = "F:\\ECV\\netCDFtoRaster" arcpy.env.overwriteOutput = True   for year in range(1990,2010):  # 1990 through 2010     for month in range(13):      # 1 to 12         # wildcard - "ECV_SM_MERG_{1:02d}*.TIF" (format month 1 -> "01")         wild = "ECV_SM_MERG_{1:02d}*.TIF".format(year, month)          rasters = arcpy.ListRasters(wild) # list all rasters for a month         output = "F:\\ECV\\Month_"+str(month)+"_"+str(year)+".tif"     for raster in rasters: # Process: Cell Statistics         print (rasters), output, "MEAN", "DATA") 

However when I run this, it will only iterate through the 12th month - it will not do the others. How can I make it so the code will iterate through December of all the years, then January, February, and so on?

Any thoughts would be helpful! Thanks!