import arcpy from arcpy import env from arcpy.sa import * arcpy.env.workspace =r"C:/Users/Yuki/Desktop/data" arcpy.CheckOutExtension("Spatial") rasterlist1 = arcpy.ListRasters("*","tif") rasterlist2 = arcpy.ListRasters("*","tif") output_path =r'C:/Users/Yuki/Desktop/data/data2/' for raster1,raster2 in zip(rasterlist1[0:-1],rasterlist2[1:]): print len(rasterlist1[0:-1]) print len(rasterlist1[1:]) Sum1 = Raster(raster1) + Raster(raster2) print str(raster1) print str(raster2) # out_name=output_path+raster1 # Sum1.save(out_name) print("OK!")
在编译器为python27的环境下,利用pycharm,实现了data文件夹的第一个tif与第二个tif相加,然后第二个tif与第三个tif相加,以此类推,最终输出在data2文件中。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)