Skip to content

CoordinatesFilter

Bases: ABC

Abstract class for coordinates filters

Coordinates filters are callables that filter coordinates. The coordinates filter can be used to filter the coordinates of the bottom left corner of each tile. E.g., to remove tiles that don't intersect with an area of interest or tiles that are already processed.

Currently implemented coordinates filters
  • CompositeFilter: Composes multiple coordinates filters
  • DuplicatesFilter: Removes duplicates
  • GeospatialFilter: Filters based on geospatial data
  • MaskFilter: Filters based on a boolean mask
  • SetFilter: Filters based on other coordinates

__call__ abstractmethod

Filters the coordinates.

PARAMETER DESCRIPTION
coordinates

coordinates (x_min, y_min) of each tile

TYPE: CoordinatesSet

RETURNS DESCRIPTION
CoordinatesSet

filtered coordinates (x_min, y_min) of each tile


CompositeFilter

Bases: CoordinatesFilter

Coordinates filter that composes multiple coordinates filters

PARAMETER DESCRIPTION
coordinates_filters

coordinates filters

TYPE: list[CoordinatesFilter]

__call__

Filters the coordinates with each coordinates filter.

PARAMETER DESCRIPTION
coordinates

coordinates (x_min, y_min) of each tile

TYPE: CoordinatesSet

RETURNS DESCRIPTION
CoordinatesSet

filtered coordinates (x_min, y_min) of each tile


DuplicatesFilter

Bases: CoordinatesFilter

Coordinates filter that removes duplicates

__call__

Filters the coordinates by removing duplicates.

PARAMETER DESCRIPTION
coordinates

coordinates (x_min, y_min) of each tile

TYPE: CoordinatesSet

RETURNS DESCRIPTION
CoordinatesSet

filtered coordinates (x_min, y_min) of each tile


GeospatialFilter

Bases: CoordinatesFilter

Coordinates filter that filters based on geospatial data

Available modes
  • DIFFERENCE: Removes coordinates of tiles that are within the polygons in the geodataframe
  • INTERSECTION: Removes coordinates of tiles that don't intersect with the polygons in the geodataframe
PARAMETER DESCRIPTION
tile_size

tile size in meters

TYPE: TileSize

gdf

geodataframe

TYPE: gpd.GeoDataFrame

mode

geospatial filter mode (DIFFERENCE or INTERSECTION)

TYPE: GeospatialFilterMode

__call__

Filters the coordinates based on the polygons in the geodataframe.

PARAMETER DESCRIPTION
coordinates

coordinates (x_min, y_min) of each tile

TYPE: CoordinatesSet

RETURNS DESCRIPTION
CoordinatesSet

filtered coordinates (x_min, y_min) of each tile


MaskFilter

Bases: CoordinatesFilter

Coordinates filter that filters based on a boolean mask

PARAMETER DESCRIPTION
mask

boolean mask

TYPE: npt.NDArray[np.bool_]

__call__

Filters the coordinates based on the boolean mask.

PARAMETER DESCRIPTION
coordinates

coordinates (x_min, y_min) of each tile

TYPE: CoordinatesSet

RETURNS DESCRIPTION
CoordinatesSet

filtered coordinates (x_min, y_min) of each tile


SetFilter

Bases: CoordinatesFilter

Coordinates filter that filters based on other coordinates

Available modes
  • DIFFERENCE: Removes coordinates that are in the other coordinates
  • INTERSECTION: Removes coordinates that are not in the other coordinates
  • UNION: Combines the coordinates with the other coordinates and removes duplicates
PARAMETER DESCRIPTION
other

other coordinates (x_min, y_min) of each tile

TYPE: CoordinatesSet

mode

set filter mode (DIFFERENCE, INTERSECTION or UNION)

TYPE: SetFilterMode

__call__

Filters the coordinates based on the other coordinates.

PARAMETER DESCRIPTION
coordinates

coordinates (x_min, y_min) of each tile

TYPE: CoordinatesSet

RETURNS DESCRIPTION
CoordinatesSet

filtered coordinates (x_min, y_min) of each tile