xdem.coreg.TerrainBias#
- class xdem.coreg.TerrainBias(terrain_attribute='maximum_curvature', fit_or_bin='bin', fit_func='norder_polynomial', fit_optimizer=<function curve_fit>, bin_sizes=100, bin_statistic=<function nanmedian>, bin_apply_method='linear', subsample=1.0)[source]#
Correct a bias according to terrain, such as elevation or curvature.
With elevation: often useful for nadir image DEM correction, where the focal length is slightly miscalculated. With curvature: often useful for a difference of DEMs with different effective resolution.
DISCLAIMER: An elevation correction may introduce error when correcting non-photogrammetric biases, as generally elevation biases are interlinked with curvature biases. See Gardelle et al. (2012) (Figure 2), http://dx.doi.org/10.3189/2012jog11j175, for curvature-related biases.
- __init__(terrain_attribute='maximum_curvature', fit_or_bin='bin', fit_func='norder_polynomial', fit_optimizer=<function curve_fit>, bin_sizes=100, bin_statistic=<function nanmedian>, bin_apply_method='linear', subsample=1.0)[source]#
Instantiate a terrain bias correction.
- Parameters:
terrain_attribute (
str) – Terrain attribute to use for correction.fit_or_bin (
Union[Literal['bin_and_fit'],Literal['fit'],Literal['bin']]) – Whether to fit or bin. Use “fit” to correct by optimizing a function or “bin” to correct with a statistic of central tendency in defined bins.fit_func (
Union[Callable[...,ndarray[Any,dtype[floating[Any]]]],Literal['norder_polynomial'],Literal['nfreq_sumsin']]) – Function to fit to the bias with variables later passed in .fit().fit_optimizer (
Callable[...,tuple[ndarray[Any,dtype[floating[Any]]],Any]]) – Optimizer to minimize the function.bin_sizes (
int|dict[str,Union[int,Iterable[float]]]) – Size (if integer) or edges (if iterable) for binning variables later passed in .fit().bin_statistic (
Callable[[ndarray[Any,dtype[floating[Any]]]],floating[Any]]) – Statistic of central tendency (e.g., mean) to apply during the binning.bin_apply_method (
Union[Literal['linear'],Literal['per_bin']]) – Method to correct with the binned statistics, either “linear” to interpolate linearly between bins, or “per_bin” to apply the statistic for each bin.subsample (
float|int) – Subsample the input for speed-up. <1 is parsed as a fraction. >1 is a pixel count.
Methods
__init__([terrain_attribute, fit_or_bin, ...])Instantiate a terrain bias correction.
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.
residuals(reference_elev, to_be_aligned_elev)Calculate the residual offsets (the difference) between two DEMs after applying the transformation.
Attributes
is_affineCheck if the transform be explained by a 3D affine transform.
metaMetadata dictionary of the coregistration.