Python版的ArcGIS栅格计算器模板

import arcpy
from arcpy.sa import *
arcpy.CheckOutExtension("spatial")
arcpy.gp.overwriteOutput=1

#custom
arcpy.env.workspace="G:\\Phenology of 30 Years\\GIMMS 3g\\15Length\\1Length\\"
#custom
outpath="G:\\Phenology of 30 Years\\GIMMS 3g\\15Length\\2mean_len\\"
#custom
outfilename="mean";n=30;

Sum=0

files=arcpy.ListRasters()

for file in files:
    Sum=Sum+Raster(file)
(Sum/n).save(outpath+outfilename)

print("Done,please close")
说明:

(1)带#号的为需要改动的地方

(2)本例实现求平均


你可能感兴趣的:(Python版的ArcGIS栅格计算器模板)