Skip to main content

Watershed delineation + characterization — global pour-point delineation (NLDI + MERIT-Hydro), geomorphics, TWI, and watershed-scale hydrological signatures

Project description

aihydro-watershed

Watershed delineation + characterization for any point on Earth — as a standalone package.

Delineate a watershed from a USGS gauge or any global lat/lon pour point, then characterize it (geomorphics, topographic wetness index, terrain/runoff, watershed-scale hydrological signatures) — without installing the full AI-Hydro MCP hydrology stack.

Part of the AI-Hydro ecosystem. Carved out of aihydro-tools in Wave A of the ecosystem roadmap.

Install

# Delineation (fast tier: cloud DEM + pysheds + MERIT-Hydro/pyflwdir)
pip install "aihydro-watershed[delineation]"

# Characterization + signatures
pip install "aihydro-watershed[analysis]"

# Everything
pip install "aihydro-watershed[all]"

On Python 3.13, the analysis extra omits xrspatial (no wheel); use analysis-legacy on Python 3.10–3.12 if you need TWI via xarray-spatial.

Quick start

from aihydro_watershed.delineation.router import delineate_from_point

# CONUS pour point — uses NLDI automatically
result = delineate_from_point(40.7128, -74.0060, method="auto")
print(result.data["area_km2"])          # 1234.5
print(result.data["method_used"])       # "nldi_comid"

# Global pour point (Rhine at Cologne) — falls back to fast DEM tier
result = delineate_from_point(50.932, 6.970, method="auto")
print(result.data["area_km2"])

# Expected drainage area known? Pass it to improve COMID selection
result = delineate_from_point(39.27, -77.54, expected_area_km2=25_000)

Results are typed HydroResult (from aihydro-core) — provenance-stamped with tool path, version, parameters, and data sources.

What's inside

Subpackage Capability
delineation Global pour-point / gauge delineation. Three tiers: NLDI (CONUS NHD-indexed), MERIT-Hydro/pyflwdir (local flowdir cache), MERIT-Basins hybrid (vector topology + raster refinement). Auto-routing chooses the best available tier.
merit MERIT-Hydro data management: regional basin cache, flowdir rasters, map layers, region presets.
characterize Geomorphic parameters (28 indices), watershed attributes, topographic wetness index.
terrain Curve number, event runoff (SCS-CN), RUSLE erosion.
signatures Baseflow index (Lyne-Hollick), flow-duration curve, flood frequency (Gumbel/GEV), drought indices (SPI, SPEI, Palmer).

The flood-inundation suite is not part of this package.

Delineation tiers

1. nldi        — USGS NLDI NHD-indexed basin (CONUS only, < 1 s)
2. merit_gee   — MERIT-Hydro flowdir from Google Earth Engine (global, cloud)
3. local_merit — MERIT-Hydro flowdir from local cache (global, offline after download)
4. fast        — pysheds on cloud-fetched DEM tile (global, no MERIT cache needed)
auto           — tries tiers in order of accuracy; degrades gracefully on failures

Layering

Depends only downward:

aihydro-core  ←  contract (HydroResult / HydroMeta / ToolError)
aihydro-data  ←  data acquisition (streamflow, DEM, land cover, soil)
     ↑
aihydro-watershed   (this package)

The layering contract is enforced offline by tests/test_layering.py (AST walk, zero deps) and by import-linter for anyone who installs the dev extra.

Running tests

# Offline (layering guard — always passes, no network needed)
pytest tests/ -m "not live" -q

# Full suite including live API calls (requires network)
pytest tests/ -v

# Parity checks only (Wave A4 gate)
pytest tests/test_parity.py -m live -v

Status

v0.1.0. Wave A extraction complete (2026-06-21). All five subpackages (delineation, merit, characterize, terrain, signatures) are live. Compatibility shims remain in ai_hydro/analysis/ and ai_hydro/data/ of aihydro-tools for one release cycle; see MIGRATION.md.

Migration from aihydro-tools

If you previously imported from ai_hydro.analysis.* or ai_hydro.data.*, see MIGRATION.md for the one-line import changes.

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

aihydro_watershed-0.1.0.tar.gz (120.2 kB view details)

Uploaded Source

Built Distribution

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

aihydro_watershed-0.1.0-py3-none-any.whl (133.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: aihydro_watershed-0.1.0.tar.gz
  • Upload date:
  • Size: 120.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.2

File hashes

Hashes for aihydro_watershed-0.1.0.tar.gz
Algorithm Hash digest
SHA256 2d7ba525baec5470c458b62682107a2be9e223ee88184a03b05bb055ab6c53b2
MD5 4afc11d8cb796df5f5bb6058093e34fe
BLAKE2b-256 0ba19d65eb66255f84d2b5eeb8749fba4f0537993b69262f68147be3bbc0ea31

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for aihydro_watershed-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ba3f266e5734a4ae071438fdd85f3679ef92587981e0831ae014e360d6122a52
MD5 870ddb4b014bc83f5173e3a743409726
BLAKE2b-256 76d3a91b063a6a62f6dc7931c8111eb31bcaf2755e2fa5d9770dbed6ef09cfc2

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