I want to get the Histogram of a Raster using the "Value" field in the raster attribute table.

The "feature zone data" is a shapefile and the "Input Value Raster" a 32Bit signed integer raster with an attribute table like this:

OBJECTID* Value Count
0 20030056 555
1 34530056 666
... ... ...
113166 128071087 777

I am running something like:

arcpy.sa.ZonalHistogram(watershed, "ID", myRaster, output.dbf', '', "ZONES_AS_FIELDS")

...and the output looks like this: (WRONG)

Label ID_111
1 0
2 ###
... ...
256 0

Instead of a table with 256 rows it should have the 113166 different classes in the raster.


  • How I can use the "Value" field in the Raster attribute table instead of this default 256 "scale"?

  • Is there any syntax to indicate the default field like myRaster$Value, myRaster[:,"Value"] or something?

    arcpy.sa.ZonalHistogram(watershed, "ID", myRaster[:,"Value"], output.dbf', '', "ZONES_AS_FIELDS")

1 Answer 1


In case someone have the same problem, I didn't find the way to use the Raster field so I tabulate the areas instead.

arcpy.sa.TabulateArea(myRaster, "Value", watershed, "ID", r'memory/tabArea', myRaster, "CLASSES_AS_FIELDS")

The tabulate area, returns the area instead the number of pixels but allows to use a different raster field (arcpy.sa.TabulateArea(myRaster, "RasterField"...).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.