Utilities for cloud masking

eolearn.mask.utilities.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.

  • data (np.array) – input array

  • func (function np.array -> np.array) – 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.


>>> 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.utilities.resize_images(data, new_size=None, scale_factors=None, anti_alias=True, interpolation='linear')[source]

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

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

  • data (numpy array with shape (timestamps, height, width, channels), (height, width, channels), or (height, width)) – input image array

  • new_size ((int, int)) – New size of the data (height, width)

  • scale_factors ((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 (string) – Interpolation method used for resampling. One of ‘nearest’, ‘linear’, ‘cubic’. Default is ‘linear’.