Pipeline

class spectral_indices.pipeline.Pipeline(transformations: List[Transformation], name='', description: str = '')[source]

Pipeline wraps a succession of transformations into a unique object. It can be serialized and registerd in PipelineRegistry for CLI commands. All transformations will be applied in the order of the transformation list. Pipeline can be serialized to json and be instantiate from a json.

Parameters:
  • transformations (List[Transformation]) – List of all the Transformations that are used in pipeline

  • name (str, optional) – Name of the pipeline (it will the way to access registered pipeline through factory). Defaults to “”.

  • description (str, optional) – Description of pipeline. Defaults to “”.

run(array: DataArray) DataArray[source]

Apply the pipeline to an array. This is a lazy application, real outputsq will be be computed with dask.

Parameters:

array (DataArray) – Array to apply pipeline on.

Returns:

Lazy processed array.

Return type:

DataArray

to_dict() Dict[str, Any][source]

Return pipeline as dictionnary with all transformations.

Returns:

Pipeline as dict.

Return type:

Dict[str, Any]

class spectral_indices.pipeline.PipelinesRegistry[source]

Pipeline registry to store and access existing pipelines through names.

classmethod get(name: str) Pipeline[source]

Gather a pieline from registry.

Parameters:

name (str) – Pipeline name.

Returns:

  • Pipeline to gather.

Return type:

Pipeline

classmethod register(pipeline: Pipeline)[source]

Register an existing pipeline into the registry.

Parameters:

pipeline (Pipeline) – Existing pipeline to register.