s1tiling.libs.otbwrappers.ComputeEllipsoidNormalsOnS2
- class s1tiling.libs.otbwrappers.ComputeEllipsoidNormalsOnS2(cfg: Configuration)[source]
- Bases: - OTBStepFactory- Factory that prepares steps that run ExtractNormalVectorToEllipsoid as described in Normals computation documentation. - ExtractNormalVectorToEllipsoid computes ellipsoid surface normals. - Requires the following information from the configuration object: - ram_per_process 
- fname_fmt – optional key: normals_wgs84_on_s2, useless in the in-memory nominal case 
 - Requires the following information from the metadata dictionary - tile_name 
- tile_origin 
- output filename - New methods & Specialized methods - __init__- Constructor. - _get_canonical_input- Helper function to retrieve the canonical input associated to a list of inputs. - _update_filename_meta_post_hook- Register - accept_as_compatible_inputhook for- s1tiling.libs.meta.accept_as_compatible_input().- Returns the parameters to use with ExtractNormalVectorToEllipsoid OTB application to generate surface normals for each point of the origin S1 image. - Return the requirement context that permits to fix missing requirements. - Set Normals related information. - Methods inherited from parent - Tells whether this step produces several files - Duplicates, completes, and returns, the meta dictionary with specific information for the current factory regarding tasks analysis. - This specialization of - StepFactory.build_step_output_tmp_filename()will automatically insert- .tmpbefore the filename extension.- Directory used to store temporary files before they are renamed into their final version. - Returns the names of typical result files in case their production is required (i.e. not in-memory processing). - Accessor to where output files will be stored in case their production is required (i.e. not in-memory processing). - Permits to have steps force the output pixel data. - This specialization of - check_requirements()checks whether the related OTB application can correctly be executed from S1Tiling.- Propagates the optional extended filename set in the construtor to the step meta data. - Instanciates the step related to the current - StepFactory, that consumes results from the previous input steps.- Attributes and properties - OTB Application property. - Property image_description, used to fill - TIFFTAG_IMAGEDESCRIPTION- Step Name property. - Name of the "in" parameter used by the OTB Application. - Name of the "out" parameter used by the OTB Application. - Property ram_per_process 
 - _do_create_actual_step(execution_parameters: Dict, input_step: AbstractStep, meta: Dict) AbstractStep
- Instanciates the step related to the current - StepFactory, that consumes results from the previous input step.- We expect the step metadata and the GDAL image metadata to have been updated. 
- Steps that wrap an OTB application will instanciate this application object, and: - either pipe the new application to the one from the input step if it wasn’t a first step 
- or fill in the “in” parameter of the application with the - out_filename()of the input step.
 
 - 1-bis. in case the new step isn’t related to an OTB application, nothing specific is done, we’ll just return an - AbstractStep
 - _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 | List[str]
- Returns the names of typical result files in case their production is required (i.e. not in-memory processing). - This specialization uses - gen_output_filenamenaming policy parameter to build the output filename. See the Available naming policies.
 - build_step_output_tmp_filename(meta: Dict) str | List[str]
- This specialization of - StepFactory.build_step_output_tmp_filename()will automatically insert- .tmpbefore the filename extension.
 - check_requirements() Tuple[str, str] | None
- This specialization of - check_requirements()checks whether the related OTB application can correctly be executed from S1Tiling.- Returns:
- A pair of the message indicating what is required, and some context how to fix it – by default: install OTB! 
- Returns:
- Noneotherwise.
 
 - complete_meta(meta: Dict, all_inputs: List[Dict[str, AbstractStep]]) Dict
- Propagates the optional extended filename set in the construtor to the step meta data. - Note - StepFactory.complete_meta()already takes care of clearing any residual- out_extended_filename_complementmetadata from previous steps
 - 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.- This methods starts by updating metadata information through: - complete_meta()on the- inputmetadatas.
- Then it updates the GDAL image metadata information that will need to be written in the pipeline output image through - update_image_metadata().
- 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 - Storefactory.- 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
 - output_directory(meta: Dict) str
- Accessor to where output files will be stored in case their production is required (i.e. not in-memory processing) - This property is built from - gen_output_dirconstruction parameter. Typical values for the parameter are:- os.path.join(cfg.output_preprocess, '{tile_name}'),where- tile_nameis looked into- metaparameter
- None, in that case the result will be the same as- tmp_directory(). This case will make sense for steps that don’t produce required products
 
 - property param_in: str
- Name of the “in” parameter used by the OTB Application. Default is likely to be “in”, while some applications use “io.in”, often “il” for list of files… 
 - property param_out: str
- Name of the “out” parameter used by the OTB Application. Default is likely to be “out”, whie some applications use “io.out”. 
 - parameters(meta: Dict) Dict[str, str | int | float | bool | List[str]][source]
- Returns the parameters to use with ExtractNormalVectorToEllipsoid OTB application to generate surface normals for each point of the origin S1 image. 
 - property ram_per_process
- Property ram_per_process 
 - requirement_context() str[source]
- Return the requirement context that permits to fix missing requirements. ComputeNormalsToEllipsoid comes from normlim_sigma0. 
 - tmp_directory(meta) str
- Directory used to store temporary files before they are renamed into their final version. - This property is built from - gen_tmp_dirconstruction parameter. Typical values for the parameter are:- os.path.join(cfg.tmpdir, 'S1')
- os.path.join(cfg.tmpdir, 'S2', '{tile_name}')where- tile_nameis looked into- metaparameter
 
 - 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_filename_meta_post_hook().