#coding:utf-8
import arcpy
import os
import glob
from arcpy.sa import *
arcpy.CheckOutExtension("Spatial")
arcpy.gp.overwriteOutput=1
Path1 = r"I:\大论文数据处理\最终物候计算结果_2par_double_maxauto" # 数据存放目录
Path2 = r"I:\大论文数据处理\最终物候计算结果_2par_double_maxauto"
outPath = unicode(r"I:\大论文数据处理\最终物候计算结果_2par_double_maxauto\LOS\\",'utf-8') # 输出数据存放路径
Path1 = unicode(Path1,'utf-8')
Path2 = unicode(Path2,'utf-8')
rasters1=glob.glob(os.path.join(Path1,"*EOS*.tif"))
rasters2=glob.glob(os.path.join(Path2,"*SOS*.tif"))
i=0
for i in range(len(rasters1)):
for file2 in rasters2:
file_name = os.path.basename(file2)
file1=rasters1[i]
file1=arcpy.Raster(file1)
file2 = arcpy.Raster(file2)
outfile=file1-file2
outfile.save(outPath+file_name[14:18]+"_LOS.tif")
i=i+1
print ("finished")
两文件夹栅格逐个对应相减
最新推荐文章于 2023-12-01 12:47:29 发布