Skip to main content

Extract hydro-topographic features from DEM and OSM data

Project description

Hydro-Topo Features

A Python package for the automated extraction of hydro-topographic features from Digital Elevation Models (DEMs) and OpenStreetMap (OSM) water data. These features are critical for understanding flood susceptibility and analyzing terrain characteristics.

PyPI Version Documentation Status License: MIT

Overview

This package implements a quasi-global, automated workflow for the extraction of three key hydro-topographic variables:

  1. Height Above Nearest Drainage (HAND): Vertical distance to the nearest drainage channel
  2. Euclidean Distance to Waterbody (EDTW): Straight-line distance to the nearest water body
  3. Terrain Slope: Maximum rate of elevation change

The extracted features provide critical contextual information for flood susceptibility analysis, hydrological modeling, and terrain characterization.

Key Features

  • DEM Conditioning: Implemented using the four-step process inspired by MERIT Hydro:
    • Stream burning (lowering the DEM by 20m along water features)
    • Pit filling (removing single-cell depressions)
    • Depression filling (removing multi-cell depressions)
    • Resolving flats (creating synthetic flow gradients)
  • Feature Extraction:
    • HAND: Height Above Nearest Drainage computation
    • EDTW: Euclidean Distance to Waterbody computation
    • Slope: Terrain gradient calculation using Horn's method
  • Data Sources:
    • DEM: Compatible with FathomDEM (1 arc second ~30m grid spacing)
    • Water features: Automatically extracted from OpenStreetMap (OSM)
  • Visualization:
    • Static maps with customizable parameters
    • Interactive web maps for exploration

Installation

Using pip

pip install hydro-topo-features

From source

# Clone the repository
git clone https://github.com/yourusername/hydro-topo-features.git
cd hydro-topo-features

# Create a conda environment
conda create -n hydro_topo_env python=3.11
conda activate hydro_topo_env

# Install dependencies and package
pip install -e .

Quick Start

from hydro_topo_features.pipeline import run_pipeline

outputs = run_pipeline(
    site_id="my_area",
    aoi_path="path/to/area_of_interest.shp",
    dem_tile_folder_path="path/to/dem_tiles/",
    output_path="outputs",
    create_static_maps=True,
    create_interactive_map=True
)

# Print output paths
for key, path in outputs.items():
    print(f"{key}: {path}")

Command Line Usage

python test_hydro_topo.py --site-id my_area \
                         --aoi-path path/to/area_of_interest.shp \
                         --dem-dir path/to/dem_tiles/ \
                         --output-dir outputs \
                         --static-maps \
                         --interactive-map

Workflow Details

  1. DEM Conditioning

    • Stream burning with a constant depth of 20m along OSM-derived water features
    • Pit filling to remove single-cell depressions
    • Depression filling using the Priority-Flood algorithm
    • Resolving flat areas by creating artificial drainage gradients
  2. Flow Direction Calculation

    • Uses the deterministic D8 method for flow direction computation
  3. Feature Extraction

    • HAND: Traces flow paths downstream to calculate elevation difference
    • Slope: Computes maximum rate of elevation change in degrees
    • EDTW: Calculates Euclidean distance to nearest water cell
  4. Visualization

    • Creates static maps with proper scaling and colormaps
    • Generates interactive web maps for data exploration

Documentation

For comprehensive documentation, please visit: https://hydro-topo-features.readthedocs.io/

License

This project is licensed under the MIT License - see the LICENSE file for details.

Citation

If you use this package in your research, please cite:

@software{hydro_topo_features,
  author = {Hosch, Paul},
  title = {Hydro-Topo Features: A Python package for extracting hydro-topographic features},
  year = {2023},
  url = {https://github.com/yourusername/hydro-topo-features}
}

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

hydro_topo_features-0.1.0.tar.gz (30.3 kB view details)

Uploaded Source

Built Distribution

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

hydro_topo_features-0.1.0-py3-none-any.whl (20.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: hydro_topo_features-0.1.0.tar.gz
  • Upload date:
  • Size: 30.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.12

File hashes

Hashes for hydro_topo_features-0.1.0.tar.gz
Algorithm Hash digest
SHA256 c65a517bf6b7a1d6fda31d097bf61f4fe13c1770cf1febf09840f895cd44cfcb
MD5 1f1269e8e85aec45a909d8c44acf627a
BLAKE2b-256 a3ae8545cc8acf6d37a38906d7b4bc12509fbfd9e8ac5358b4687eae3687844c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hydro_topo_features-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cac99164de25b82f33f4cb6090388e370bdf37b46c8c2fdc6bac6ecb505be353
MD5 92025dd2c21600885e788398d7fd51e7
BLAKE2b-256 e4f85826dfc1c0a9002050de530d044f6dae63597f68bd58dc9ce19db59fb1a6

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