How simondelmas/hydrogr works
Project type and purpose
• hydrogr is an open-source, multi-language hydrological modeling library.
• It combines a high-performance Rust core (implements GR1A, GR2M, GR4H, GR4J, GR5J, GR6J) with a Python wrapper to expose those models to Python users.
• It also includes example notebooks, sample datasets, automated tests, and CI pipelines to build, test, and publish Python wheels.
File structure
• Top-level:
• Cargo.toml / src/ → Rust library source (modules for each GR-model + library entry point)
• pyproject.toml / python/ → Python package source (hydrogr module, model_interface, input_data)
• data/ → sample CSV and pickle files for input data
• example/ → Jupyter notebooks demonstrating model usage and calibration
• python/test/ → pytest-based tests for both the Python wrapper and model outputs
• .github/ → GitHub Actions workflows for building & publishing (build_all.yml, build_and_publish_release.yml)
• Observations:
• The Rust code defines the core algorithms, compiled into a native library
• The Python layer wraps those algorithms via a FFI binding (likely via PyO3 or setuptools-rust)
• CI workflows build the Rust extension, run Python tests, and publish to PyPI
• Tests validate correctness of each model implementation and data input routines
README for additional insights
• Confirms it’s a Python package (PyPI), requires Python 3.7+
• Emphasizes the six GR models, inspired by the airGR R package
• Shows badges for build status, license, and downloads
• Points to example notebooks for usage and calibration
• Under Rust, list each src/*.rs module and show how lib.rs aggregates them
• Data input module reading files from data/ → feeding model inputs
• At the top or bottom, sketch the CI workflow steps in sequence, linking to GitHub and PyPI
• Every module and external dependency is represented and clearly labeled