Configure the model
Set up & validate your model with the 1_Model_Config report (paths, modules, species, observation data).
β’ Calibration Framework Overview
β’ Parameter Categories (106+)
Section 01: Sensitivity Analysis
β’ Morris Screening
β’ Sobol Sensitivity Analysis
Section 02: DDS Optimization
β’ DDS Algorithm
β’ Objective Functions
β’ Temporal Resolution
Section 03: Calibration Workflow
β’ Step-by-Step Workflow
β’ Observation Data Sources
β’ GRQA Database Integration
β’ CSV Format
Section 04: Implementation
β’ Priority-Based Calibration
β’ Running Calibration
β’ Calibration Output
β’ Best Practices
Section 05: Post-Calibration Reporting
β’ Interactive HTML Reports
β’ Basin Maps & Spatial Analysis
β’ Multi-Variant Basin Reports
OpenWQ includes a comprehensive calibration framework with:
βββββββββββββββββββββββββββββββββββββββ
β Calibration Workflow β
βββββββββββββββββββββββββββββββββββββββ€
β β
β βββββββββββββββββββββββββββββββ β
β β 1. Morris Screening (~200) β β
β β β Identify sensitive β β
β ββββββββββββββββ¬βββββββββββββββ β
β βΌ β
β βββββββββββββββββββββββββββββββ β
β β 2. Sobol Analysis (~1000) β β
β β β Rank top parameters β β
β ββββββββββββββββ¬βββββββββββββββ β
β βΌ β
β βββββββββββββββββββββββββββββββ β
β β 3. DDS Optimization (~300) β β
β β β Optimize top 10-15 β β
β ββββββββββββββββ¬βββββββββββββββ β
β βΌ β
β βββββββββββββββββββββββββββββββ β
β β 4. Validation β β
β β β Independent period β β
β βββββββββββββββββββββββββββββββ β
β β
βββββββββββββββββββββββββββββββββββββββ
| Category | Count | Examples | Typical Range |
|---|---|---|---|
| BGC (NATIVE_BGC_FLEX) | 26 | k_nitrification, k_denitrification, theta | 0.001 - 1.0 /day |
| PHREEQC | 22 | Initial concentrations, pCO2, SI | Varies |
| Sorption | 16 | Kfr, qmax, KL, bulk_density | 0.01 - 100 L/kg |
| Sediment Transport | 14 | erosion_index, erodibility, cohesion | 0.1 - 10 |
| Transport | 5 | dispersion_x/y/z, characteristic_length | 0.1 - 100 mΒ²/s |
| Lateral Exchange | 4 | k_exchange (river-soil, soil-GW) | 0.0001 - 0.1 /s |
| Source/Sink | 21 | Load scaling, export coefficients | 0.1 - 5.0Γ |
Efficient method to identify influential parameters with minimal model runs.
r = 10-20 trajectories, k = parameters
Example: 30 params Γ 15 trajectories = ~465 runs
| ΞΌ* (mu-star) | Mean absolute effect β Overall influence |
| Ο (sigma) | Standard deviation β Non-linearity |
| ΞΌ* | Ο | Meaning |
|---|---|---|
| High | Low | Linear influence β Calibrate |
| High | High | Non-linear β Calibrate carefully |
| Low | Low | Non-influential β Fix at default |
| Low | High | Interactive β Investigate |
Variance-based method for detailed sensitivity ranking.
N = 1000-5000 samples, k = parameters
Example: 30 params Γ 2000 samples = ~124,000 runs
| S1 | First-order: Direct parameter effect |
| ST | Total-order: Including interactions |
Derivative-free optimization designed for expensive models.
DDS Behavior Over Iterations
Early (exploration)
ββββββββββββββββββββββββββββββββ
β ββββββββββββββββββββββββββββ β Many params
β ββββββββββββββββββ β perturbed
β ββββββββββββ β
ββββββββββββββββββββββββββββββββ
Late (exploitation)
ββββββββββββββββββββββββββββββββ
β βββ β Few params
β ββ β refined
β β β
ββββββββββββββββββββββββββββββββ
Probability of perturbation:
P(i) = 1 - ln(i)/ln(max_iter)
Root Mean Square Error
Nash-Sutcliffe Efficiency
Kling-Gupta Efficiency
Percent Bias
Aggregate observations and model outputs to a common temporal scale before computing objective functions.
| Option | Use Case |
|---|---|
| native | Original timestamps (no aggregation) |
| daily | Daily patterns matter |
| weekly | Smooth day-to-day noise |
| monthly | Seasonal patterns, sparse obs |
| yearly | Long-term trends, budgets |
mean (default) | sum | median | min | max
Use mean for concentrations, sum for loads/fluxes
# Configuration in calibration file temporal_resolution = "monthly" aggregation_method = "mean" # How it works: # 1. Group obs by reach, species, month # 2. Extract model outputs for same periods # 3. Aggregate both to monthly means # 4. Compute KGE/NSE/RMSE on aggregated data
monthly for sparse grab samples β ensures fair comparison with continuous model output
Set up & validate your model with the 1_Model_Config report (paths, modules, species, observation data).
Run calibration_config_template.py β a browser report opens. Use the tabs to set Targets (species, reaches/HRUs, one compartment), Parameters, the workflow mode (influential parameters Β· both Β· calibration) and the calibration/validation period (slider shows per-species observation coverage).
In the Execution tab choose Docker (local) or Apptainer (HPC) + parallel runs, then click βSave the scriptβ.
Locally with Docker, or on HPC with the auto-filled SLURM job + one-paste copy & run commands. The chosen mode runs Morris/Sobol screening and/or DDS calibration.
The interactive results report opens automatically β review the fit, apply the best parameters, and validate on the held-out window.
Two options for preparing observation data:
observation_data_source = "csv"
Best for: Custom datasets, local monitoring networks
observation_data_source = "grqa"
Best for: Large-scale studies, data-rich regions
grqa_config = {
# Local or download from Zenodo
"local_data_path": "/data/GRQA",
"river_network_shapefile": "rivers.shp",
"max_station_distance_m": 500,
"species_mapping": {
"NO3": "NO3-N",
"NH4": "NH4-N"
}
}
| GRQA | Model Species |
|---|---|
| NO3 | NO3-N |
| NH4 | NH4-N |
| TN | TN |
| PO4 | PO4-P |
| TP | TP |
| TSS | TSS |
| DOC | DOC |
# observations.csv (all sources produce this format)
datetime,reach_id,species,value,units,source,uncertainty,quality_flag
2018-01-15 10:00:00,1200014181,NO3-N,2.50,mg/l,USGS_station_A,0.25,GOOD
2018-01-15 10:00:00,1200014181,NH4-N,0.15,mg/l,USGS_station_A,0.02,GOOD
2018-02-01 10:00:00,1200014181,NO3-N,3.10,mg/l,USGS_station_A,0.31,GOOD
2018-02-01 10:00:00,1200014181,TP,0.08,mg/l,USGS_station_A,0.01,GOOD
...
| datetime | YYYY-MM-DD HH:MM:SS |
| reach_id | Matching model output |
| species | Case-sensitive name |
| value | Measured concentration |
| units | mg/l, ug/l, etc. |
| source | Data provider ID |
| uncertainty | Measurement error |
| quality_flag | GOOD, SUSPECT, BAD |
When resources are limited, focus on the most influential parameters:
5-8 parameters
Next 5-8 parameters
Remaining parameters
Configure in the setup report, click “Save the script”,
then run the generated <template>_run.py. The workflow
mode (influential parameters Β· both Β· calibration) is set by the slider
in the report and baked into the script β there is no mode flag.
# Run locally with Docker: cd .../containers && docker compose up -d # start container cd .../3_Calibration # where calibration_lib lives python <template>_run.py # run (mode set in the report) python <template>_run.py --resume # resume from last checkpoint python <template>_run.py --clean # delete stale eval_* first python <template>_run.py --dry-run # validate config, no run python <template>_run.py --report # (re)build the results report
caffeinate (macOS) / systemd-inhibit (Linux)
so the machine doesn't sleep mid-run. Progress is reported by
simulated date through the calibration window.
| Influential params | Morris / Sobol screening only |
| Both | Screening → DDS calibration |
| Calibration | DDS optimisation only |
CLI flags: --resume,
--clean, --keep, --dry-run,
--report.
Set Container runtime = apptainer
in the Execution tab. The report builds a ready-to-run SLURM
.sbatch and one-paste copy → re-point → submit
commands (HPC details prefilled from hpc_settings.json) β
nothing to edit.
best_parameters.json | Optimal values |
calibration_history.json | All evaluations |
parameter_definitions.json | Parameter metadata & bounds |
matched_data.csv | Obs-model matched pairs |
<template>_config_report.html | Interactive setup / config report |
<template>_results_report.html | Interactive results report (maps, convergence, performance) |
sensitivity_results.json | SA results (if run) |
model_config_template_mizuRoute_results_report.html
β so each host-model variant keeps its own clearly-labelled outputs.
| Model Runtime | 300 Evals |
|---|---|
| 5 min | ~25 hours |
| 15 min | ~75 hours |
| 30 min | ~150 hours |
.sbatch + one-paste copy & submit commands (Apptainer);
set parallel runs in the Execution tab. Restrict each eval to the
calibration window (period slider) to keep runtime & memory low.
Two self-contained, interactive HTML reports drive the workflow β a setup report (configure & launch) and a results report (diagnose the fit).
hpc_settings.json| Plotly charts | Convergence, parameter evolution, correlation, Morris/Sobol, obs-vs-sim + scatter |
| Observation map | Stations coloured by performance |
| Per-figure export | Lock-zoom + π PDF (white, branded) |
| Per-species metrics | KGE / NSE / RMSE / PBIAS |
| Next Steps | Apply best params Β· validate Β· refine |
| Dark/Light | Theme toggle Β· sortable tables |
Both are named after the calibration template (<template>_config_report.html / <template>_results_report.html); the results report opens automatically and can be re-built mid-run with --report.
use_primary_only=True) β untick
βuse only primaryβ to score the secondary stations too.
Calibration reports include interactive Leaflet.js maps showing the basin spatial context.
3 selectable basemaps: CARTO Light, OpenTopoMap, Esri Satellite
*_basinHru.gpkg, *_riverNetwork.gpkg)
| Total HRUs | Count from GeoPackage |
| River reaches | Network segments |
| Total area | kmΒ² from HRU polygons |
| Network length | km of river network |
| Max Strahler order | Stream hierarchy |
| Obs stations | Matched monitoring sites |
Layer toggle, zoom, scale bar, legend, click-for-info popups
When running multiple variants (A/B/C/D), a consolidated basin report is auto-generated comparing all variants.
workspace_{basin}_{variant}) are detected automatically
Calibration completes β βΌ parameter_definitions.json β saved matched_data.csv β saved β βΌ <template>_results_report.html β per-variant β βΌ Detect sibling workspaces β βΌ basin_report.html β multi-variant
Morris screening to identify influential parameters (106 β 30)
Sobol analysis for detailed sensitivity ranking (30 β 10-15)
DDS calibration of top parameters (200-500 evaluations)
Auto-generated interactive HTML reports with maps & charts
Calibration scripts: supporting_scripts/Calibration/
Observation data: CSV | GRQA Database | Reports: HTML with interactive maps & charts