Metadata-Version: 2.4
Name: overflow-hydro
Version: 0.3.3
Summary: High-performance Python library for hydrological terrain analysis with parallel, tiled algorithms
Author: Overflow Contributors
License: MIT
Project-URL: Homepage, https://github.com/fema-ffrd/overflow
Project-URL: Documentation, https://fema-ffrd.github.io/overflow/
Project-URL: Repository, https://github.com/fema-ffrd/overflow
Project-URL: Issues, https://github.com/fema-ffrd/overflow/issues
Keywords: hydrology,terrain-analysis,dem,digital-elevation-model,flow-accumulation,watershed,geospatial,gis,parallel-processing,numba
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Science/Research
Classifier: Topic :: Scientific/Engineering :: GIS
Classifier: Topic :: Scientific/Engineering :: Hydrology
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Operating System :: OS Independent
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy<2,>=1.26.4
Requires-Dist: numba>=0.59.0
Requires-Dist: shapely>=2.0.6
Requires-Dist: rich>=13.9.4
Requires-Dist: click>=8.0.0
Provides-Extra: gdal
Requires-Dist: gdal>=3.6.2; extra == "gdal"
Provides-Extra: dev
Requires-Dist: pytest>=8.0.2; extra == "dev"
Requires-Dist: mypy>=1.13.0; extra == "dev"
Requires-Dist: ruff>=0.8.0; extra == "dev"
Provides-Extra: docs
Requires-Dist: mkdocs>=1.5.0; extra == "docs"
Requires-Dist: mkdocs-material>=9.5.0; extra == "docs"
Requires-Dist: mkdocstrings[python]>=0.24.0; extra == "docs"
Requires-Dist: mkdocs-gen-files>=0.5.0; extra == "docs"
Requires-Dist: mkdocs-literate-nav>=0.6.0; extra == "docs"
Requires-Dist: mkdocs-section-index>=0.3.3; extra == "docs"
Dynamic: license-file

# Overflow

[![Tests](https://github.com/fema-ffrd/overflow/actions/workflows/lint_and_test.yml/badge.svg)](https://github.com/fema-ffrd/overflow/actions/workflows/lint_and_test.yml)
[![Documentation](https://github.com/fema-ffrd/overflow/actions/workflows/docs.yml/badge.svg)](https://fema-ffrd.github.io/overflow/)
[![PyPI](https://img.shields.io/pypi/v/overflow-hydro)](https://pypi.org/project/overflow-hydro/)
[![Python Version](https://img.shields.io/pypi/pyversions/overflow-hydro)](https://pypi.org/project/overflow-hydro/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

> **Warning**: This software is currently in alpha status. While functional, it may contain bugs and undergo breaking changes. See the [documentation](https://fema-ffrd.github.io/overflow/) for more details.

Overflow is a high-performance Python library for hydrological terrain analysis that specializes in processing massive Digital Elevation Models (DEMs) through parallel, tiled algorithms.

## Overview

Overflow provides a complete toolchain for extracting hydrographic features from raw elevation data:

- **Terrain Conditioning**: Breach and fill depressions in DEMs
- **Flow Routing**: Calculate D8 flow direction with flat resolution and flow accumulation
- **Feature Extraction**: Extract stream networks, delineate basins, and compute flow lengths

Unlike traditional GIS tools that rely on virtual memory, Overflow uses sophisticated tiled algorithms with parallel processing to handle datasets of any size efficiently.

## Key Features

- **Highly Parallel**: Every algorithm designed for parallel execution using Numba.
- **Memory Efficient**: Process DEMs larger than RAM through tiled algorithms with efficient I/O patterns.
- **Scalable**: Fixed number of passes over data regardless of size. Every operation is designed to scale from laptop-sized datasets to continental DEMs without requiring specialized hardware.
- **Accurate**: Maintains correctness across tile boundaries using graph-based approaches. The algorithms produce results that are equivalent to authoritative methods used throughout the hydrological community.
- **Modern Algorithms**: Implements state-of-the-art priority-flood filling, least-cost breaching, and flat resolution algorithms

## Quick Start

### Installation

```bash
# Create conda environment with system dependencies
conda create -n overflow python gdal -c conda-forge
conda activate overflow

# Install overflow from PyPI
pip install overflow-hydro
```

### Basic Usage

#### Python API

```python
import overflow

# Process a DEM through the complete pipeline
overflow.breach("input.tif", "breached.tif")
overflow.fill("breached.tif", "filled.tif")
overflow.flow_direction("filled.tif", "flowdir.tif")
overflow.accumulation("flowdir.tif", "flowacc.tif")
overflow.streams("flowacc.tif", "flowdir.tif", "streams/")
overflow.basins("flowdir.tif", "basins.tif")
```

#### Command Line Interface

```bash
# Run the complete pipeline
overflow pipeline \
    --dem_file input.tif \
    --output_dir ./results

# Or run individual steps
overflow breach input.tif breached.tif
overflow fill breached.tif filled.tif
overflow flow-direction filled.tif flowdir.tif
overflow accumulation flowdir.tif flowacc.tif
```

### Docker

```bash
docker pull ghcr.io/fema-ffrd/overflow:latest

docker run -v $(pwd):/data ghcr.io/fema-ffrd/overflow:latest \
    pipeline --dem_file /data/input.tif --output_dir /data/results
```

## Documentation

For detailed documentation, algorithm descriptions, and API reference, visit:

**[https://fema-ffrd.github.io/overflow/](https://fema-ffrd.github.io/overflow/)**

## Contributing

We welcome contributions! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.

## License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

## Support

- **Documentation**: [https://fema-ffrd.github.io/overflow/](https://fema-ffrd.github.io/overflow/)
- **Issues**: [GitHub Issues](https://github.com/fema-ffrd/overflow/issues)
