xdem.coreg.BlockwiseCoreg#
- 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.
- Parameters:
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=autowarn_failures (
bool
) – Trigger or ignore warnings for each exception/warning in each block.
Methods
__init__
(step, subdivision[, ...])Instantiate a blockwise processing object.
apply
(elev[, bias_vars, resample, ...])Apply the estimated transform to a DEM.
copy
()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.
info
([as_str])Summarize information about this coregistration.
residuals
(reference_elev, to_be_aligned_elev)Calculate the residual offsets (the difference) between two DEMs after applying the transformation.
stats
()Return statistics for each chunk in the blockwise coregistration.
subdivide_array
(shape)Return the grid subdivision for a given DEM shape.
to_points
()Convert the blockwise coregistration matrices to 3D (source -> destination) points.
Attributes
is_affine
Check if the transform be explained by a 3D affine transform.
is_translation
meta
Metadata dictionary of the coregistration.