您的位置:首页 > 编程语言 > Python开发

Python版的ArcGIS栅格计算器模板

2015-11-07 11:02 393 查看
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)本例实现求平均
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: