AnsweredAssumed Answered

I want to zonal statistics for multiple raster.

Question asked by ljs5219 on May 14, 2013
Latest reply on May 14, 2013 by lpinner

now, i use only single zonal statistics module.
but i want to multiple zonal tool.

# Import arcpy module
import arcpy, os
from arcpy import env
from import *

# Check out any necessary licenses

# Input data source
arcpy.env.workspace = "C:/py/07"
arcpy.env.scratchWorkspace = "C:/py/07"
arcpy.env.overwriteOutput = True

ZoneData = "C:/py/FISHNET_4k_FeatureToPolygon.shp"

# Output File
OutputFolder = "C:/py/zonal"

# Loop through a list of files in the workspace
RasterFiles = arcpy.ListRasters()
print RasterFiles
print " "

# Local variables:
for filename in RasterFiles:
    print "Processing: {0}".format(filename)
    input_dir = arcpy.env.workspace
    inRaster1 = "C:/py/07/lai_0907_m"

    outRaster1 = os.path.join(OutputFolder,"z4_" + filename)

    # Process: Zonal Statistics
    saveRaster =, "ID", inRaster1, "MEAN", "DATA")

print "done"

but, i have 12 raster files.
and, i want to zonal at the one time..

please help me.
how can i do? i heard loop, but, i can use that..

raster file name. (lai_0901,lai_0902, ......, lai_0912)