AI-Hydro Interactive Module Β· Watershed Hydrology

The Watershed
Where Rain Becomes Runoff

Every raindrop belongs to exactly one watershed. Orbit a 3-D basin, drop virtual rain on a topographic map, and watch D8 routing decide where every drop ends up β€” no Python required.

Read the concept Β· Orbit the 3-D terrain Β· Click the flow-routing map Β· Pass the checkpoint

Your path through this module

πŸ”οΈ
Concept
🌐
3-D
πŸ—ΊοΈ
Route
🌧️
Sim
βœ“
Check
πŸ“œ
Sources

1 Β· What is a watershed?

A watershed (also called a catchment or drainage basin) is the area of land that drains to a single outlet β€” a stream gauge, a lake, or a river mouth. Every point on land belongs to exactly one watershed.

The outer boundary is the divide: a ridge line along which any raindrop on one side eventually flows one way, and a drop on the other side flows the opposite way. The divide follows the highest topographic points surrounding the catchment.

πŸ”οΈ
The Divide

A continuous ridge line forming the outer boundary. Defined entirely by topography β€” extractable from a DEM without any surveying.

Key fact The divide is a line of zero cross-divide slope. Water on the divide is in unstable equilibrium β€” it could go either way.
🌊
The Outlet

The single point where all water leaving the watershed is measured. Change the outlet location β†’ change the watershed boundary.

Key fact Watersheds are nested: every tributary has its own sub-catchment. They stack like Russian dolls up to the largest basin.
Outlet (gauge) β€” β€” watershed divide β€” β€”

Cyan dashed = watershed divide Β· Blue = stream network Β· Circle = measurement outlet

2 Β· Orbit a synthetic watershed in 3-D

A procedurally generated horseshoe catchment β€” ridges on three sides, a single outlet at the south. Drag to orbit Β· scroll to zoom Β· right-drag to pan.

πŸ–± Drag Β· Scroll Β· Right-drag

Colour: β–  green-teal = valleys Β· β–  blue = mid-slope Β· β–  white = ridges. Cyan lines trace the stream network converging to the outlet at bottom-centre.

Look for Rotate to look straight down. The drainage network forms a dendritic (tree-like) pattern β€” tributaries branch outward from the main channel, matching the ridge that defines the divide.

3 Β· How topography decides where water goes β€” the D8 algorithm

A computer extracts the watershed by applying one rule to every cell in a DEM: water flows to whichever of the 8 neighbouring cells is lowest. This is the D8 algorithm (eight-direction flow).

D8 in 3 steps
  1. Look at 8 neighbours (N, NE, E, SE, S, SW, W, NW).
  2. Find the steepest drop β€” the neighbour with the greatest elevation difference.
  3. Follow that path downhill until the edge of the DEM or a sink.
From D8 to watershed All cells whose D8 path passes through your outlet form the watershed. The divide is the outer edge of that set.
120 115 118 112 108 110 105 98 102 current cell steepest neighbour (drop = 10 m)

4 Β· Drop virtual rain β€” trace the D8 flow path

Click any cell on the elevation map to drop a virtual raindrop. The D8 algorithm traces the path to the outlet (cyan circle, south edge). Click near the outlet to reveal the full contributing area.

Low β†’ High elev.
Flow path
Contributing area
Drop point

The highlighted path is the flow path. All cells routing through a given point form the contributing area for that outlet.

Path cells
β€”
Elev drop
β€”
Mean slope
β€”
Try this Click near the top ridge. The path sweeps to the central channel before running to the outlet. Click the dark-blue channel cells β€” the path is almost immediate. Click very near the outlet (south edge, centre) to light up the entire watershed area.

5 Β· Checkpoint

Three questions β€” pass all three to mark this module complete and unlock DEM β†’ TWI.

1 Β· The watershed divide is defined by…

Stream channels are inside the watershed β€” they're where water converges, not diverges.
Watershed boundaries are purely topographic; they have nothing to do with land ownership.

2 Β· In the D8 algorithm, a cell's flow direction points toward…

Averaging doesn't give a direction β€” you need the single steepest downslope path.
D8 uses only local elevation differences, not global distances to streams.

3 Β· Moving the stream gauge 10 km upstream would…

The watershed is defined relative to the outlet β€” change the outlet and the boundary changes.
Moving upstream cuts off the area between old and new gauge β€” it makes the watershed smaller.

Sources & Further Reading

  1. Dingman, S. L. (2015). Physical Hydrology, 3rd ed. Waveland Press. β€” Watershed definition and delineation concepts, Chapter 3.
  2. Jenson, S. K. & Domingue, J. O. (1988). Extracting topographic structure from digital elevation data for GIS analysis. Photogrammetric Engineering & Remote Sensing, 54(11), 1593–1600. β€” Original D8 algorithm.
  3. O'Callaghan, J. F. & Mark, D. M. (1984). The extraction of drainage networks from digital elevation data. Computer Vision, Graphics, and Image Processing, 28(3), 323–344. β€” Flow accumulation and channel extraction.
Author
Mohammad Galib Β· Purdue University
License
CC-BY-4.0 β€” free to reuse with attribution
Module ID
watershed-runoff Β· v0.1.1
Course
Introduction to Hydrology Β· intro-hydro-2026
Data
All terrain is synthetic (procedurally generated); no real DEM used
Dependencies
three.js r128 (lazy CDN, 3-D only); no kernel required
CC-BY-4.0