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.1.tar.gz (30.9 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.1-py3-none-any.whl (21.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: hydro_topo_features-0.1.1.tar.gz
  • Upload date:
  • Size: 30.9 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.1.tar.gz
Algorithm Hash digest
SHA256 04bff1792d4f4eaab8a75918af6e38286065d9bbc5b25d23dd1f2af6020bb1da
MD5 a845875aec13aa45ac20a003fb2c173d
BLAKE2b-256 eeae91ec062c05b3b3e5724a04193cc3a001a4c8b5fefbc9fb8de81a4ef9c4af

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hydro_topo_features-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3f101ce3bdee3ed79b5d1f842a173947c6c609699654fb89395436fb4506dc11
MD5 d71b7ee85c1413db2e96582169e2f8f2
BLAKE2b-256 896641e309e64910d88fcf0fd9adc2a49346891eb86f55d0dd00a6df7099f2a3

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