I have many .ncf files that I read as raster layers and then do zonal statistics to have mean and sd values over each of 3108 CONUS counties. But the final standalone table is missing 245 counties. This is how the raster layer and the counties look together. You see that the raster covers all the polygons
feature layer on top of the raster layer
And the picture below shows missing counties from the resulted zonal statistics in red color.Red counties are missed from the final table
This is my code that loops over different files with same rasters only different values in cells and the same shape file for zonal boundaries.
# Set the analysis environments
env.workspace = r"C:\ArcGIS_projects\PM25"
rasrtersFolder = r"C:\ArcGIS_projects\PM25\V4NA03\\"
zonalOutFolder = r"C:ArcGIS_projects\PM25\zonal_stats\\"
variable = "PM25"
XDimension = "LON"
YDimension = "LAT"
outRasterLayer = "PM25"
bandDimmension = ""
dimensionValues = ""
valueSelectionMethod = ""
cellRegistration = ""
# for zonal statistics
inZoneData = 'CONUS_counties_2016_WGS1984'
zoneField = 'GEOID'
inValueRaster = 'PM25'
for fileName in files:
# Reading netcdf file into raster layer
inNetCDFFile = rasrtersFolder + fileName
# Execute MakeNetCDFRasterLayer
arcpy.MakeNetCDFRasterLayer_md(inNetCDFFile, variable, XDimension, YDimension,
outRasterLayer, bandDimmension, dimensionValues,
# Now doing zonal statistics
outName = fileName.split('.')
outTable = zonalOutFolder + outName+'.dbf'
outZSaT = ZonalStatisticsAsTable(inZoneData, zoneField, inValueRaster,
outTable, "DATA", "MEAN_STD")
# Set local variables
inTable = outName
outLocation = r"C:\Users\babak.jfard\ArcGIS_projects\PM25\zonal_stats_csv"
outTable = outName.split('-') + ".csv"
# Execute TableToTable
arcpy.TableToTable_conversion(inTable, outLocation, outTable)
the files to reproduce can be found here: (All projection are set to WGS1984 to align with the ncd files)
Is it possible to be related to my updated ArcGIS pro (2.8.2)? two weeks ago I did the very same with an older version of ArcGIS pro and worked perfectly. Last night I updated my ArcGIS pro, and the very same raster and feature have missing zones in the results