eogrow.pipelines.split_grid

Implements a pipeline that creates a finer grid and splits EOPatches accordingly.

class eogrow.pipelines.split_grid.SplitGridPipeline(config, raw_config=None)[source]

Bases: Pipeline

Pipeline that creates a finer grid and splits EOPatches accordingly.

The new grid is output as a geopackage file, which can be used with a CustomAreaManager. The name of the column with eopatch names is eopatch_name.

Parameters:
  • config (Schema) – A dictionary with configuration parameters

  • raw_config (RawConfig | None) – The configuration parameters pre-validation, for logging purposes only

pydantic model Schema[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:
  • buffer (Literal['auto'] | Tuple[float, float])

  • eopatch_output_folder_key (str)

  • features (List[Tuple[eolearn.core.constants.FeatureType, str]])

  • grid_output_folder_key (str)

  • input_folder_key (str)

  • prune (bool)

  • raise_misaligned (bool)

  • skip_existing (Literal[False])

  • split_x (int)

  • split_y (int)

  • subsplit_grid_filename (str)

field buffer: Literal['auto'] | Tuple[float, float] = 'auto'

Amount of buffer present on existing EOPatches, provided as (buffer_x, buffer_y) in CRS units. Applies same buffer to split EOPatches. The pipeline tries to obtain this information from area manager, but not all area manager classes are supported.

field eopatch_output_folder_key: str [Required]

A storage manager key pointing to the folder where the data will be saved.

Validated by:
  • validate_storage_key

field features: List[Feature] [Required]

Which features will be loaded and adapted to new grid.

field grid_output_folder_key: str [Required]

A storage manager key of where to save the resulting split grid.

Validated by:
  • validate_storage_key

field input_folder_key: str [Required]

A storage manager key pointing to the folder where the data will be loaded from.

Validated by:
  • validate_storage_key

field prune: bool = True

Remove all split EOPatches that don’t intersect with the area manager AOI.

field raise_misaligned: bool = True

Raise an error if spatially splitting the EOPatch produces misalignments.

field skip_existing: Literal[False] = False
field split_x: int = 2

Number of splits done on each EOPatch along the x-axis.

field split_y: int = 2

Number of splits done on each EOPatch along the y-axis.

field subsplit_grid_filename: str [Required]

Filename of new grid, which can be used in CustomAreaManager.

Constraints:
  • pattern = ^.+.gpkg$

config: Schema
run_procedure()[source]

Execution procedure of pipeline. Can be overridden if needed.

By default, builds the workflow by using a build_workflow method, which must be additionally implemented.

Returns:

A pair of lists representing successful and unsuccessful executions.

Return type:

tuple[list[str], list[str]]

build_workflow()[source]
Return type:

EOWorkflow

get_execution_arguments(workflow, bbox_splits)[source]

Prepares execution arguments for each eopatch from a list of patches.

The output should be a dictionary of form {execution_name: {node: node_kwargs}}. Execution names are usually names of EOPatches, but can be anything.

Parameters:
  • workflow (EOWorkflow) – A workflow for which arguments will be prepared

  • bbox_splits (list[tuple[Tuple[str, sentinelhub.geometry.BBox], list[Tuple[str, sentinelhub.geometry.BBox]]]]) –

Return type:

Dict[str, Dict[EONode, Dict[str, object]]]

save_new_grid(bbox_splits)[source]

Organizes BBoxes into multiple GeoDataFrames that are then saved as layers of a GPKG file.

Parameters:

bbox_splits (list[tuple[Tuple[str, sentinelhub.geometry.BBox], list[Tuple[str, sentinelhub.geometry.BBox]]]]) –

Return type:

None