Skip to main content

DEMTOOLS

A collection of Python tools for working with DEM (Digital Elevation Model) raster files.

GDAL Installation: GDAL is required for this package. For conda environments, use conda install gdal to install GDAL. For non-conda environments, download the appropriate wheel file from https://github.com/cgohlke/geospatial-wheels/releases to install GDAL.

Installation

pip install -e .

Features

  • asproj: Assign a projection to GeoTIFF files without modifying pixel data (metadata only)
  • chgnodata: Convert (replace) the nodata value of GeoTIFF files, updating pixel data accordingly
  • defnodata: Assign a nodata value to GeoTIFF files without modifying pixel data (metadata only)
  • chkdem (alias: deminfo): Check DEM raster file properties (resolution, projection, extent, nodata) — read-only
  • mvdem: Relocate GeoTIFF files by setting a new upper-left coordinate, without modifying pixel data
  • csv2tif: Convert a plain-numeric CSV raster grid to a GeoTIFF file
  • tif2csv: Convert a GeoTIFF raster band to a plain-numeric CSV grid (the reverse of csv2tif)

Usage

Command-line

# List all available commands
demtools -h

# Show details for a specific command
demtools-info csv2tif

# Assign a projection to all TIF files in the current directory
asproj -a --epsg 3826
asproj -i dem.tif -e 3826

# Convert nodata values for all TIF files in the current directory
chgnodata -a

# Convert nodata of a single file to -9999
chgnodata -i dem.tif -v -9999

# Set nodata metadata for all TIF files (no pixel data change)
defnodata -a -v -9999

# Check DEM raster properties (read-only)
chkdem -a
chkdem -i dem.tif
deminfo -i dem.tif

# Relocate a GeoTIFF by setting a new upper-left coordinate
mvdem -i dem.tif -x 500000 -y 2500000

# Convert a CSV grid to GeoTIFF (origin as lower-left or upper-left corner)
csv2tif -i grid.csv -o dem.tif --xll 250000 --yll 2500000 --cellsize 5 -e 32648
csv2tif -i grid.csv -o dem.tif --xul 250000 --yul 2500100 --cellsize 5 -e 32648

# Convert a GeoTIFF raster band back to a CSV grid
tif2csv -i dem.tif -o grid.csv

Python API

from demtools import asproj, chgnodata, defnodata, chkdem, mvdem, csv2tif, tif2csv

# Assign a projection without touching pixel data
asproj.assign_projection("dem.tif", epsg=3826)

# Convert nodata value in a raster file
chgnodata.convert_nodata_value("dem.tif", output_nodata=-9999)

# Assign nodata metadata without touching pixel values
defnodata.define_nodata_value("dem.tif", nodata_value=-9999)

# Check DEM raster properties (read-only)
chkdem.check_dem_info("dem.tif")

# Relocate a raster by setting a new upper-left coordinate
mvdem.relocate_dem("dem.tif", x=500000, y=2500000)

# Convert CSV grid to GeoTIFF
csv2tif.csv_to_tif(
    input_csv="grid.csv",
    output_tif="dem.tif",
    xll=250000,
    yll=2500000,
    cellsize=5,
    nodata=-999,
    epsg=32648,
)

# Convert a GeoTIFF raster band back to a CSV grid
tif2csv.tif_to_csv(
    input_tif="dem.tif",
    output_csv="grid.csv",
)

Notes

  • asproj, chgnodata, defnodata, and mvdem automatically create a RAS_BAK/ directory with backup copies before modifying files.
  • chkdem (and its deminfo alias) and tif2csv are read-only and never modify the input file.
  • csv2tif expects a plain numeric CSV (no headers), with rows ordered from north to south; tif2csv writes CSVs in the same row order.
  • GDAL must be installed separately via conda or a pre-built wheel; it is not listed in requirements.txt as it cannot be reliably installed via pip on all platforms.

Metadata

Release files for demtools 0.11.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for demtools 0.11.1
File Size Uploaded
demtools-0.11.1.tar.gz 12.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for demtools 0.11.1
File Interpreter ABI Platform
demtools-0.11.1-py3-none-any.whl Python 3 none any Details

Total release size: 31.0 kB

Release files / demtools-0.11.1.tar.gz

Download URL demtools-0.11.1.tar.gz
Size 12.2 kB
Tags Source
SHA-256 checksum
How to use checksums
619d80eb9c422cff6fe5fcff1003badcc7ddfc35f01c235395a13132244d9159
BLAKE2b-256 checksum
How to use checksums
8fe74cd2fe84c28027d57f44439812c644481a518217230bd00a48d671090847
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 23, 2026.

Transparency log

Release files / demtools-0.11.1-py3-none-any.whl

Download URL demtools-0.11.1-py3-none-any.whl
Size 18.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
704d635646d92bc7c2f827324e419919e0a0cfd63b5e84480b2526fa7a8ddd15
BLAKE2b-256 checksum
How to use checksums
4d3dab5f021f6207bbd35bbd3fc863c0d58d1db8beb8d3c2cb1f1803ea092349
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 23, 2026.

Transparency log

Release history Release notifications | RSS feed

0.15.0

2 release files

0.14.0

2 release files

0.13.0

2 release files

0.12.1

2 release files

0.12.0

2 release files

This release

0.11.1 This release

2 release files

0.11.0

2 release files

0.10.5

2 release files

0.10.4

2 release files

0.10.3

2 release files

0.10.1

2 release files

0.9.0

2 release files

0.8.0

2 release files

0.7.3

2 release files

0.7.2

2 release files

0.7.1

2 release files

0.7.0

2 release files

0.6.0

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.1

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page