DEM alignment (Nuth & Kääb + optional ICP) via ASP pc_align/point2dem
Project description
demalign
Authors: Aram Fathian; Dan Shugar
Affiliation: Department of Earth, Energy, and Environment; Water, Sediment, Hazards, and Earth-surface Dynamics (waterSHED) Lab; University of Calgary
License: MIT
demalign aligns a source DEM (e.g., a DSM from SkySatPrep + Metashape) to a stable reference DEM (e.g., COP30) using
NASA Ames Stereo Pipeline (ASP) tools: it estimates the horizontal/vertical translation using Nuth & Kääb, optionally refines
with ICP (point-to-plane), applies the inverse transform to the source, and re-grids to a DEM with point2dem.
- Fast downsampled transform estimation (Nuth & Kääb)
- Optional ICP refine, then apply transform at full resolution
- Re-grid the transformed source cloud into a DEM in your target CRS/resolution
- Outputs suitable for DEM of Difference (DoD) workflows
demalign is a Python CLI wrapper around the proven ASP workflow (
pc_align+point2dem).
Installation
Quick install (recommended)
Use a fresh Conda environment so GDAL CLI and Python bindings (if used) won’t conflict.
# 1) Create & activate env (Linux/macOS/WSL)
conda create -n demalign -c conda-forge -y python=3.10 gdal numpy
conda activate demalign
# 2) Install the package (from source for now)
# pip install demalign # (once on PyPI)
pip install -e . # if you're in the repo folder
External dependencies (required)
-
NASA Ames Stereo Pipeline (ASP) ≥ 3.3 (provides
pc_align,point2dem)
Download & install: https://github.com/NeoGeographyToolkit/StereoPipelineThen set on every shell:
export ASP_HOME="$HOME/StereoPipeline" export PATH="$ASP_HOME/bin:$PATH" export LD_LIBRARY_PATH="$ASP_HOME/lib:${LD_LIBRARY_PATH:-}" export CSM_PLUGIN_PATH="$ASP_HOME/lib/csmplugins" # verify pc_align --help | head -n 3 point2dem --help | head -n 3
-
GDAL (CLI) for
gdal_translatedownsampling used internallygdalinfo --version
Alternative install options
A) From GitHub (specific tag):
pip install "git+https://github.com/aramfathian/demalign.git@v0.1.0"
B) From source (editable dev install):
# inside the repo folder
pip install -e .[dev]
Notes on dependencies
- ASP is an external dependency;
demalignshells out topc_alignandpoint2dem. gdal_translateis used for quick downsampling; GDAL itself is not a Python dependency here.
Usage (examples)
Basic: align a source DEM to a reference DEM and write an aligned DEM.
demalign --source /path/to/source_dem.tif --reference /path/to/reference_dem.tif --epsg 32608 --tr 5 --out /path/to/out_dir
Common options
--downsample 25Downsample percent for fast transform estimation (default: 25)--no-icpDisable ICP refine (Nuth & Kääb only)--max-disp-nuth 600Max displacement for Nuth stage (m)--max-disp-icp 300Max displacement for ICP stage (m)--nodata -9999Nodata value for outputs (default: -9999)--keep-intermediateKeep intermediate clouds/downsized DEMs--asp-homeOverrideASP_HOMEdetection--no-regridCompute transform only; do not runpoint2dem
Outputs
nuth-transform.txt,nuth-inverse-transform.txt(and, if used,icp-*.txt)full_SOURCE-trans_source.tif(transformed source point cloud frompc_align)aligned_dem.tif(DEM frompoint2dem), unless--no-regrid
Workflow tips
- Use a stable reference DEM (e.g., COP30) that matches the height datum of your source DEM (ellipsoidal vs orthometric).
- Work in a consistent projected CRS (e.g., the scene’s UTM zone) and pass it via
--epsg. - Start with the default
--downsample 25for robust, fast estimation; increase for very noisy DEMs. - If terrain is complex or initial offsets are large, enable ICP (
--no-icpnot set) for refinement.
Troubleshooting
ASP not found→ SetASP_HOMEand/or make surepc_alignandpoint2demare on yourPATH.gdal_translate: not found→ Install GDAL CLI (conda install -c conda-forge gdal).- Huge datasets → Increase
--downsampleto speed transform estimation; keep--keep-intermediatefor QA. - CRS issues → Always pass the correct
--epsg; the output DEM will be gridded in that CRS.
How to cite
Fathian, A., Shugar, D. (2025). demalign (v0.2.0) [Software]. Zenodo. https://doi.org/10.5281/zenodo.17157750
License
MIT (see LICENSE).
Acknowledgements
Built around the NASA Ames Stereo Pipeline tools (pc_align, point2dem) and a production-tested shell workflow adapted to a reusable Python CLI. See: https://stereopipeline.readthedocs.io/en/latest/index.html
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file demalign-0.2.0.tar.gz.
File metadata
- Download URL: demalign-0.2.0.tar.gz
- Upload date:
- Size: 6.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9112df6521bba8a9ef196fb6ad04d5bb7656bc9fb8567ac9219683c0c1356944
|
|
| MD5 |
d89ad51a1de56338cebb41d5f1149052
|
|
| BLAKE2b-256 |
773a98b1f58ce09376d2b9f59e602231e4ed47a67562ccb69e58ede849d6a2a0
|
Provenance
The following attestation bundles were made for demalign-0.2.0.tar.gz:
Publisher:
publish.yml on aramfathian/demalign
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
demalign-0.2.0.tar.gz -
Subject digest:
9112df6521bba8a9ef196fb6ad04d5bb7656bc9fb8567ac9219683c0c1356944 - Sigstore transparency entry: 536924264
- Sigstore integration time:
-
Permalink:
aramfathian/demalign@494234f85c492789c99bb2ecb6889e28422acd17 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/aramfathian
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@494234f85c492789c99bb2ecb6889e28422acd17 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file demalign-0.2.0-py3-none-any.whl.
File metadata
- Download URL: demalign-0.2.0-py3-none-any.whl
- Upload date:
- Size: 7.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c9a44156fabb01aa8b4ab5ec77e9a42fa9d2bd3afc1f4da020fb5fbff7a6573f
|
|
| MD5 |
c69c095c4cf8fbb8abef24d68bf40356
|
|
| BLAKE2b-256 |
83ab964163a2e4fb7920fa1f66527173963e4df2d8be592e2262091c06b2b877
|
Provenance
The following attestation bundles were made for demalign-0.2.0-py3-none-any.whl:
Publisher:
publish.yml on aramfathian/demalign
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
demalign-0.2.0-py3-none-any.whl -
Subject digest:
c9a44156fabb01aa8b4ab5ec77e9a42fa9d2bd3afc1f4da020fb5fbff7a6573f - Sigstore transparency entry: 536924291
- Sigstore integration time:
-
Permalink:
aramfathian/demalign@494234f85c492789c99bb2ecb6889e28422acd17 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/aramfathian
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@494234f85c492789c99bb2ecb6889e28422acd17 -
Trigger Event:
workflow_dispatch
-
Statement type: