A monorepo for evaluation and verification tools for the National Water Model (NWM) and NextGen simulations.
This repository provides two Python packages:
| Package | Description |
|---|---|
nwm_metrics |
Core statistical metrics and evaluation functions |
nwm_eval |
End-to-end workflows for data retrieval, pairing, metrics calculation, and visualization |
nwm-eval-mgr/
├── nwm_metrics/ # Core metrics library
├── nwm_eval/ # Evaluation workflow package
├── configs/ # Sample configuration files for nwm_eval workflows
├── docs/ # Sphinx documentation
└── tests/ # Shared test suite
nwm_eval
└── depends on
nwm_metrics
nwm_metricsprovides reusable statistical and hydrologic evaluation functions.nwm_evalbuilds on these metrics to implement full evaluation and verification workflows.
Install directly from GitHub (no cloning required).
pip install "git+https://github.com/NGWPC/nwm-eval-mgr.git@development#subdirectory=nwm_metrics"pip install "git+https://github.com/NGWPC/nwm-eval-mgr.git@development#subdirectory=nwm_eval"pip install "git+https://github.com/NGWPC/nwm-eval-mgr.git@development#subdirectory=nwm_metrics"
pip install "git+https://github.com/NGWPC/nwm-eval-mgr.git@development#subdirectory=nwm_eval"For CI or reproducible workflows, install from a specific commit:
pip install "git+https://github.com/NGWPC/nwm-eval-mgr.git@<commit_sha>#subdirectory=nwm_metrics"
pip install "git+https://github.com/NGWPC/nwm-eval-mgr.git@<commit_sha>#subdirectory=nwm_eval"Example:
pip install "git+https://github.com/NGWPC/nwm-eval-mgr.git@87bcac530ca36a604da1ee27401f161a767f5c44#subdirectory=nwm_metrics"Create a virtual environment
/usr/bin/python3.11 -m venv venv
source venv/bin/activate
pip install --upgrade pipClone the repository:
git clone https://github.com/NGWPC/nwm-eval-mgr.git
cd nwm-eval-mgrInstall packages in editable mode:
pip install -e nwm_metrics
pip install -e nwm_evalInstall development and documentation dependencies:
pip install -e .[dev,docs]from nwm_metrics import metric_functions as mf
kge = mf.kge(obs, sim)
nse = mf.nse(obs, sim)Follow one of the sample config files (see nwm-eval-mgr/configs) to set up the configurations for your evaluation/verification application:
config_ngencerf.yaml: ngenCERF-based single-location single-forecast verificationconfig_hindcast.yaml: ngenCERF-based single-location multiple-hindcast verificationconfig_nwm.yaml: NWM v30 operational forecasts verificationconfig_ngensim.yaml: large-scale NGEN simulation evaluation (e.g., from regionalized simulations for a VPU)config_template.yaml: a template config file containing all available configuration options generated from the pydantic schema, which can be used as a reference for setting up your own config file.
For detailed instructions on how to set up the configuration file, please refer to the Configuration and FAQ pages of the nwm-eval-mgr documentation.
python -m nwm_eval <path-to-config-file>Example
python -m nwm_eval configs/config_hindcast.yamlpytestMarkers available:
unit– fast unit testsintegration– pipeline integration testsfunctional– full workflow testsslow– long-running tests
Example:
pytest -m unitThis project uses ruff for linting and formatting:
ruff check .
ruff format .Documentation is built using Sphinx and located in the docs/ directory, and hosted on
Github Pages.
To build docs:
pip install -e .[docs]
make -C docs htmlTo build and run nwm_eval, you will need:
- Docker Engine
From the repository root, build the container image:
docker build --tag nwm_eval .To display the container help message:
docker run nwm_evalThis will print the available commands supported by the container CLI:
Usage: run-nwm-eval-mgr.sh <command> <config_file> [stdout_file]
COMMAND:
verification Run verification script.
CONFIG_FILE: Path to the configuration YAML file for a verification run.
STDOUT_FILE (optional): Path to a file where console output will be saved.
Examples:
run-nwm-eval-mgr.sh verification test_data/verf_config.yaml
run-nwm-eval-mgr.sh verification test_data/verf_config.yaml /path/to/output/nwm-eval.log
When running an evaluation or verification workflow, you will typically need to mount local data and configuration files into the container.
Example:
docker run \
-v $(pwd):$(pwd) \
-w $(pwd) \
nwm_eval \
verification $(pwd)/configs/verf_config.yamlOptionally redirect output to a file:
docker run \
-v $(pwd):$(pwd) \
-w $(pwd) \
nwm_eval \
verification $(pwd)/configs/verf_config.yaml \
$(pwd)/nwm_eval_output.log- File paths provided to the container must correspond to paths visible from within the container.
- Any paths referenced in the configuration file must also be valid within the container environment.
- If your workflow requires access to external datasets, ensure the corresponding directories are mounted into the container using Docker volume mounts (
-v).
License information to be added.