eogrow.tasks.spatial

Tasks for spatial operations on EOPatches, used in grid-switching.

class eogrow.tasks.spatial.SpatialJoinTask(*args, **kwargs)[source]

Bases: EOTask

Spatially joins data from multiple EOPatches

Stores initialization parameters and the order to the instance attribute init_args.

Parameters:
  • features (list[Feature]) –

  • no_data_map (dict[Feature, float]) –

  • unique_columns_map (dict[Feature, list[str]]) –

  • raise_misaligned (bool) –

ERR = 1e-08
execute(*eopatches, bbox)[source]

Spatially joins given EOPatches into a new EOPatch with given bounding box.

Parameters:
  • eopatches (EOPatch) –

  • bbox (BBox) –

Return type:

EOPatch

class eogrow.tasks.spatial.SpatialSliceTask(*args, **kwargs)[source]

Bases: EOTask

Spatially slices given EOPatch to create a new one.

Stores initialization parameters and the order to the instance attribute init_args.

Parameters:
  • features (list[Feature]) –

  • raise_misaligned (bool) –

execute(eopatch, *, bbox, skip=False)[source]

Spatially slices given EOPatch with given bounding box.

Can be skipped in cases where the subbox won’t be saved.

Parameters:
  • eopatch (EOPatch) –

  • bbox (BBox) –

  • skip (bool) –

Return type:

EOPatch

eogrow.tasks.spatial.get_array_slices(bbox, slice_bbox, *, resolution=None, size=None, raise_misaligned=True, limit_x=None, limit_y=None)[source]

Slicing taken from eolearn.io.ImportFromTiffTask.

Parameters:
  • bbox (BBox) – A bounding box of initial array.

  • slice_bbox (BBox) – A bounding box of array to be sliced.

  • resolution (None | ndarray | tuple[float, float]) – A working resolution in CRS units.

  • size (None | ndarray | tuple[int, int]) – A working size.

  • raise_misaligned (bool) – Raise an error if the slice would be pixel misaligned the initial array.

  • limit_x (None | tuple[int, int]) – If provided it will clip the horizontal slice to a given interval, should be used to clip slice_bbox to bbox.

  • limit_y (None | tuple[int, int]) – If provided it will clip the vertical slice to a given interval, should be used to clip slice_bbox to bbox.

Returns:

A slice over horizontal direction and a slice over vertical direction.

Return type:

tuple[slice, slice]