Skip to main content

Set of tools to manipulate Digital Elevation Models (DEMs)

Project description

xdem

Set of tools to manipulate Digital Elevation Models (DEMs)

More documentation to come!

Documentation Status build

Installation

$ git clone https://github.com/GlacioHack/xdem.git
$ cd ./xdem
$ conda env create -f environment.yml
$ conda activate xdem
$ pip install .

or

pip install git+https://github.com/GlacioHack/xdem.git

To update, please use the --force-reinstall flag for conda or pip to ensure the latest version is installed (geoutils and xdem do not yet have proper release schedules as of 2021-05-13).

Structure

xdem are for now composed of three libraries:

  • coreg.py with tools covering differet aspects of DEM coregistration
  • spatial_tools.py for spatial operations on DEMs
  • dem.py for DEM-specific operations, such as vertical datum correction.

How to contribute

You can find ways to improve the libraries in the issues section. All contributions are welcome. To avoid conflicts, it is suggested to use separate branches for each implementation. All changes must then be submitted to the dev branch using pull requests. Each PR must be reviewed by at least one other person.

Documentation

See the documentation at https://xdem.readthedocs.io

Testing - again please read!

These tools are only valuable if we can rely on them to perform exactly as we expect. So, we need testing. Please create tests for every function that you make, as much as you are able. Guidance/examples here for the moment: https://github.com/GeoUtils/georaster/blob/master/test/test_georaster.py https://github.com/corteva/rioxarray/blob/master/test/integration/test_integration__io.py

Examples

Coregister a DEM to another DEM

import xdem

reference_dem = xdem.DEM("path/to/reference.tif")
dem_to_be_aligned = xdem.DEM("path/to/dem.tif")

nuth_kaab = xdem.coreg.NuthKaab()

nuth_kaab.fit(reference_dem.data, dem_to_be_aligned.data, transform=reference_dem.transform)


aligned_dem = xdem.DEM.from_array(
	nuth_kaab.apply(dem_to_be_aligned.data, transform=dem_to_be_aligned.transform),
	transform=dem_to_be_aligned.transform,
	crs=dem_to_be_aligned.crs
)

aligned_dem.save("path/to/coreg.tif")

This is an implementation of the Nuth and Kääb (2011) approach. Please see the documentation for more approaches.

Subtract one DEM with another

import xdem

first_dem = "path/to/first.tif"
second_dem = "path/to/second.tif"

difference = xdem.spatial_tools.subtract_rasters(first_dem, second_dem)

difference.save("path/to/difference.tif")

By default, second_dem is reprojected to fit first_dem. This can be switched with the keyword argument reference="second". The resampling method can also be changed (e.g. resampling_method="nearest") from the default "cubic_spline".

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

xdem-0.0.2.post1.tar.gz (46.0 kB view details)

Uploaded Source

Built Distribution

xdem-0.0.2.post1-py3-none-any.whl (47.5 kB view details)

Uploaded Python 3

File details

Details for the file xdem-0.0.2.post1.tar.gz.

File metadata

  • Download URL: xdem-0.0.2.post1.tar.gz
  • Upload date:
  • Size: 46.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4

File hashes

Hashes for xdem-0.0.2.post1.tar.gz
Algorithm Hash digest
SHA256 5b31c5b0b48225cc144836a3ca6ef4b1b1ef5a10d4d6e38ad5eaa4bb7d9bc196
MD5 3e31f36da11adc82cf1b33e8ffdac213
BLAKE2b-256 223816bd97808195e6dc7fbc43f272485568704d5203800a15957f8c04d2d53c

See more details on using hashes here.

File details

Details for the file xdem-0.0.2.post1-py3-none-any.whl.

File metadata

  • Download URL: xdem-0.0.2.post1-py3-none-any.whl
  • Upload date:
  • Size: 47.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4

File hashes

Hashes for xdem-0.0.2.post1-py3-none-any.whl
Algorithm Hash digest
SHA256 015b3908572003a4afcb139ae6b088a9ad1a9b69c6a16e70a1fcf4815c848729
MD5 dbd5d8500d887ca0b491ac120d2a6fe0
BLAKE2b-256 8541a2c1efa8a70ff772b8bef224c6c0a4050c659dab21e99fb83de012fd9474

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page