onstove.RasterLayer.cumulative_count#
- RasterLayer.cumulative_count(min_max: list[float, float] = [0.02, 0.98]) ndarray [source]#
Calculates a new data array flattening the raster’s data values that fall in either of the specified lower or upper percentile.
For example, if we use a
min_max
of[0.02, 0.98]
, the array will be first ordered in ascending order and then all values that fall inside the lowest 2% will be “flattened” giving them the value of the highest number inside that 2%. The same is done for the upper bound, where all data values that fall in the highest 2% will be given the value of the lowest number within that 2%.- Parameters:
- min_max: list of float
List of lower and upper limits to consider for the cumulative count.
- Returns:
- np.ndarray
Raster data array with the flattened values.