Hi!
I have a similar question to this post from 2019, but it looks like a solution was never posted.
I'm looking to reclassify a development suitability raster that I created into 3 groups, where I have calculated the cell count I want for each of those groups.
The input raster values range from (least suitable) 0 to 88.6954 (most suitable). I want group 1 to have a cell count of 50081, with values starting from 88.6954. Group 2 should have 67400 cells, and Group 3 are all the remaining cells. The cell count was derived from an estimated amount of area that an urbanized area with grow in the next 5 and 10 years.
I've tried Slice - but we can't specify the number of cells or area per group. (Otherwise this would have been the perfect tool).
Data is available here for reference.
Thanks!
Solved! Go to Solution.
A simple way which shouldn't take long is to create a raster attribute table if it doesn't already have one, then create a new column/field which is the cumulative count of the 'COUNT' field e.g. How to: Calculate cumulative shape length values of a feature class using the Field Calculator (esri...
ensure you sort the attribute table by VALUE small to large first.
then all you have to do is find the cumulative count value (this represents the total number of raster cells so far) and find the corresponding value/GRID_CODE at which to set your break point/class.
e.g. cumulative value of 50081, corresponding raster cell value of 40, then set your class break to 40.
hardly gold standard analysis but I'm pretty sure it will work quite easily.
A simple way which shouldn't take long is to create a raster attribute table if it doesn't already have one, then create a new column/field which is the cumulative count of the 'COUNT' field e.g. How to: Calculate cumulative shape length values of a feature class using the Field Calculator (esri...
ensure you sort the attribute table by VALUE small to large first.
then all you have to do is find the cumulative count value (this represents the total number of raster cells so far) and find the corresponding value/GRID_CODE at which to set your break point/class.
e.g. cumulative value of 50081, corresponding raster cell value of 40, then set your class break to 40.
hardly gold standard analysis but I'm pretty sure it will work quite easily.
This worked for me! It actually worked better than I thought it would because I was able to incorporate all the steps into ModelBuilder since the cell counts for each of values were only 1 or 2! So instead of going into the attribute table to look for the the corresponding raster cell value, I just ended up using the new cumulative count field for reclassification.
Thanks!
reclassify your suitability map into 3 classes using your boundaries (call them 1, 2, and 3)
Run Zonal Histogram (Spatial Analyst)—ArcGIS Pro | Documentation
to get the statistics for the classes.
Whether or not, your are able to get the cell count for your suitability classes will depend on the histogram, since you can't reclass by count as you have discovered, but count is equivalent to area given a cell size. (projected data expected and presumed).
Alternately, use arcpy.RasterToNumPyArray to obtain the same results but use numpy's nanpercentile to get a betterr ogive/cumulative relative frequency to examine the histogram in more detail