class xdem.coreg.BlockwiseCoreg(step, subdivision, success_threshold=0.8, n_threads=None, warn_failures=False)[source]#

Block-wise co-registration processing class to run a step in segmented parts of the grid.

A processing class of choice is run on an arbitrary subdivision of the raster. When later applying the step the optimal warping is interpolated based on X/Y/Z shifts from the coreg algorithm at the grid points.

For instance: a subdivision of 4 triggers a division of the DEM in four equally sized parts. These parts are then processed separately, with 4 .fit() results. If the subdivision is not divisible by the raster shape, subdivision is made as good as possible to have approximately equal pixel counts.

__init__(step, subdivision, success_threshold=0.8, n_threads=None, warn_failures=False)[source]#

Instantiate a blockwise processing object.

  • step (Coreg | CoregPipeline) – An instantiated co-registration step object to fit in the subdivided DEMs.

  • subdivision (int) – The number of chunks to divide the DEMs in. E.g. 4 means four different transforms.

  • success_threshold (float) – Raise an error if fewer chunks than the fraction failed for any reason.

  • n_threads (int | None) – The maximum amount of threads to use. Default=auto

  • warn_failures (bool) – Trigger or ignore warnings for each exception/warning in each block.


__init__(step, subdivision[, ...])

Instantiate a blockwise processing object.

apply(elev[, bias_vars, resample, ...])

Apply the estimated transform to a DEM.


Return an identical copy of the class.

error(reference_elev, to_be_aligned_elev[, ...])

Calculate the error of a coregistration approach.

fit(reference_elev, to_be_aligned_elev[, ...])

Estimate the coregistration transform on the given DEMs.

fit_and_apply(reference_elev, to_be_aligned_elev)

Estimate and apply the coregistration to a pair of elevation data.

residuals(reference_elev, to_be_aligned_elev)

Calculate the residual offsets (the difference) between two DEMs after applying the transformation.


Return statistics for each chunk in the blockwise coregistration.


Return the grid subdivision for a given DEM shape.


Convert the blockwise coregistration matrices to 3D (source -> destination) points.



Check if the transform be explained by a 3D affine transform.


Metadata dictionary of the coregistration.