scale(array: Union[numpy.ndarray,], 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.


If 3D, the raster should be in rasterio’s convention: (count, height, width)

  • array (Union[np.ndarray,]) – Matrix to be scaled

  • perc (int) – Percentile to cut. 0 = min/max, 2 by default


Scaled matrix

Return type

numpy array