Skip to main content

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

Project description

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

  • chgnodata: Convert (replace) the nodata value of GeoTIFF files, updating pixel data accordingly
  • setnodata: Assign a nodata value to GeoTIFF files without modifying pixel data (metadata only)
  • csv2tif: Convert a plain-numeric CSV raster grid to a GeoTIFF file

Usage

Command-line

# List all available commands
demtools-info

# 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)
setnodata -a -v -9999

# Convert a CSV grid to GeoTIFF
csv2tif -i grid.csv -o dem.tif --xll 250000 --yll 2500000 --cellsize 5 --epsg 32648

Python API

from demtools import chgnodata, setnodata, csv2tif

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

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

# 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,
)

Notes

  • chgnodata and setnodata automatically create a RAS_BAK/ directory with backup copies before modifying files.
  • csv2tif expects a plain numeric CSV (no headers), with rows ordered from north to south.
  • 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.

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

demtools-0.1.0.tar.gz (7.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

demtools-0.1.0-py3-none-any.whl (9.8 kB view details)

Uploaded Python 3

File details

Details for the file demtools-0.1.0.tar.gz.

File metadata

  • Download URL: demtools-0.1.0.tar.gz
  • Upload date:
  • Size: 7.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for demtools-0.1.0.tar.gz
Algorithm Hash digest
SHA256 ace4fcf9cee8ddf299e388ec04898e0b01f33c4c38fbbcdcbd58e58ab1d334b5
MD5 a6e6f5fdeb60c29d4e0d5895216b41e9
BLAKE2b-256 fb6644434e80acb96bd54948094658190a78d81ee99d69aa949d3ffe70f023a1

See more details on using hashes here.

Provenance

The following attestation bundles were made for demtools-0.1.0.tar.gz:

Publisher: publish.yml on AaronOET/demtools

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file demtools-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: demtools-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 9.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for demtools-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b5be1ea016a93e59bd6f6a78a413a9724cee51d0f30c6851e43a25701132df79
MD5 3d59f4382c14c7f616d1208cbe5b39c7
BLAKE2b-256 8b8e26254796e2a2f7be166e7bf1f3fb691c987c2d2274c5f8a9b8e625bf260d

See more details on using hashes here.

Provenance

The following attestation bundles were made for demtools-0.1.0-py3-none-any.whl:

Publisher: publish.yml on AaronOET/demtools

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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