赞
踩
import arcpy
from arcpy import env
from arcpy.sa import *
import os
import os.path
import sys
#arcpy.env.workspace = "D:\\TIF\\IMERGD\\Y"
rootdir = 'D:\\TIF\\IMERGD\\Y'
filenames = os.listdir(rootdir)
for filename in filenames:
if os.path.splitext(filename)[1] == '.tif':
inRaster =rootdir + os.sep + filename
outname = filename.replace('.tif','_cjmm')
inMaskData = "D:\\TIF\\HB_PROVINCE.shp"
arcpy.CheckOutExtension("Spatial")
outExtractByMask = ExtractByMask(inRaster, inMaskData)
print "ok"
outExtractByMask.save("D:\\test\\"+outname+'.tif')
print outname
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。