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.5.0.tar.gz (8.4 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.5.0-py3-none-any.whl (10.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: demtools-0.5.0.tar.gz
  • Upload date:
  • Size: 8.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for demtools-0.5.0.tar.gz
Algorithm Hash digest
SHA256 afaac616c50cf50d805880633910a52af59a6f86807e17800d734eb0253c5ed1
MD5 043581df8173f2a14281a45364c8a912
BLAKE2b-256 1acd7d12e806e7b8a6f6920b18e8269c9a6afc330905657624bd0c70aa2ce5ea

See more details on using hashes here.

File details

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

File metadata

  • Download URL: demtools-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 10.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for demtools-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3c90e43cdbd8fea7bc873075de12cff574063ffdb76b48fac51659ae942d6dfd
MD5 03c7535485d6fde82b5883864200b299
BLAKE2b-256 c71f7bb85aec018df4b86bf557b921d32bca597744c2997581e9f7640b8d9a08

See more details on using hashes here.

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