赞
踩
import arcpy
from arcpy import env
from arcpy.sa import *
import os
env.workspace = r"F:\ArcGIS\Projects\zhibodaoganhanfengxian\zhibodaoganhanfengxian.gdb"
filepath = r"C:\Users\WH\Desktop\zhibodao\EPRE"
filenames=[file for file in os.walk(filepath)]
inRasters=[]
for file in filenames[0][-1]:
if file.endswith(".tif"):
inRasters.append(file)
inMaskData = r"E:\ArcGIS\Projects\cailiao\AICGIS\zhongyao\mian.shp"
i=1965
for inRaster in inRasters:
outExtractByMask = ExtractByMask(filenames[0][0]+"\\"+inRaster,inMaskData)
outExtractByMask.save(r"C:\Users\WH\Desktop\SDR_drougth\EPRE\EPRE"+str(i)+".tif")
i = i + 1
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。