A hydrological code or hydrologic unit code is a sequence of numbers or letters (a geocode) that identify a hydrological unit or feature, such as a river, river reach, lake, or area like a drainage basin (also called watershed in North America) or catchment.
One system, developed by Arthur Newell Strahler, known as the Strahler stream order, ranks streams based on a hierarchy of tributaries. Each segment of a stream or river within a river network is treated as a node in a tree, with the next segment downstream as its parent. When two first-order streams come together, they form a second-order stream. When two second-order streams come together, they form a third-order stream, and so on.
Another example is the system of assigning IDs to watersheds devised by Otto Pfafstetter, known as the Pfafstetter Coding System or the Pfafstetter System. Drainage areas are delineated in a hierarchical fashion, with "level 1" watersheds at continental scales, subdivided into smaller level 2 watersheds, which are divided into level 3 watersheds, and so on. Each watershed is assigned a unique number, called a Pfafsetter Code, based on its location within the overall drainage system.