🌾 SwaNET · Quick Tutorial 4 of 19

Auto Model Calibration

Automatically calibrate and validate your SWAT model using the NSGA-II multi-objective genetic algorithm. Optimize multiple parameters simultaneously against observed streamflow data from uploaded files or USGS gauging stations.

SwaNET Tutorial 4Prereq: Loaded Model with Observed Data12 min read

What You Will Learn

NSGA-II AlgorithmHow the Non-dominated Sorting Genetic Algorithm II optimizes multiple SWAT parameters simultaneously
USGS IntegrationAutomatically load observed streamflow from USGS gauging stations added during watershed delineation
GA ConfigurationPopulation size, generations, crossover, mutation, and other genetic algorithm settings
Result AnalysisVisualize calibration statistics, compare runs, and apply the best parameter set

0Getting Started

Auto-calibration uses computational optimization to find the best parameter values automatically, rather than testing one parameter at a time. SwaNET implements the NSGA-II (Non-dominated Sorting Genetic Algorithm II) developed by Ercan and Goodall (2016), which can optimize multiple objectives simultaneously.

ℹ️

Why NSGA-II? Traditional calibration optimizes one objective at a time. NSGA-II finds solutions that balance multiple objectives (NSE, PBIAS, RSR) simultaneously, producing a set of Pareto-optimal solutions rather than a single "best" answer.

Click Calibration Helper from the main menu, then click Auto calibration at the top.

Auto calibration interface
Figure 1. Auto calibration interface

1Load Observed Data

Upload User Observed File

  1. Upload a new file or select a previously uploaded one under "Load observed data."
  2. Click Plot data to verify the data.
  3. Select the output type (Subbasin or Reach) and the specific parameter to compare.
  4. Select the subbasin outlet number. Click Add observed data. The entry appears in the table with outlet ID, filename, parameter, and weight.
Format of observed data file
Figure 2. Format of observed data file

Add USGS Gauging Stations

If you added USGS stations as outlets during watershed delineation, you can load their streamflow data directly.

  1. Click Add USGS stations. Select a station from the dropdown.
  2. Choose data type: Field measurement (sparse but high quality) or Daily (continuous record).
  3. Click Select. For daily data, set the download period and confirm.
  4. Click Apply to add stations to the calibration list. Adjust weights as needed (equal by default).
Adding USGS station data
Figure 3. Adding USGS station data

2Configure Options

Simulation Settings

  1. Set calibration and validation periods (continuous dates).
  2. Set warm-up years (1-2 recommended).
  3. Choose monthly or daily result summarization.
  4. Set parameter weights for NSE, PBIAS, and RSR. Set any to 0 to exclude from optimization.

Genetic Algorithm Settings

  1. Population size: Initial population (must be even). Default: 10.
  2. Number of generations: How many iterations the algorithm runs. Start small (3-5) for testing.
  3. Cross-over probability: Likelihood of gene exchange (0.5-1.0). Default: 0.8.
  4. Cross-over type: Simple (segment swap) or Uniform (random gene swap).
  5. Number of bits: Precision of parameter encoding. Default: 6.
  6. Mutation probability: Likelihood of random gene change (0-1). Default: 0.5.
  7. Seed: Random number seed for reproducibility (0-1).
  8. Sampling interval: Latin Hypercube Sampling intervals for initial population. Default: 10.
  9. Read from last population: Check to continue from a previous calibration run.
⚠️

Performance note: Auto-calibration runs SWAT many times (population size x generations). Start with small numbers to test, then increase for final calibration. Each run may take several minutes to hours depending on model size.

3Select SWAT Parameters

  1. Under "Auto calibration parameters," select a parameter from the dropdown and click Add.
  2. The parameter, its default range, and operation method appear in the table. Continue adding until all desired parameters are listed.
  3. Adjust lower and upper bounds as needed. The defaults represent the suggested calibration range.
💡

Key streamflow parameters: CN2 (curve number), ALPHA_BF (baseflow factor), ESCO (soil evaporation), GW_DELAY (groundwater delay), GWQMN (return flow threshold), and CH_N2 (channel roughness). Start with these for flow calibration.

4Run and Visualize Results

  1. Click Run Auto Calibration. The algorithm runs through all generations.
  2. To stop early, click Stop autocalibration. To reload previous results, click Load latest results.
Auto calibration results
Figure 4. Auto calibration results

Results from the final generation are displayed. The left panel shows the best-fit time series (simulated vs. observed). The right panel shows calibration and validation statistics for each run.

Interpreting and Applying Results

  1. Select any run from the dropdown and click Plot this run to see its time series.
  2. Click Apply this run to write that run's parameter values to the SWAT files.
  3. Click More options to see statistical plots across runs and the parameter values used in each run.
More auto calibration visualization options
Figure 5. More auto calibration visualization options
⚠️

Important: Auto-calibration does not automatically change SWAT parameters. You must select a run and click Apply this run to write the calibrated values to your model files.

Frequently Asked Questions

How long does auto-calibration take?
It depends on model size, population, and generations. A small model (30 subbasins) with 10 population and 3 generations might take 30 minutes. Larger models with more generations can take hours. Start small to test.
What is the difference between 1-NSE and NSE?
The auto-calibration displays 1-NSE because it is a minimization problem. A 1-NSE of 0 means perfect fit (NSE = 1.0). Lower values of 1-NSE are better.
Can I calibrate multiple locations simultaneously?
Yes. Add multiple observed datasets (different outlets, different parameters) to the calibration table. The NSGA-II algorithm optimizes across all locations simultaneously using the assigned weights.
What is the reference for the calibration algorithm?
Ercan, M. B. and J. L. Goodall (2016), "Design and implementation of a general software library for using NSGA-II with SWAT for multi-objective model calibration," Environmental Modelling and Software, 84, 112-120.