API reference#
This page provides a summary of xDEM’s API. For more details and examples, refer to the relevant chapters in the main part of the documentation.
Examples using xdem.DEM
#
Iterative closest point coregistration
Spatial propagation of elevation errors
Bias-correction with deramping
Working with a collection of DEMs
Normalized regional hypsometric interpolation
Estimation and modelling of spatial variograms
Estimation and modelling of heteroscedasticity
Standardization for stable terrain as error proxy
DEM#
Important
A DEM
inherits all raster methods and attributes from the Raster
object of GeoUtils.
Below, we only repeat some core attributes and methods of GeoUtils, see
the Raster API in GeoUtils for the full list.
Opening or saving#
Plotting or summarize info#
Create from an array#
|
Create a DEM from a numpy array and the georeferencing information. |
Unique attributes#
Inherited from Raster
#
Array of the raster. |
|
Coordinate reference system of the raster. |
|
Geotransform of the raster. |
|
Nodata value of the raster. |
|
Pixel interpretation of the raster. |
Specific to DEM
#
Vertical coordinate reference system of the DEM. |
Other attributes#
Inherited from Raster
#
See the full list in the Raster API of GeoUtils.
Resolution (X, Y) of the raster in georeferenced units. |
|
Bounding coordinates of the raster. |
|
Width of the raster in pixels. |
|
Height of the raster in pixels. |
|
Shape (i.e., height, width) of the raster in pixels. |
Georeferencing#
Inherited from Raster
#
|
Set a new nodata value for all bands. |
|
Set new pixel interpretation of the raster. |
|
Print summary information about the raster. |
|
Reproject raster to a different geotransform (resolution, bounds) and/or coordinate reference system (CRS). |
|
Crop the raster to a given extent. |
Vertical referencing for DEM
#
|
Set the vertical coordinate reference system of the DEM. |
|
Convert the DEM to another vertical coordinate reference system. |
Raster-vector interface#
Note
See the full list of vector methods in GeoUtils’ documentation.
|
Polygonize the raster into a vector. |
|
Compute proximity distances to the raster target pixels, or to a vector geometry on the raster grid. |
|
Convert raster to point cloud. |
|
Interpolate raster values at a set of points. |
Terrain attributes#
|
Generate a slope map for a DEM, returned in degrees by default. |
|
Calculate the aspect of each cell in a DEM, returned in degrees by default. |
|
Generate a hillshade from the given DEM. |
Calculate the terrain curvature (second derivative of elevation) in m-1 multiplied by 100. |
|
Calculate the terrain curvature parallel to the direction of the slope in m-1 multiplied by 100. |
|
Calculate the terrain curvature perpendicular to the direction of the slope in m-1 multiplied by 100. |
|
Calculate the signed maximum profile or planform curvature parallel to the direction of the slope in m-1 multiplied by 100. |
|
|
Calculates the Topographic Position Index, the difference to the average of neighbouring pixels. |
|
Calculates the Terrain Ruggedness Index, the cumulated differences to neighbouring pixels. |
|
Calculates the roughness, the maximum difference between neighbouring pixels, for any window size. |
Calculates the rugosity, the ratio between real area and planimetric area. |
|
|
Calculates the fractal roughness, the local 3D fractal dimension. |
Or to get multiple related terrain attributes at once (for performance):
|
Derive one or multiple terrain attributes from a DEM. |
Coregistration and bias corrections#
Tip
To build and pass your coregistration pipeline to coregister_3d()
, see the API of Coreg.
|
Coregister DEM to a reference DEM in three dimensions. |
Uncertainty analysis#
|
Estimate uncertainty of DEM. |
Coreg#
Overview of co-registration class structure:
Coregistration, pipeline and blockwise#
|
Generic co-registration processing class. |
|
A sequential set of co-registration processing steps. |
|
Block-wise co-registration processing class to run a step in segmented parts of the grid. |
Fitting and applying transforms#
|
Estimate and apply the coregistration to a pair of elevation data. |
|
Estimate the coregistration transform on the given DEMs. |
|
Apply the estimated transform to a DEM. |
Extracting metadata#
|
Summarize information about this coregistration. |
Metadata dictionary of the coregistration. |
Quick coregistration#
|
A one-line function to coregister a selected DEM to a reference DEM. |
Affine coregistration#
Parent object (to define custom methods)#
|
Generic affine coregistration class. |
Coregistration methods#
|
Vertical translation alignment. |
|
Nuth and Kääb (2011) coregistration, https://doi.org/10.5194/tc-5-271-2011. |
|
Elevation difference minimization coregistration. |
|
Iterative closest point registration, based on Besl and McKay (1992), https://doi.org/10.1117/12.57955. |
Manipulating affine transforms#
|
Instantiate a generic Coreg class from a transformation matrix. |
Convert the transform to a 4x4 transformation matrix. |
|
|
Instantiate a generic Coreg class from a X/Y/Z translation. |
Extract X/Y/Z translations from the affine transformation matrix. |
|
|
Instantiate a generic Coreg class from a X/Y/Z rotation. |
Extract X/Y/Z euler rotations (extrinsic convention) from the affine transformation matrix. |
|
|
Apply a 3D affine transformation matrix to a 3D elevation point cloud or 2.5D DEM. |
|
Invert a transformation matrix. |
Bias-correction#
Parent object (to define custom methods)#
|
Bias-correction (non-rigid alignment) simultaneously with any number and type of variables. |
Bias-correction methods#
|
Correct for a 2D polynomial along X/Y coordinates, for example from residual camera model deformations (dome-like errors) or tilts (rotational errors). |
|
Bias correction for directional biases, for example along- or across-track of satellite angle. |
|
Correct a bias according to terrain, such as elevation or curvature. |
Uncertainty analysis#
Important
Several uncertainty functionalities of xDEM are being implemented directly in SciKit-GStat for spatial statistics
(e.g., fitting a sum of variogram models, pairwise subsampling for grid data). This will allow to simplify several
function inputs and outputs, by relying on a single Variogram()
object.
This will trigger API changes in future package versions.
Core routines for heteroscedasticity, spatial correlations, error propagation#
Infer heteroscedasticity from differenced values on stable terrain and a list of explanatory variables. |
|
Infer spatial correlation of errors from differenced values on stable terrain and a list of variogram model to fit as a sum. |
|
Spatial propagation of elevation errors to an area using the estimated heteroscedasticity and spatial correlations. |
Sub-routines for heteroscedasticity#
|
N-dimensional binning of values according to one or several explanatory variables with computed statistics in each bin. |
|
Estimate an interpolant function for an N-dimensional binning. |
|
Standardize the proxy differenced values using the modelled heteroscedasticity, re-scaled to the spread statistic, and generate the final standardization function. |
Sub-routines for spatial correlations#
Sample empirical variograms with binning adaptable to multiple ranges and spatial subsampling adapted for raster data. |
|
|
Fit a sum of variogram models to an empirical variogram, with weighted least-squares based on sampling errors. |
Construct the spatial correlation function from a dataframe of variogram parameters. |
Sub-routines for error propagation#
|
Compute the number of effective samples, i.e. the number of uncorrelated samples, in an area accounting for spatial correlations described by a sum of variogram models. |
Empirical validation#
|
Monte Carlo patches method that samples multiple patches of terrain, square or circular, of a certain area and computes a statistic in each patch. |
Plotting for uncertainty analysis#
|
Plot empirical variogram, and optionally also plot one or several model fits. |
|
Plot a statistic and its count along a single binning variable. |
|
Plot one statistic and its count along two binning variables. |
Stand-alone functions (moved)#
|
Calculate the normalized median absolute deviation (NMAD) of an array. |
Development classes (removal or re-factoring)#
Caution
The xdem.dDEM
and xdem.DEMCollection
classes will be removed or re-factored in the near future.
dDEM#
|
A difference-DEM object. |
DEMCollection#
|
A temporal collection of DEMs. |