eolearn.mask.utils

Utilities for cloud masking

eolearn.mask.utils.map_over_axis(data, func, axis=0)[source]

Map function func over each slice along axis. If func changes the number of dimensions, mapping axis is moved to the front.

Returns a new array with the combined results of mapping.

Parameters
  • data (numpy.ndarray) – input array

  • func (Callable[[numpy.ndarray], numpy.ndarray]) – Mapping function that is applied on each slice. Outputs must have the same shape for every slice.

  • axis (int) – Axis over which to map the function.

Example

Return type

numpy.ndarray

>>> data = np.ones((5,10,10))
>>> func = lambda x: np.zeros((7,20))
>>> res = map_over_axis(data,func,axis=0)
>>> res.shape
(5, 7, 20)
eolearn.mask.utils.resize_images(data, new_size=None, scale_factors=None, anti_alias=True, interpolation='linear')[source]

DEPRECATED, please use eolearn.features.utils.spatially_resize_image instead.

Resizes the image(s) according to given size or scale factors.

To specify the new scale use one of new_size or scale_factors parameters.

Parameters
  • data (numpy.ndarray) – input image array

  • new_size (Optional[Tuple[int, int]]) – New size of the data (height, width)

  • scale_factors (Optional[Tuple[float, float]]) – Factors (fy,fx) by which to resize the image

  • anti_alias (bool) – Use anti aliasing smoothing operation when downsampling. Default is True.

  • interpolation (str) – Interpolation method used for resampling. One of ‘nearest’, ‘linear’, ‘cubic’. Default is ‘linear’.

Return type

numpy.ndarray