Using native Python and arcpy function what method is best to create a histogram of raster dataset? I know it's possible to use raterio and GDAL functions, but I would like to keep it a arcpy and native Python.
Specifically I am working on a script to delineate watersheds and I would like to create a raster based on the values in a flow accumulation raster dataset. From the calculated raster I would then convert to vector stream layers. The ultimate goal is to be able to create separate stream order layers.
Best Answer
I would recommend converting your raster to a numpy array, which you can then use to calculate statistics for the histogram. matplotlib is then used for the plotting. For example:
However, I believe Rasterio does a better job plotting raster histograms. For example, here is a Rasterio generated histogram of 4 band NAIP imagery: