Reclassification of Raster: Slice by Specified Cell Count

251
3
Jump to solution
4 weeks ago
Kai_YingLau
New Contributor II

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.

  • UrbExp_ExistNull.tif = the raster I'm trying to reclassify
  • Urban_Raster.tif = Existing urban areas that were nulled out of the above raster
  • slice3.tif = the results if I ran the Slice tool, 3 classes, natural breaks

Thanks!

 

Tags (2)
0 Kudos
1 Solution

Accepted Solutions
DavidPike
MVP Frequent Contributor

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.

View solution in original post

3 Replies
DavidPike
MVP Frequent Contributor

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.

View solution in original post

Kai_YingLau
New Contributor II

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!

0 Kudos
DanPatterson
MVP Honored Contributor

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


... sort of retired...
0 Kudos