do you have some experience how to automatically get mode value from a raster ( value that appears most often in a dataset)? I am looking for something like "get raster properties" in Spatial analysis in ArcGIS, unfortunately there is no possibility to directly calculate mode. Subsequently, I would like to use this calculation of mode in Model Builder. Based on "mode value" I would like to reclassify raster image into binary file (0= values < mode, 1 = values > mode).
This may not be the most efficient nor the most accurate way, but this is probably the easiest method with model builder, assuming that your raster is categorical:
1) use zonal statistics (majority) with a zone layer with a single zone and the extent of your raster layer.
2) use raster calculator (or Con) to build your binary layer ( Con( "raster" < "majority", 0,1) )
EDIT : Note that you will need to reclassify your raster to integer if it is originally in float (this necessary binning is why I said that it may not be the most accurate method). From what I know, you will not be able to compute the mode of a continuous distribution with the tools available in model builder, but you can exttract the histogram (using zonal histogram), then apply @Jeffrey Evans method. In any case, if you have a very large number of pixels, the majority is good enough for most purposes.
@Jeffrey Evans thank for your inspiration in R, I found out a different approach and really easy:
This is a vectorization problem and would be very computationally expensive for a vector the size of a raster. To do this in ArcGIS you would have to step out into NumPy. Because of the inherent size of a raster (1 million values is a quite small raster these days), without applying a subsampling approach, this does not seem like a very tractable problem. I encourage you to explore an alternative thresholding approach.
If the data is unimodal, but skewed, the median is comparable to the mode. However, when the distribution exhibits multiple modes, that cannot be smoothed out, then the median becomes biased, but is still more representative of the central tendency than the mean.
I derive the number of modes and value of the (dominate) mode using a spline or a Gaussian kernel density function in R. I do not care for programming in Python but, perhaps somebody could adapt this code to address your problem.
If your data is integer it is frequency based and you can just use the bin with the maximum frequency (count). Now if we look at binning the continuous distribution to make this a tractable frequency based problem we can approximate the mode with the correct binning strategy. The "Sturges" algorithm does not always produce desirable results. However, A somewhat stable method for optimal bin size (number of bins) is the "Freedman-Diaconis rule" calculated as; n=(max-min)/h where; h=2∗IQR∗n−1/3.
Here we can observe the sensitivity of a binning approach.