sertit.display.scale¶
- scale(array: Union[numpy.ndarray, numpy.ma.core.MaskedArray], perc: int = 2)[source]¶
Scale a raster given as a np.ndarray between 0 and 1.
The min max are computed with percentiles (2 by default), but can be true min/max if perc=0.
- ..WARNING::
If 3D, the raster should be in rasterio’s convention: (count, height, width)
- Parameters
array (Union[np.ndarray, numpy.ma.masked_array]) – Matrix to be scaled
perc (int) – Percentile to cut. 0 = min/max, 2 by default
- Returns
Scaled matrix
- Return type
numpy array