ErmCalibration

Calibrates the parameters of the water budget model with Particle Swarm Optimisation: a swarm of pParticlesNum candidate parameter sets moves through the parameter space for pPsoIterations iterations, each candidate attracted by its own best position and by the best one of the swarm. Each candidate is evaluated by running the model over the calibration period and comparing the simulated discharge with the observed one at the stream gauges, with the Kling-Gupta efficiency (KGE): 1 is a perfect agreement.

The first pSpinUpDays of the period only warm up the storages of the model and are not evaluated. The calibration runs pParticlesNum × pPsoIterations simulations, in parallel on pCalibrationThreadCount threads: on long periods it can take hours.

At the end, the best parameters and their KGE are reported in the log. These are the 18 parameters, in the order they are reported and accepted by ErmSimulation, with the ranges explored by the calibration:

#

Parameter

Unit

Range

1

adjustment coefficient for the rain measurements

-

0.8 – 1.5

2

adjustment coefficient for the snow measurements

-

0.8 – 1.5

3

melting temperature

°C

-1 – 3

4

combined melting factor

mm/°C/day

0.0001 – 2

5

freezing factor

mm/°C/day

0.0001 – 1

6

coefficient for the maximum liquid water in the snowpack

-

0.001 – 0.5

7

canopy outflow coefficient

-

0.1 – 0.9

8

partitioning coefficient of the free throughfall

-

0.5 – 0.98

9

maximum root zone storage

mm

40 – 250

10

maximum percolation rate of the root zone

-

0.000001 – 3

11

exponent of the non-linear reservoir of the root zone

-

0.8 – 1

12

degree of spatial variability of the soil moisture capacity

-

0.5 – 3

13

maximum runoff storage

mm

5 – 100

14

coefficient of the non-linear runoff reservoir

-

0.000001 – 5

15

exponent of the non-linear runoff reservoir

-

0.9 – 1

16

maximum groundwater storage

mm

100 – 1000

17

coefficient of the non-linear groundwater reservoir

-

0.0000005 – 2

18

exponent of the non-linear groundwater reservoir

-

0.95 – 1

Parameters

Sixth step of the ERM/GeoFrame water budget workflow: calibrates the 18 parameters of the water budget model against the observed discharge, with Particle Swarm Optimisation. The best parameters found and their score are reported at the end.

Toolbox folder: GeoFrame
Status: Certified
Keywords: ERM, GeoFrame, calibration, PSO, water budget
Authors: Andrea Antonello
Class: org.hortonmachine.hmachine.geoframe.ermworkflow.ErmCalibration

Inputs

Parameter

Type

Unit

Default

Description

inGeopackagePath

GeoPackage file

The GeoFrame database, with all the inputs prepared by the previous steps of the workflow.

inFromTimestamp

String

Start of the simulated period. Format: yyyy-MM-dd HH:mm:ss, in UTC.

inToTimestamp

String

End of the simulated period. Format: yyyy-MM-dd HH:mm:ss, in UTC.

pTimeStepMinutes

int

min

60

Length of the time step: 60 for hourly data, 1440 for daily data.

pSpinUpDays

int

days

365

Days at the start of the period used only to warm up the model storages, excluded from the evaluation against the observations.

doWriteState

boolean

false

If true, model state is written to the database at each time step.

pPsoIterations

int

300

Number of PSO iterations.

pParticlesNum

int

20

Number of PSO particles.

pC1

double

2.0

PSO cognitive acceleration constant (c1).

pC2

double

2.0

PSO social acceleration constant (c2).

pW0

double

0.9

PSO initial inertia weight (w0).

pDecay

double

0.4

PSO inertia weight decay factor.

pCalibrationThreadCount

int

20

Number of parallel threads for calibration.

pCostFunction

one of: KGE

KGE

Measure of the agreement between simulated and observed discharge: KGE, the Kling-Gupta efficiency (Gupta et al., 2009).

printDebugInfo

boolean

true

If true, the progress of the calibration is reported in detail.

Outputs

Parameter

Type

Unit

Description

outParams

double[]

The best parameters found, in the order expected by the simulation.

outCost

double

The score of the best parameters, for the chosen measure of agreement.

References

  • Kennedy, J., Eberhart, R. (1995). Particle swarm optimization. Proceedings of the IEEE International Conference on Neural Networks, 1942-1948.

  • Gupta, H. V., Kling, H., Yilmaz, K. K., Martinez, G. F. (2009). Decomposition of the mean squared error and NSE performance criteria: implications for improving hydrological modelling. Journal of Hydrology, 377(1-2), 80-91.

Example

import org.hortonmachine.hmachine.geoframe.ermworkflow.ErmCalibration;

// the folder containing the input data: change it to yours
var workspace = "/data/COURSE_WATER/"

var cal = new ErmCalibration();
cal.inGeopackagePath = workspace + "outputs/geoframe_data.gpkg"
cal.inFromTimestamp = "2018-01-01 01:00:00"
cal.inToTimestamp = "2020-12-31 01:00:00"
cal.pTimeStepMinutes = 60*24 // daily

// days to get get the model up and running 
cal.pSpinUpDays = 365

// Particle swarming calibration parameters
cal.pPsoIterations = 300
cal.pParticlesNum = 50

// write 
cal.doWriteState = false
cal.printDebugInfo = false

cal.process()
The calibration script in the Geoscript Console, with the best cost of each iteration and the best parameters found.

The calibration run in the Geoscript Console: the log shows the best cost of the swarm at each iteration and, at the end, the best parameters found. They can be copied into the simulation script.