Hydrology & watersheds

Where water goes on a DEM: conditioning, flow direction and accumulation, watersheds, stream networks and HAND.

A flow path stopped by a single unfilled pit in a DEM, and the same path after conditioning. one unfilled cell ends every flow path above ita one-cell pitnothing above it drainsraw DEMfill_pits()conditioned DEMthe path reaches the outletConditioning is not tidying — it is what makes flow direction defined at every cell

Everything here starts from one assumption: water flows downhill, and every cell in the DEM has somewhere to send it. Real elevation data does not satisfy that. Sinks, flat areas and one-cell pits — most of them artefacts of the interpolation that built the DEM rather than features of the landscape — leave cells with no downhill neighbour, and a flow path that reaches one simply stops.

So conditioning comes first and is not optional: fill or breach the depressions, resolve the flats, then compute flow direction and accumulation. From there, watersheds, stream networks, stream order and HAND all fall out of the same two rasters. The threshold you pick for "this is a stream" decides the entire network, including its Strahler order.

The concepts explain what each raster means and where its assumptions bite; the how-to guides run the sequence; and the fixes cover the catchments and networks that come out wrong.

Learning paths run through this topic too — see the end of this page.

🧭 Start with the concepts

The ideas the how-to guides below assume you already have.

Show every concept in this topic

⚙️ Then do the task

Step-by-step walkthroughs with code you can copy and adapt.

Show every how-to guide in this topic

🔧 When it breaks

The errors this topic produces, with the cause explained rather than just the command.

Related topics

Subjects that keep coming up alongside this one, most overlap first.

Keep browsing

Hydrology & watersheds sits in Analysis. Every topic on the site is listed on the topics index.