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#

DEM differencing

DEM differencing

Elevation error map

Elevation error map

Spatial correlation of errors

Spatial correlation of errors

Nuth and Kääb coregistration

Nuth and Kääb coregistration

Iterative closest point coregistration

Iterative closest point coregistration

Spatial propagation of elevation errors

Spatial propagation of elevation errors

Terrain attributes

Terrain attributes

Bias correction with deramping

Bias correction with deramping

Working with a collection of DEMs

Working with a collection of DEMs

Blockwise coregistration

Blockwise coregistration

Normalized regional hypsometric interpolation

Normalized regional hypsometric interpolation

Slope and aspect methods

Slope and aspect methods

Estimation and modelling of spatial variograms

Estimation and modelling of spatial variograms

Estimation and modelling of heteroscedasticity

Estimation and modelling of heteroscedasticity

Standardization for stable terrain as error proxy

Standardization for stable terrain as error proxy



A DEM inherits all raster methods and attributes from the Raster object of GeoUtils. Below, we only repeat the core attributes and methods of GeoUtils, see the Raster API in GeoUtils for the full list.

Opening or saving a DEM#

DEM(filename_or_dataset[, vcrs, silent])

The digital elevation model.

DEM.info([stats, verbose])

Print summary information about the raster.

DEM.save(filename[, driver, dtype, nodata, ...])

Write the raster to file.

Plotting a DEM#

DEM(filename_or_dataset[, vcrs, silent])

The digital elevation model.

DEM.plot([bands, cmap, vmin, vmax, alpha, ...])

Plot the raster, with axes in projection of image.

Create from an array#

DEM.from_array(data, transform, crs[, ...])

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.

Specific to DEM#


Vertical coordinate reference system of the DEM.


Inherited from Raster#

DEM.reproject([ref, crs, res, grid_size, ...])

Reproject raster to a different geotransform (resolution, bounds) and/or coordinate reference system (CRS).

DEM.crop(crop_geom[, mode, inplace])

Crop the raster to a given extent.

Vertical referencing for DEM#


Set the vertical coordinate reference system of the DEM.

DEM.to_vcrs(vcrs[, force_source_vcrs, inplace])

Convert the DEM to another vertical coordinate reference system.

Raster-vector interface#


See the full list of vector methods in GeoUtils’ documentation.


Polygonize the raster into a vector.

DEM.proximity([vector, target_values, ...])

Compute proximity distances to the raster target pixels, or to a vector geometry on the raster grid.



To build and pass your coregistration pipeline to coregister_3d(), see the API of Coreg.

DEM.coregister_3d(reference_elev[, ...])

Coregister DEM to a reference DEM in three dimensions.

Terrain attributes#

DEM.slope([method, degrees, use_richdem])

Generate a slope map for a DEM, returned in degrees by default.

DEM.aspect([method, degrees, use_richdem])

Calculate the aspect of each cell in a DEM, returned in degrees by default.

DEM.hillshade([method, azimuth, altitude, ...])

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.

DEM.terrain_ruggedness_index([method, ...])

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.


dDEM(raster, start_time, end_time[, error])

A difference-DEM object.



DEMCollection(dems[, timestamps, outlines, ...])

A temporal collection of DEMs.


Overview of co-registration class structure:

Inheritance diagram of xdem.coreg.base, xdem.coreg.affine, xdem.coreg.biascorr

Coregistration, pipeline and blockwise#


Generic co-registration processing class.


A sequential set of co-registration processing steps.

xdem.coreg.BlockwiseCoreg(step, subdivision)

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

Fitting and applying transforms#

xdem.coreg.Coreg.fit(reference_elev, ...[, ...])

Estimate the coregistration transform on the given DEMs.

xdem.coreg.Coreg.apply(elev[, bias_vars, ...])

Apply the estimated transform to a DEM.

Other functionalities#

xdem.coreg.Coreg.residuals(reference_elev, ...)

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

Affine coregistration methods#

Generic parent class:

xdem.coreg.AffineCoreg([subsample, matrix, meta])

Generic affine coregistration class.

Convenience classes for specific coregistrations:


Vertical translation alignment.

xdem.coreg.NuthKaab([max_iterations, ...])

Nuth and Kääb (2011) coregistration, https://doi.org/10.5194/tc-5-271-2011.

xdem.coreg.ICP([max_iterations, tolerance, ...])

Iterative closest point registration, based on Besl and McKay (1992), https://doi.org/10.1117/12.57955.


Tilt alignment.

Bias-correction (including non-affine coregistration) methods#

Generic parent class:

xdem.coreg.BiasCorr([fit_or_bin, fit_func, ...])

Bias-correction (non-rigid alignment) simultaneously with any number and type of variables.

Convenience classes for specific corrections:

xdem.coreg.Deramp([poly_order, fit_or_bin, ...])

Correct for a 2D polynomial along X/Y coordinates, for example from residual camera model deformations (dome-like errors).

xdem.coreg.DirectionalBias([angle, ...])

Bias correction for directional biases, for example along- or across-track of satellite angle.

xdem.coreg.TerrainBias([terrain_attribute, ...])

Correct a bias according to terrain, such as elevation or curvature.

Terrain attributes#


Terrain attribute calculations, such as slope, aspect, hillshade, curvature and ruggedness indexes.

Volume integration methods#


Volume change calculation tools (aimed for glaciers).

Fitting methods#


Functions to perform normal, weighted and robust fitting.

Filtering methods#


Filters to remove outliers and reduce noise in DEMs.

Spatial statistics methods#


Spatial statistical tools to estimate uncertainties related to DEMs