s1tiling.libs.otbwrappers.AnalyseBorders

class s1tiling.libs.otbwrappers.AnalyseBorders(cfg: Configuration)[source]

Bases: StepFactory

StepFactory that analyses whether image borders need to be cut as described in Margins cutting documentation.

The step produced by this actual factory doesn’t register any OTB application nor execute one. However, it loads two lines from the input image to determine whether it contains too many NoData.

Found information will be stored into the meta dictionary for later use by CutBorders step factory.

New methods & Specialized methods

__init__

Constructor

build_step_output_filename

Forward the output filename.

build_step_output_tmp_filename

As there is no OTB application associated to AnalyseBorders, there is no temporary filename.

complete_meta

Complete meta information with Cutting thresholds.

Methods inherited from parent

update_image_metadata

Root implementation of update_image_metadata() that shall be specialized in every file producing Step Factory.

update_filename_meta

Duplicates, completes, and returns, the meta dictionary with specific information for the current factory regarding tasks analysis.

create_step

Instanciates the step related to the current StepFactory, that consumes results from the previous input steps.

check_requirements

Abstract method used to test whether a StepFactory has all its external requirements fulfilled.

Attributes and properties

image_description

Property image_description, used to fill TIFFTAG_IMAGEDESCRIPTION

name

Step Name property.

_do_create_actual_step(execution_parameters: Dict, input_step: AbstractStep, meta: Dict) AbstractStep

Generic variation point for the exact step creation. The default implementation returns a new AbstractStep.

_update_filename_meta_post_hook(meta: Dict) None

Hook meant to be overridden to fix product metadata by overriding their default definition.

Called from update_filename_meta()

_update_filename_meta_pre_hook(meta: Dict) Dict

Hook meant to be overridden to complete product metadata before they are used to produce filenames or tasknames.

Called from update_filename_meta()

build_step_output_filename(meta: Dict) str[source]

Forward the output filename.

build_step_output_tmp_filename(meta: Dict) str[source]

As there is no OTB application associated to AnalyseBorders, there is no temporary filename.

check_requirements() Tuple[str, str] | None

Abstract method used to test whether a StepFactory has all its external requirements fulfilled. For instance, OTBStepFactory’s will check their related OTB application can be executed.

Returns:

None if requirements are fulfilled.

Returns:

A message indicating what is missing otherwise, and some context how to fix it.

complete_meta(meta: Dict, all_inputs: List[Dict[str, AbstractStep]]) Dict[source]

Complete meta information with Cutting thresholds.

create_step(execution_parameters: Dict, previous_steps: List[List[Dict[str, AbstractStep]]]) AbstractStep

Instanciates the step related to the current StepFactory, that consumes results from the previous input steps.

1. This methods starts by updating metadata information through: complete_meta() on the input metadatas.

2. Then it updates the GDAL image metadata information that will need to be written in the pipeline output image through update_image_metadata().

3. Eventually the actual step creation method is executed according to the exact kind of step factory (ExecutableStepFactory, AnyProducerStepFactory, OTBStepFactory) through the variation point _do_create_actual_step().

While this method is not meant to be overridden, for simplity it will be in Store factory.

Note: it’s possible to override this method to return no step (None). In that case, no OTB Application would be registered in the actual Pipeline.

property image_description: str | List[str]

Property image_description, used to fill TIFFTAG_IMAGEDESCRIPTION

property name: str

Step Name property.

update_filename_meta(meta: Dict) Dict

Duplicates, completes, and returns, the meta dictionary with specific information for the current factory regarding tasks analysis.

This method is used:

  • while analysing the dependencies to build the task graph – in this use case the relevant information are the file names and paths.

  • and indirectly before instanciating a new Step

Other metadata not filled here:

  • get_task_name() which is deduced from out_filename by default

  • out_extended_filename_complement()

It’s possible to inject some other metadata (that could be used from _get_canonical_input() for instance) thanks to _update_filename_meta_pre_hook().

This method is not meant to be overridden. Instead it implements the template method design pattern, and expects the customization to be done through the specialization of the hooks:

update_image_metadata(meta: Dict, all_inputs: List[Dict[str, AbstractStep]]) None

Root implementation of update_image_metadata() that shall be specialized in every file producing Step Factory.