ArcGIS python计算长时间序列多个栅格数据的平均值

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")

python求均值代码

你可能感兴趣的:(ArcGIS操作)