I have a raster file from which I am attempting to calculate mean values for polygons defined in a shapefile. Using the Zonal Statistics as Table tool from within ArcGIS works great. My shapefile contains 118 shapes, and the output table contains 118 rows.
My problem is that when I try to execute the exact same tool from a python script, not all of the shapes are included in the results. From 118 shapes in the shapefile, my output table only contains 87 rows.
My polygons do not overlap, and they are all much larger than the pixel resolution of the raster.
Here is the code I am running:
import arcpy from arcpy import env from arcpy.sa import * env.workspace = "E:/Temp" shapeFile = "test_shape.shp" shapeFileField = "FID" inRaster = "test_raster.pix" outTable = "test_output" arcpy.CheckOutExtension("Spatial") outStats = ZonalStatisticsAsTable(shapeFile, shapeFileField, inRaster, outTable, "DATA", "MEAN")
Can anybody give me any hints as to why this is happening?