This is a follow up question from: Python Script Zonal Stats as Table Loop Question
I was able to get the script working successfully, but I'm running into a problem where zonal statistics is not calculating mean value for all the features in the shapefile. I've checked to see if data is present within these features by running the tool individually and it is able to successfully calculate the results. I should also mention the features do not overlap.
Script:
import arcpy
from arcpy import env
from arcpy.sa import *
env.workspace = "F:/lu_crop_rast"
arcpy.env.overwriteoutput = 1
watershedFeat = "F:/watersheds.shp"
outDir = "F:/lu_crop_rast/tables/"
for raster in arcpy.ListRasters():
raster_name = os.path.basename(raster).rstrip(os.path.splitext(raster)[1])
outTable = outDir + raster_name + "_TBL.dbf"
arcpy.sa.ZonalStatisticsAsTable(watershedFeat,"Name",raster,outTable,"NODATA","MEAN")