I have a TIFF format file and want to automate some tasks. I have a Python script for Zonal Statistics as Table but it results in empty table output. However, the Zonal Statistics As Table Tool at ArcMap runs successfully! What is the problem with the Script?
import os import arcpy from arcpy import env from arcpy.sa import * arcpy.env.overwriteOutput = True arcpy.CheckOutExtension('Spatial') arcpy.env.workspace = "D:/Data/Hydro/" raster_list = arcpy.ListRasters("*.tif") lisTable = arcpy.ListTables() zone = "D:/Data/Catch.shp" # Loop through each file and perform the zonal statistics processing for raster in raster_list: raster_name = os.path.basename(raster).rstrip(os.path.splitext(raster)) outTable = raster_name + ".dbf" arcpy.gp.ZonalStatisticsAsTable(zone, "NAME", raster, outTable, "NODATA", "MEAN_STD")