xdem.coreg.BiasCorr#
- class xdem.coreg.BiasCorr(fit_or_bin='fit', fit_func='norder_polynomial', fit_optimizer=<function curve_fit>, bin_sizes=10, bin_statistic=<function nanmedian>, bin_apply_method='linear', bias_var_names=None, subsample=1.0)[source]#
Bias-correction (non-rigid alignment) simultaneously with any number and type of variables.
Variables for bias-correction can include the elevation coordinates (deramping, directional biases), terrain attributes (terrain corrections), or any other user-input variable (quality metrics, land cover).
The binning and/or fitting correction parameters are stored in the self.meta[“outputs”][“fitorbin”].
- __init__(fit_or_bin='fit', fit_func='norder_polynomial', fit_optimizer=<function curve_fit>, bin_sizes=10, bin_statistic=<function nanmedian>, bin_apply_method='linear', bias_var_names=None, subsample=1.0)[source]#
Instantiate an N-dimensional bias correction using binning, fitting or both sequentially.
All fit arguments apply to “fit” and “bin_and_fit”, and bin arguments to “bin” and “bin_and_fit”.
- Parameters:
fit_or_bin (
Union
[Literal
['bin_and_fit'
],Literal
['fit'
],Literal
['bin'
]]) – Whether to fit or bin, or both. Use “fit” to correct by optimizing a function or “bin” to correct with a statistic of central tendency in defined bins, or “bin_and_fit” to perform a fit on the binned statistics.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.
Methods
__init__
([fit_or_bin, fit_func, ...])Instantiate an N-dimensional bias correction using binning, fitting or both sequentially.
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.
Attributes
is_affine
Check if the transform be explained by a 3D affine transform.
is_translation
meta
Metadata dictionary of the coregistration.