demcompare.coregistration.coregistration_template

This module contains the coregistration class template. It contains the structure for all coregistration methods in subclasses and generic coregistration code to avoid duplication.

Module Contents

Classes

CoregistrationTemplate

Class for general specification of a coregistration class

class demcompare.coregistration.coregistration_template.CoregistrationTemplate(cfg: demcompare.internal_typing.ConfigType)[source]

Class for general specification of a coregistration class

_SAMPLING_SOURCE: str[source]
_SAVE_OPTIONAL_OUTPUTS = False[source]
abstract fill_conf_and_schema(cfg: demcompare.internal_typing.ConfigType = None) demcompare.internal_typing.ConfigType[source]

Add default values to the dictionary if there are missing elements and define the configuration schema

Parameters:

cfg (ConfigType) – coregistration configuration

Returns:

cfg coregistration configuration updated

Return type:

ConfigType

check_conf(cfg: demcompare.internal_typing.ConfigType = None) demcompare.internal_typing.ConfigType[source]

Check if the config is correct according to the class configuration schema

raises CheckerError if configuration invalid.

Parameters:

cfg (ConfigType) – coregistration configuration

Returns:

cfg coregistration configuration updated

Return type:

ConfigType

prepare_dems_for_coregistration(sec: xarray.Dataset, ref: xarray.Dataset) Tuple[xarray.Dataset, xarray.Dataset, xarray.Dataset, Tuple[float, float]][source]

Reproject the two input DEMs to the same resolution and size. orig_sec, reproj_sec, reproj_ref and the offset adapting_factor are stored as attributes of the class.

Parameters:
  • sec (xarray Dataset) –

    sec xr.DataSet containing :

    • image : 2D (row, col) xr.DataArray float32

    • georef_transform: 1D (trans_len) xr.DataArray

    • classification_layer_masks : 3D (row, col, indicator) xr.DataArray

  • ref

    ref xr.DataSet containing :

    • image : 2D (row, col) xr.DataArray float32

    • georef_transform: 1D (trans_len) xr.DataArray

    • classification_layer_masks : 3D (row, col, indicator) xr.DataArray

Returns:

reproj_sec xr.Dataset, reproj_ref xr.Dataset, orig_sec xr.Dataset, adapting_factor Tuple[float, float]. The xr.Datasets containing :

  • image : 2D (row, col) xr.DataArray float32

  • georef_transform: 1D (trans_len) xr.DataArray

  • classification_layer_masks : 3D (row, col, indicator) xr.DataArray

Return type:

Transformation

compute_coregistration(sec: xarray.Dataset, ref: xarray.Dataset) demcompare.transformation.Transformation[source]

Reproject and compute coregistration between the two input DEMs. A Transformation object is returned.

Parameters:
  • sec (xarray Dataset) –

    sec xr.DataSet containing :

    • image : 2D (row, col) xr.DataArray float32

    • georef_transform: 1D (trans_len) xr.DataArray

    • classification_layer_masks : 3D (row, col, indicator) xr.DataArray

  • ref

    ref xr.DataSet containing :

    • image : 2D (row, col) xr.DataArray float32

    • georef_transform: 1D (trans_len) xr.DataArray

    • classification_layer_masks : 3D (row, col, indicator) xr.DataArray

Returns:

transformation

Return type:

Transformation

abstract _coregister_dems_algorithm(sec: xarray.Dataset, ref: xarray.Dataset) Tuple[demcompare.transformation.Transformation, xarray.Dataset, xarray.Dataset][source]

Coregister_dems, computes coregistration transform and coregistered DEMS of two DEMs that have the same size and resolution.

Parameters:
  • sec (xarray Dataset) –

    sec xr.DataSet containing :

    • image : 2D (row, col) xr.DataArray float32

    • georef_transform: 1D (trans_len) xr.DataArray

    • classification_layer_masks : 3D (row, col, indicator) xr.DataArray

  • ref (xarray Dataset) –

    ref xr.DataSet containing :

    • image : 2D (row, col) xr.DataArray float32

    • georef_transform: 1D (trans_len) xr.DataArray

    • classification_layer_masks : 3D (row, col, indicator) xr.DataArray

Returns:

transformation, reproj_coreg_sec xr.DataSet, reproj_coreg_ref xr.DataSet. The xr.Datasets containing :

  • image : 2D (row, col) xr.DataArray float32

  • georef_transform: 1D (trans_len) xr.DataArray

  • classification_layer_masks : 3D (row, col, indicator) xr.DataArray

Return type:

Tuple[Transformation, xr.Dataset, xr.Dataset]

save_internal_outputs()[source]

Save the dems obtained from the coregistration to .tif and updates its path on the coregistration_results file

  • ./coregistration/reproj_SEC.tif -> reprojected sec

  • ./coregistration/reproj_REF.tif -> reprojected ref

  • ./coregistration/reproj_coreg_SEC.tif -> reprojected coregistered sec

  • ./coregistration/reproj_coreg_REF.tif -> reprojected coregistered ref

Returns:

None

abstract save_results_dict()[source]

Save the coregistration results on a Dict The altimetric and coregistration results are saved. Logging of the altimetric results is done in this function.

Returns:

None