eogrow.core.area.base

Implementation of the base AreaManager.

pydantic model eogrow.core.area.base.PatchListSchema[source]

Bases: Schema

Create a new model by parsing and validating input data from keyword arguments.

Raises ValidationError if the input data cannot be parsed to form a valid model.

Fields:
field filename: str [Required]

A JSON file containing a list of EOPatch names.

Constraints:
  • pattern = ^.+.(json|JSON)$

field input_folder_key: str [Required]

The storage manager key pointing to the folder containing the file.

class eogrow.core.area.base.BaseAreaManager(config, storage)[source]

Bases: EOGrowObject

A manager for the AOI and how it is split into EOPatches

Parameters:
  • config (Schema) – The configuration schema

  • storage (StorageManager) – An instance of StorageManager class

NAME_COLUMN = 'eopatch_name'
pydantic model Schema[source]

Bases: ManagerSchema

Create a new model by parsing and validating input data from keyword arguments.

Raises ValidationError if the input data cannot be parsed to form a valid model.

Fields:
  • patch_names (eogrow.core.area.base.PatchListSchema | None)

field patch_names: PatchListSchema | None = None

Names of EOPatches to keep when filtering in the get_grid method.

config: Schema
abstract get_area_geometry(*, crs=CRS.WGS84)[source]

Provides a dissolved geometry object of the entire AOI

Parameters:

crs (CRS) –

Return type:

Geometry

get_grid(filtered=True)[source]

Provides a grid of bounding boxes which divide the AOI. Uses caching to avoid recalculations.

The grid is split into different CRS zones. The bounds properties of the geometries are taken as BBox definitions. EOPatch names are stored in a column with identifier self.NAME_COLUMN.

Returns:

A dictionary of GeoDataFrames that defines how the area is split into EOPatches.

Parameters:

filtered (bool) –

Return type:

dict[sentinelhub.constants.CRS, geopandas.geodataframe.GeoDataFrame]

abstract get_grid_cache_filename()[source]

Provides a filename that is used for caching the grid, including the file extensions (likely .gpkg).

Should ensure that two different grids don’t clash.

Return type:

str

get_patch_list()[source]

Returns a list of eopatch names and appropriate BBoxes.

Return type:

List[Tuple[str, BBox]]

eogrow.core.area.base.get_geometry_from_file(filesystem, file_path, geopandas_engine='fiona')[source]

Provides a single geometry object of entire AOI

Parameters:
  • filesystem (FS) –

  • file_path (str) –

  • geopandas_engine (Literal['fiona', 'pyogrio']) –

Return type:

Geometry

eogrow.core.area.base.load_grid(grid_path, storage)[source]

A method that loads the bounding box grid from the cache folder.

Parameters:
Return type:

dict[sentinelhub.constants.CRS, geopandas.geodataframe.GeoDataFrame]

eogrow.core.area.base.save_grid(grid, grid_path, storage)[source]

A method that saves the bounding box grid to the cache folder.

Parameters:
  • grid (dict[sentinelhub.constants.CRS, geopandas.geodataframe.GeoDataFrame]) –

  • grid_path (str) –

  • storage (StorageManager) –

Return type:

None