scale

Contents

scale#

scale(array: ndarray | MaskedArray, perc: int = 2) ndarray | MaskedArray[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 (AnyNumpyArray) – Matrix to be scaled

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

Returns:

Scaled matrix

Return type:

numpy array