Skip to main content

Tools for river–lake network topology construction and validation

Project description

🔥 Burning Lakes and Reservoirs into River Network Topology

This repository provides a Python-based workflow for burning lakes and reservoirs into an existing river network topology. The workflow integrates vector-based river networks, lake/reservoir polygons, and subbasin polygons to produce a topologically consistent river–lake network suitable for hydrological modeling.

The core objective is to identify resolvable lakes and reservoirs given a river network density and to modify river connectivity, geometry, and contributing areas accordingly—without requiring access to the DEM or land-cover data used to derive the original river network.


🌍 Motivation

Representing lakes and reservoirs consistently within river networks is challenging. Traditionally, this requires:

  • DEM conditioning
  • Flow-direction enforcement
  • Water-body masking or land-cover classification

However, these inputs are often unavailable—especially when river networks are:

  • Manually digitized (blue lines)
  • Provided by agencies or hydrographers
  • Derived from proprietary or legacy workflows

At the same time, vector lake and reservoir datasets—from satellite observations, land-cover products, or cartographic mapping—are widely available.

This workflow bridges that gap by merging vector river networks and vector lake/reservoir datasets directly, allowing both to be iteratively refined to reach a desired level of representation within a target modeling system.


🧠 Key Concept: Resolvable Lakes

Not all lakes should be explicitly represented in a river network.

A lake or reservoir is considered resolvable if it is large enough—relative to the river network density—to meaningfully affect:

  • Flow connectivity
  • River routing
  • Upstream contributing areas

Resolvable lakes:

  • Intersect multiple river segments or subbasins
  • Replace or modify river segments
  • Introduce explicit lake-routing behavior

Non-resolvable lakes remain implicitly represented through subbasin areas and do not alter river topology.


📦 Required Inputs (All Vector-Based)

1️⃣ River Network (riv)

A line-based river network dataset with the following required attributes:

Column Description
COMID Unique river segment identifier
NextDownID Downstream river segment ID (-9999 for outlets)
lengthm River segment length (meters)
unitarea Local contributing area
uparea Accumulated upstream contributing area
geometry Line geometry (None allowed for coastal segments)

Example riv

COMID, NextDownID, lengthm, unitarea, uparea, geometry
1, 3, 10, 10, 10, LINESTRING(...)
2, 3, 15, 20, 20, LINESTRING(...)
3, -9999, 9, 10, 40, LINESTRING(...)
4, -9999, 0, 20, 20, None

2️⃣ Subbasins / Catchments (cat)

A polygon dataset defining contributing areas for each river segment.

Each subbasin must correspond exactly to one river COMID.

Column Description
COMID Subbasin ID (matches river COMID)
unitarea Subbasin area
geometry Polygon geometry

Example cat

COMID, unitarea, geometry
1, 10, POLYGON(...)
2, 20, POLYGON(...)
3, 10, POLYGON(...)
4, 10, POLYGON(...)

3️⃣ Lakes and Reservoirs (lake) — Required

A polygon dataset representing lakes and reservoirs.

Each lake or reservoir must include:

Column Description
LakeID Unique lake/reservoir identifier (e.g., 100, 200)
unitarea Lake surface area (should be the same unit as subbasin area)
geometry Polygon geometry

Example lake

LakeID, unitarea, geometry
100, 50, POLYGON(...)
200, 120, POLYGON(...)

🔧 Installation

Local Installation

git clone https://github.com/ShervanGharari/RiverLakeNetwork.git
cd RiverLakeNetwork
pip install .

Editable install:

pip install -e .

PyPI Installation (Coming Soon)

pip install riverlakenetwork

⚙️ Workflow Overview

  1. Validate river–subbasin consistency
  2. Identify resolvable lakes based on river network density
  3. Intersect lakes with river segments and subbasins
  4. Modify river connectivity and lengths
  5. Convert submerged river segments to zero-length segments
  6. Reassign downstream connections to lakes
  7. Reclassify affected subbasins as coastal
  8. Recompute upstream contributing areas
  9. Apply topology consistency checks and warnings

The workflow is iterative by design, allowing refinement until the desired representation is achieved.


🎯 Typical Applications

  • Large-scale hydrological routing models
  • Lake-aware river network preprocessing
  • Harmonizing independently derived river and lake datasets
  • Regional to global water resources modeling

📁 Examples

The repository includes several worked examples demonstrating how lakes and reservoirs are burned into different river network topologies and how resolvable lakes are identified based on river network density.

Comparison of above examples


🧾 How to Cite

If you use this tool or build upon its approach, please cite the following publication, which forms the conceptual basis for lake representation and integration into river network topology:

Gharari, S., Vanderkelen, I., Tefs, A., Mizukami, N., Kluzek, E., Stadnyk, T., Lawrence, D., & Clark, M. P. (2024). A flexible framework for simulating the water balance of lakes and reservoirs from local to global scales: mizuRoute‐Lake. Water Resources Research, 60(5), e2022WR032400. https://doi.org/10.1029/2022WR032400

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

riverlakenetwork-0.0.0.tar.gz (47.8 kB view details)

Uploaded Source

Built Distribution

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

riverlakenetwork-0.0.0-py3-none-any.whl (48.7 kB view details)

Uploaded Python 3

File details

Details for the file riverlakenetwork-0.0.0.tar.gz.

File metadata

  • Download URL: riverlakenetwork-0.0.0.tar.gz
  • Upload date:
  • Size: 47.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.2

File hashes

Hashes for riverlakenetwork-0.0.0.tar.gz
Algorithm Hash digest
SHA256 5380d6425d336e6e6d2182469e3e9b0697d531da4c9d0e0570750d00fd7dd96f
MD5 0f095cfeaf7454c4fdbe297d74e8e743
BLAKE2b-256 84a4cd26f3cd52cedf68135fc5219e75d4c9c4061efb89e264b13ae05d8ed214

See more details on using hashes here.

File details

Details for the file riverlakenetwork-0.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for riverlakenetwork-0.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4df7e989fe4837c92c506294e9d1b13ea11e77922286e0a2a96288a1e88c3d12
MD5 bf5de3b96999c761cf15d585f5988c79
BLAKE2b-256 2a681cbf58d1539853ed8cc7439d91c1505372191d622168a07c4ff9812c400d

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