Python for Hydrology & Watershed Modeling Automation
A focused, production-grade reference for automating hydrologic workflows in Python — from raw elevation data all the way to simulated runoff hydrographs.
Watershed Modeling is a deep, code-first knowledge base for hydrologists, environmental engineers, and Python GIS teams who need to move hydrologic analysis out of desktop GIS and into reproducible, scalable pipelines. Every guide is built around concrete, runnable patterns: which library to reach for, why an algorithm behaves the way it does on a given terrain, and how to wrap it in a defensible pipeline with logging, idempotency, topology validation, and QA/QC against authoritative hydrography.
It is not a collection of surface-level tutorials. Each page pairs the underlying hydrology and algorithm mechanics with complete, copy-pasteable Python, validation protocols, and the failure modes that actually bite in operational work — memory exhaustion on 1 m LiDAR, projection artifacts, flat-area stagnation, equifinality in calibration, and more.
- Hydrologists & environmental engineers automating delineation, routing, and rainfall-runoff modeling.
- Python GIS developers building spatial pipelines with
rasterio,richdem,pysheds,whitebox,geopandas, andshapely. - Research & agency technical teams who need auditable, reproducible workflows at regional-to-continental scale.
The site is organized into four in-depth areas covering the full hydrologic pipeline:
- Hydrology Data Preparation & DEM Processing — acquiring SRTM/LiDAR data, CRS alignment, pit filling, and resolution trade-offs to turn raw elevation data into hydrologically sound surfaces.
- Flow Routing & Stream Network Extraction — D8, D-Infinity, and multiple-flow-direction routing, flow-accumulation thresholding, and defensible stream-network extraction.
- Watershed Delineation & Catchment Synchronization — outlet mapping, basin partitioning, boundary-topology validation, nested catchments, and end-to-end pipeline orchestration with Prefect and Airflow.
- Rainfall-Runoff Modeling & Hydrologic Simulation — driving HEC-HMS and SWMM from Python, unit hydrograph methods, SCS curve-number runoff, and model calibration against gauged flow.
Every guide is cross-linked so you can follow a technique from a broad overview down to a specific parameter, tool integration, or decision ("SRTM vs LiDAR", "10 m vs 1 m", "MFD vs D-Infinity").
A static site generated with Eleventy from Markdown source, and deployed to
Cloudflare Pages. Content lives in content/, templates and assets in
src/, and the Eleventy configuration in .eleventy.js.
npm install # install dependencies
npm run serve # local dev server with live reload
npm run build # production build into _site/
npm run deploy # build + publish to Cloudflare Pages| Path | Purpose |
|---|---|
content/ |
All page content (Markdown with JSON-LD, inline SVG diagrams, and Python examples) |
src/ |
Layouts, includes, CSS, JS, and image assets |
index.njk |
Home page template |
sitemap.njk |
Generated sitemap.xml |
.eleventy.js |
Eleventy build configuration |
scripts/ |
Build helpers (icon generation, code-block QA) |
All commits to this repository are authored solely by the repository owner (watershedmodeling). No co-authors or additional trailers are attached to any commit.
Content and code © Watershed Modeling. All rights reserved.