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

DEM#

Important

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#

DEM.data

Array of the raster.

DEM.crs

Coordinate reference system of the raster.

DEM.transform

Geotransform of the raster.

DEM.nodata

Nodata value of the raster.

Specific to DEM#

DEM.vcrs

Vertical coordinate reference system of the DEM.

Georeferencing#

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#

DEM.set_vcrs(new_vcrs)

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#

Note

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

DEM.polygonize([target_values])

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.

Coregistration#

Tip

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.

DEM.curvature([use_richdem])

Calculate the terrain curvature (second derivative of elevation) in m-1 multiplied by 100.

DEM.profile_curvature([use_richdem])

Calculate the terrain curvature parallel to the direction of the slope in m-1 multiplied by 100.

DEM.planform_curvature([use_richdem])

Calculate the terrain curvature perpendicular to the direction of the slope in m-1 multiplied by 100.

DEM.maximum_curvature([use_richdem])

Calculate the signed maximum profile or planform curvature parallel to the direction of the slope in m-1 multiplied by 100.

DEM.topographic_position_index([window_size])

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.

DEM.roughness([window_size])

Calculates the roughness, the maximum difference between neighbouring pixels, for any window size.

DEM.rugosity()

Calculates the rugosity, the ratio between real area and planimetric area.

DEM.fractal_roughness([window_size])

Calculates the fractal roughness, the local 3D fractal dimension.

dDEM#

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

A difference-DEM object.

DEMCollection#

dDEM#

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

A temporal collection of DEMs.

Coreg#

Overview of co-registration class structure:

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

Coregistration, pipeline and blockwise#

xdem.coreg.Coreg([meta])

Generic co-registration processing class.

xdem.coreg.CoregPipeline(pipeline)

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:

xdem.coreg.VerticalShift([...])

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.

xdem.coreg.Tilt([subsample])

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#

xdem.terrain

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

Volume integration methods#

xdem.volume

Volume change calculation tools (aimed for glaciers).

Fitting methods#

xdem.fit

Functions to perform normal, weighted and robust fitting.

Filtering methods#

xdem.filters

Filters to remove outliers and reduce noise in DEMs.

Spatial statistics methods#

xdem.spatialstats

Spatial statistical tools to estimate uncertainties related to DEMs