Bootstrap

用Arcpy批量进行栅格计算

import arcpy
from arcpy import env
from arcpy.sa import *

arcpy.CheckOutExtension("spatial")
env.overwriteOutput=1

workingDir=r"D:\\lyj\\code\\"
env.workspace=workingDir+"globe_temp_raster"

in_rasters1=arcpy.ListRasters()
in_raster2=Raster("D:\\lyj\\code\\pop_ratio\\calc_ratio.tif")


for in_raster1 in in_rasters1:
    print in_raster1
    out_raster=in_raster1*in_raster2
    out_raster.save(workingDir+"globe_temp_raster_result\\"+"cal_"+in_raster1)
;