Add options to deal with ties in cell statistics tool when selecting the majority option

08-09-2019 01:19 PM
Status: Open
Labels (1)
Occasional Contributor III

Cell statistics is an incredibly useful tool.  When using the MAJORITY option the default behavior of the tool for dealing with ties (when the two most abundant values are of equal abundance) is to create NoData.  This will often result in a map with lots of holes (NoData cells).  I would propose adding at least three options for dealing with ties.  One option would be FIRST. This would take the first value of the two tied values in the raster stack.  Another option would be LAST in which it takes the last raster of the stack with the tied value. A third option would be RANDOM. This would randomly select one of the two tied values. Finally a fourth option would be NEIGHBORHOOD. This option would expand by searching a 3x3 neighborhood and using the MAJORITY  cell in that neighborhood.  If a tie couldn't be broken using a 3x3 neighborhood then a 5x5 neighborhood would be used, etc. until all cells have a value.


I like the idea of a new parameter (NODATA, RANDOM, FIRST, LAST) with NODATA as the default so existing scripts are not broken.  I think we have neighborhood covered with existing map algebra workflows.


I can think of how to implement the NEIGHBORHOOD option in Model Builder.  FIRST, LAST, and RANDOM are trickier without knowing exactly how the underlying code in the cell statistics tool works.


I suppose that one way that this might get coded is by dropping one raster at a time in the stack and seeing if that breaks the tie.  This could be done with python without having to modify the source code of the Cell Statistics tool.  But ... I would still prefer if Esri just added these options to the Cell Statistics tool itself (NODATA, RANDOM, FIRST, LAST).