pwa-raven
Raven hydrological model setup and input generation for PWA (pipeline Steps 1–2), extracted from the PWA dev repo's _notebooks/1_nc_processing.ipynb, _notebooks/2_raven_input_gen.ipynb, and src/py/phydap.py / raven_py.py. Also generates the RavenView visualization GeoJSON.
Layout
pwa_raven/
nc_processing.py # Step 1: PHyDAP/NetCDF subsetting + time offset + grid weights
raven_inputs.py # Step 2: orchestrates .rv* + WSC RVT + calibration templates
run_*.py # CLI entry points (nc_processing, raven_inputs, ravenview)
init_*_config.py # Interactive config builders (one per step)
raven/
rv_writers.py # .rvi/.rvp/.rvh/.rvc/.rvt template writers
runner.py # run_raven() — invokes the Raven binary, checks errors
ravenview.py # subbasin/river shapefiles -> RavenView GeoJSON + validation
wsc_rvt.py # WSC observed-streamflow RVT generation
basin_prep.py # subbasin/HRU preparation
calibration_templates.py
grid/
weights.py # GridWeights.txt generation
Installation
pip install -e . # core
pip install -e .[dev] # plus pytest, pytest-cov, xarray (test deps)
The Raven binary is not a pip dependency — install it from
http://raven.uwaterloo.ca/Downloads.html and place it on PATH as Raven
(Linux/macOS) or Raven.exe (Windows). pwa-raven is itself a dependency of
pwa-calibration.
Running
Programmatic entry points (notebook / script use):
from pwa_raven.nc_processing import NcProcessingConfig, run_nc_processing
from pwa_raven.raven_inputs import RavenInputsConfig, run_raven_inputs
from pwa_raven.raven.ravenview import export_for_ravenview
Equivalent CLIs (thin wrappers around the above):
python -m pwa_raven.run_nc_processing --config nc_processing.yml
python -m pwa_raven.run_raven_inputs --config raven_inputs.yml
python -m pwa_raven.run_ravenview --subbasins SUB.shp --rivers RIV.shp \
--output-dir RavenView --watershed-name my_watershed
Generate a starter config for any step with the matching pwa_raven.init_*_config module.
Running tests
This project uses pytest. From pwa_raven/ with the conda env activated:
python -m pytest tests/unit -q # fast unit suite (what CI runs)
python -m pytest tests/integration # local-only e2e (see below)
From the repo root, the Makefile provides shortcuts: make test-raven (unit) and make integration-raven (e2e).
Test tiers, by marker:
- unit (default,
tests/unit/) — fast, no external dependencies; runs in CI. Includes a real-data RavenView export test backed by the committedtests/fixtures/05MH008/watershed. - integration — invokes the real Raven binary; local-only, skips unless inputs are present. See
tests/integration/README.mdfor the env vars (PWA_RAVEN_INPUTS_CONFIG,PWA_RAVEN_BINARY) and how to trigger. - regression — needs an external reference dataset (e.g. the Liard sample); skips when absent.
- slow — a real Raven run; skip with
-m "not slow"during a fast dev loop.
Useful flags: -q (quiet), -k <pattern> (filter by name), -x (stop on first failure), --tb=short (concise tracebacks).
All unit tests should pass before opening a pull request.
Contributing
Workflow for adding a feature or fixing a bug:
- Create a feature branch off the default branch. Use
feat/<short-name>for features andfix/<short-name>for bug fixes — never commit directly to the default branch. - Write a failing test first that describes the desired behavior. Run
python -m pytest -qto confirm the new test fails. For bug fixes, the test should reproduce the bug. - Write code to make the test pass. Run the suite again and confirm green.
- Commit incrementally with focused commit messages that explain why (the motivation, the problem, the trade-off) rather than just what (the diff is the what).
- Open a pull request against the default branch. Tag the relevant reviewer. The PR description should include a short summary, a test plan, and links to any related issues.
Practical notes:
- New features should ship with corresponding tests. If a unit test is hard to write, that's often a signal the design needs refactoring.
- Avoid disabling, skipping, or commenting out tests to make builds pass — investigate the root cause and fix it properly.
- Keep commits small and atomic. If you find yourself making unrelated changes in the same commit, split them.
- Don't add features beyond what the issue/PR scope requires. YAGNI — build for the current need, refactor later when a second use case emerges.
Metadata
Release files for pwa-raven 0.2.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pwa_raven-0.2.2.tar.gz | 82.9 kB | Without provenance | Details for pwa_raven-0.2.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pwa_raven-0.2.2-py3-none-any.whl | Python 3 | none | any | Details for pwa_raven-0.2.2-py3-none-any.whl |
Total release size: 178.1 kB
Release files / pwa_raven-0.2.2.tar.gz
| Download URL | pwa_raven-0.2.2.tar.gz |
|---|---|
| Size | 82.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d8a162ee81857f0c09d2b4eaf0702e2ee76933cb3b92555e4004fd26d6c641f8
|
|
BLAKE2b-256 checksum How to use checksums |
98da1c33a2459e1448450e05ccff083c007e7ff0fcfe841470351daeb88525e6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.13
|
Release files / pwa_raven-0.2.2-py3-none-any.whl
| Download URL | pwa_raven-0.2.2-py3-none-any.whl |
|---|---|
| Size | 95.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
acad86d75d3ca62cbc3285ce01bc71dc8dd41897f7da8187731c666d25d1af78
|
|
BLAKE2b-256 checksum How to use checksums |
8b5e6dec7bb97735998560e771f85494cf0313d7bc69bedb5331bc6669eae639
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.13
|
Security for pwa-raven 0.2.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.