Hydrofabric datasets from different sources (NWM, SWORD, GeoGLOWS, MERIT, GRIT) often represent the same river network but with different segmentation, attributes, and topologies. RiverJoin enables users to spatially join these datasets — transferring attributes, detecting bifurcations, tracing downstream networks, and resolving mismatches between flowline geometries — providing a unified representation for cross-framework hydrological analysis.
riverjoin_py/
├── docs/
│ └── riverjoin_docs.ipynb # Detailed documentation and usage examples
├── images/
│ └── Flowchart_SpatialJoin.png # Framework workflow diagram
├── src/
│ └── riverjoin/
│ ├── combined_workflow.py # End-to-end combined join pipeline
│ ├── utilis.py # Shared utility functions
│ └── modules/
│ ├── attribute_transfer.py # Transfer attributes between flowlines
│ ├── bifurcation_detector.py # Detect river bifurcations
│ ├── compare_linelength.py # Compare segment line lengths
│ ├── flowlines_buffer.py # Buffer-based spatial matching
│ ├── interactive_map.py # Interactive map visualization
│ ├── perpendicularlines.py # Generate perpendicular cross-sections
│ ├── project_initialization.py # Project setup and configuration
│ ├── setup_hydrofabric.py # Hydrofabric data preparation
│ ├── situation_checker.py # Geometry situation classification
│ ├── traced_downstream.py # Downstream network tracing
│ └── traced_downstream_trace_bifurcation.py # Downstream tracing with bifurcation handling
└── tests/ # Test cases for all modulesWe recommend using a virtual environment to avoid dependency conflicts. Though it only depends on few light weight Python libraries.
Using conda
conda create --name riverjoin python==3.10
conda activate riverjoinUsing venv
python -m venv riverjoin
# macOS/Linux
source riverjoin/bin/activate
# Windows
riverjoin\Scripts\activateInstall the package
pip install uv
uv pip install riverjoin
# OR
pip install riverjoinFor detail usage, refer to the riverjoin_docs.ipynb.
Chen, Y., Cohen, S., Baruah, A. et al. Merging Remote Sensing Derived River Slope Datasets with High-Resolution Hydrofabrics for the United States. Sci Data 12, 1657 (2025). https://doi.org/10.1038/s41597-025-05941-6
We welcome contributions. See CONTRIBUTING.md for more details.
Dr. Sagy Cohen (sagy.cohen@ua.edu), Dr. Yixian Chen (ychen223@ua.edu), Supath Dhital (sdhital@ua.edu)

