xDEM is an open source project to develop a core Python package for the analysis of digital elevation models (DEMs) and elevation point clouds (EPCs).
It aims at providing modular and robust tools for the most common analyses needed with elevation data, including geospatial operations (vertical referencing), terrain analysis/geomorphometry (e.g., slope, aspect, curvatures, roughness indexes), 3D coregistration, corrections and uncertainty analysis from a wide range of peer-reviewed studies (see Methods section below for the full list).
The core manipulation of elevation data is conveniently centered around DEM and EPC classes. Terrain analysis
is implemented in a modular way to support state-of-the art methods (and, notably, re-implements all tools
of gdalDEM). More complex pipelines (e.g., 3D rigid coregistration, bias corrections) are built around
modular Coreg objects that easily interface between themselves.
Additionally, for raster and point cloud functionalities, xDEM inherits many convenient functionalities from GeoUtils. Those include implicit loading, numerical interfacing and convenient object-based geospatial methods to easily perform the most common higher-level tasks needed by geospatial users (e.g., reprojection, cropping, vector masking). Through GeoUtils, xDEM relies on Rasterio, GeoPandas and Pyproj for georeferenced calculations, and on NumPy, SciPy (and optionally Numba) for efficient numerics. It allows easy access to the functionalities of these packages through interfacing or composition, and quick inter-operability through object conversion.
If you are looking for an accessible Python package to write the Python equivalent of your GDAL command lines, or of your QGIS analysis pipeline without a steep learning curve on Python GIS syntax, xDEM is perfect for you! For more advanced users, xDEM also aims at being efficient and scalable by supporting lazy loading and parallel computing (ongoing).
For a quick start, full feature description or search through the API, see xDEM's documentation at: https://xdem.readthedocs.io.
mamba install -c conda-forge xdemSee mamba's documentation to install mamba, which will solve your environment much faster than conda.
pip install xdemBelow is a summary of the methods implemented in xDEM.
- Terrain attributes:
- Partial derivatives (for slope, aspect, curvatures) of Horn (1981) or Zevenbergen and Thorne (1987) or Florinsky (2009) (default),
- Slope, aspect and hillshade of either Horn (1981) or Zevenbergen and Thorne (1987) (default),
- Profile curvature, either geometric from Krcho (1973) and Evans (1979), or directional from Zevenbergen and Thorne, 1987,
- Tangential curvature, either geometric from Krcho (1983), or directional from Zevenbergen and Thorne, 1987,
- Planform curvature, only geometric from Sobolevsky (1932),
- Flowline curvature, either geometric from Minár et al. (2020), or directional from Shary (1991),
- Maximal/maximum and minimal/minimum curvature, either geometric from Shary (1995), or directional from Wood (1996),
- Topographic position index of Weiss (2001),
- Terrain ruggedness index of either Riley et al. (1999) or Wilson et al. (2007),
- Roughness of Dartnell (2000),
- Rugosity of Jenness (2004),
- Fractal roughness of Taud et Parrot (2005),
- Texture shading of Brown (2010) and Allmendinger and Karabinos (2023),
- 3D coregistration:
- Iterative closest point (ICP) of Besl and McKay (1992) and Chen and Medioni (1992),
- Least Z-difference (LZD) of Rosenholm and Torlegård (1988),
- Coherent point drift (CPD) of Myronenko and Song (2010),
- Horizontal shift from aspect/slope relationship of Nuth and Kääb (2011),
- 3D bias-correction:
- Along-track multi-sinusoidal noise by basin-hopping of Girod et al. (2017),
- Curvature-based correction of Gardelle et al. (2012),
- Elevation-based correction of Nuth and Kääb (2011),
- Uncertainty analysis:
- Heteroscedasticity and multi-range correlations from stable terrain of Rolstad et al. (2009) and Hugonnet et al. (2022),
When using a method implemented in xDEM, please cite both the package and the related study.
For xDEM, use the following DOI:
We welcome new contributions, and will happily help you integrate your own DEM routines into xDEM!
After discussing a new feature or bug fix in an issue, you can open a PR to xDEM with the following steps:
- Fork the repository, make a feature branch and push changes.
- When ready, submit a pull request from the feature branch of your fork to
GlacioHack/xdem:main. - The PR will be reviewed by at least one maintainer, discussed, then merged.
More details on our contributing page.