0%
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
| import arcpy from arcpy import env from arcpy.sa import *
arcpy.CheckOutExtension("spatial") env.overwriteOutput= 1
def getSumOfRasters(rasterPath,resultSavePath): arcpy.env.workspace = rasterPath rasterlist = arcpy.ListRasters("*", "TIF") baseraster=rasterlist[0] baseraster2= Con(IsNull(baseraster),0,0) for raster in rasterlist: baseraster2 = baseraster2 + raster baseraster2.save(resultSavePath) print "finish!"
def getMeanOfRasters(rasterPath,resultSavePath): arcpy.env.workspace = rasterPath rasterlist = arcpy.ListRasters("*", "TIF") baseraster=rasterlist[0] baseraster2= Con(IsNull(baseraster),0,0) for raster in rasterlist: baseraster2 = baseraster2 + raster meanraster=baseraster2/len(rasterlist) meanraster.save(resultSavePath) print "finish!"
|