mask_classifications
- mcalf.utils.smooth.mask_classifications(class_map, vmin=None, vmax=None, reduce=True)[source]
Mask 2D and 3D arrays of classifications.
If 3D, also reduces to 2D by selecting the most common classification along the first dimension.
- Parameters:
class_map (numpy.ndarray[int], ndim=2 or 3) – Array of classifications. If reduce is True (default) and the array is three-dimensional, it is assumed that the first dimension is time, and a time average classification will be calculated. The time average is the most common positive (valid) classification at each pixel.
vmin (int, optional, default=None) – Minimum classification integer to include. Must be greater or equal to zero. Defaults to min positive integer in class_map. Classifications below this value will be set to -1.
vmax (int, optional, default=None) – Maximum classification integer to include. Must be greater than zero. Defaults to max positive integer in class_map. Classifications above this value will be set to -1.
reduce (bool, optional, default=True) – Whether to perform the time average described in class_map info.
- Returns:
class_map (numpy.ndarray[int], ndim=2) – class_map with values between vmin and vmax averaged along the first dimension.
vmin (int) – Updated vmin value.
vmax (int) – Updated vmax value.
See also
mcalf.visualisation.plot_class_map
Plot a map of the classifications.