两文件夹栅格逐个对应相减

#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")
  • 2
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值