nwm_region_mgr is a Python package for identifying optimal model formulations and parameter values in ungauged catchments. It leverages calibration data from gauged catchments and catchment attributes to improve hydrologic modeling and forecasting skill across regions, playing a key role in the NextGen and NWM ecosystem.
- Formulation Regionalization – Ranks NextGen model formulations for ungauged catchments based on performance at gauged sites in a region.
- Parameter Regionalization – Estimates parameter values by intelligently transferring calibrations across catchments based on similarity.
- Clustering Methods – Groups catchments with shared hydrologic characteristics using multiple clustering approaches.
- Distance methods – Identify donors using distance metrics that characterize catchment similarity/dissimilarity.
- Diagnostic Plots – Generates diagnostic plots and maps that explain formulation and parameter choices.
- Scalable Workflows – Efficiently supports studies from individual watersheds to CONUS-wide applications.
- Customizable Configurations – Full control of workflows via human-readable config files.
Follow NMW-RTE README to build Docker images and download sample data.
Note: A single ngen RTE Docker image needs to be built before continuing to the regionalization steps below. Make sure that RTE's build script runs successfully. RTE's default run script (for forecasting) is not used by the regionalization workflow and should be skipped.
First, navigate to your preferred working directory (e.g., /ngen-oe/$USER/run_region, /ngen-dev/$USER/run_region,
or ~/run_region) where you have the regionalization config files set up and where you want to save the outputs from
regionalization. You can copy sample config files from nwm-region-mgr/configs/ to your working directory and
modify them as needed. Note {RTE_REPO_ROOT} in the steps below refers to the root directory of your nwm-rte
repo, e.g., ~/ngpwc/nwm-rte (on local AWS workspace), or /ngencerf-app/nwm-rte (on INT/EA/UAT).
The short flag -f can also be used in place of --formreg. Prior to running, configure the settings in configs/config_general.yaml and configs/config_formreg.yaml.
# run slurm job to submit to compute nodes on INT/EA/UAT
[RTE_REPO_ROOT]/sbatch_run_region.sh configs formreg
# or run directly in controller node or local AWS workpsace
time [RTE_REPO_ROOT]/run_region.sh -c configs --formregTypically this step can be skipped since parameter regionalization also runs formulation regionalization as a prerequisite.
The short flag -p can also be used in place of --parreg. Prior to running, configure the settings in configs/config_general.yaml, configs/config_formreg.yaml and configs/config_parreg.yaml.
# run slurm job to submit to compute nodes on INT/EA/UAT
[RTE_REPO_ROOT]/sbatch_run_region.sh configs parreg
# or run directly in controller node or local AWS workpsace
time [RTE_REPO_ROOT]/run_region.sh -c configs --parregRun a NGEN simulation.
The short flag -n can also be used in place of --ngen. Prior to running, configure the settings in configs/config_general.yaml and configs/config_ngen.yaml.
# run slurm job to submit to compute nodes on INT/EA/UAT
[RTE_REPO_ROOT]/sbatch_run_region.sh configs ngen
# or run directly in controller node or local AWS workpsace
time [RTE_REPO_ROOT]/run_region.sh -c configs --ngenRun an evaluation:
The short flag -e can also be used in place of --eval. Prior to running, configure the settings in configs/config_eval.yaml.
# run slurm job to submit to compute nodes on INT/EA/UAT
[RTE_REPO_ROOT]/sbatch_run_region.sh configs eval
# or run directly in controller node or local AWS workpsace
time [RTE_REPO_ROOT]/run_region.sh -c configs --evalTypically, we do not recommend running all three steps in one command, since users may want to inspect the outputs from each step before proceeding to the next step. However, it is possible to run all three steps in one command as shown below:
# run slurm job to submit to compute nodes on INT/EA/UAT
[RTE_REPO_ROOT]/sbatch_run_region.sh configs parreg ngen eval
# or run directly in controller node or local AWS workpsace
time [RTE_REPO_ROOT]/run_region.sh -c configs --parreg --ngen --evalSee [RTE_REPO_ROOT]/run_region.sh --help for more details on the command line arguments and options.
git clone https://github.com/NGWPC/nwm-region-mgr.git
cd nwm-region-mgrCreate a virtual environment to isolate the dependencies of this library from your base Python environment.
python3.11 -m venv .venv
source .venv/bin/activate
pip install --upgrade pipYou will then be able to install nwm_region_mgr. There are a few variants that users may be interested in.
# Regular package install
pip install .
# Install the package in edit mode (for development)
pip install -e .
# Install additional dependencies for parameter regionalization
pip install .[parreg]
# Install dependencies for docs and dev
pip install .[docs,dev]Three yaml config files are needed to run regionalization
- config_general.yaml: general settings for the overall regionalization process.
- onfig_formreg.yaml: specific settings for the formulation regionalization process.
- config_parreg.yaml: specific settings for the parameter regionalization process.
Follow the sample config files (nwm_region_mgr/configs) to set up the configurations for your regionalization application as needed.
Sample input data can be downloaded from s3://ngwpc-dev/regionalization/inputs
python -m nwm_region_mgr [COFIG_DIR] [REG_TYPE]Where:
- [NGEN_REG_ROOT] refers to the directory where nwm-region-mgr is installed
- [COFIG_DIR] refers to the directory containing the three config files as noted in 1), e.g.,
- [REG_TYPE] refers to the type of regionalization to run, either 'formreg' (formulation regionalization only) or 'region' (parameter regionalization, which also runs formulation regionalization first if not done already). If not specified, the default is 'region'.
python -m nwm_region_mgr configs formreg # to run formulation regionalization only
python -m nwm_region_mgr configs region # to run parameter regionalization (and formulation regionalization if not done already)To void complications from building ngen and its submodules locally, we recommend you always run NGEN simulation with regionalized parameters and formulations from a Docker container. Follow instructions from the Docker Run Time Environment (RTE) section above.
1) Donwload and install nwm.verf
It is recommentded you install nwm.verf in its own venv. Note nwm.eval needs to installed as a dependency
Follow example config at config_eval.yaml
Check out what metrics are currently supported here
Sample input data can be downloaded from s3://ngwpc-dev/regionalization/data/inputs/eval
source ~/repos/nwm-verf/venv/bin/activatepython -m nwm.verf config_eval.yamlOutputs from evaluation can be found in [output_dir] as specified in config_eval.yaml
- Create pseudo forcing data by recycling existing forcing files, using this script
- Create new pseduo calibration/validation stats for different formulations, using this script
- Create geopackages for a new VPU using this script
- Create gage list files and NGEN divide-gage crosswalk file for a new domain using this script
Unit tests are located under tests/ and use pytest.
See tests/README.md for details.
