Skip to contents

Executes a specified optimization algorithm to calibrate a hydrological model. Supports multiple calibration methods and Monte Carlo sampling strategies.

Usage

call_cal_fn(
  cal_fn,
  hydro_data,
  split_indices,
  model,
  input,
  snow_module = NULL,
  snow_input = NULL,
  snow_parameters = NULL,
  error_crit,
  cal_maximize,
  cal_q_transfo,
  lambda,
  do_transfo_param,
  cal_par = default_cal_par
)

Arguments

cal_fn

A string specifying the calibration function or method to use. Supported options include "DEoptim", "hydroPSO", and "malschains". Monte Carlo variants can be specified using the format "method__sampling__nruns". For a complete list see table in vignette("calibration_methods_overview").

hydro_data

A list or data frame containing observed runoff data, typically loaded using load_meteo_data.

split_indices

A list of index vectors (e.g., from split_data_set) indicating warm-up and calibration periods.

model

A string specifying the hydrological model to calibrate. For a complete list see table in vignette("model_overview").

input

A list of model input data, typically created using create_input.

snow_module

Optional. A string specifying the snow module used (currently "CemaNeige" and "TUWsnow").

snow_input

Optional. Input data for the snow module.

snow_parameters

Optional. Initial or fixed parameters for the snow module.

error_crit

A string naming the error criterion function (e.g., "KGE"). Must be compatible with calc_hydroGOF or from the hydroGOF package.

cal_maximize

Logical. If TRUE, the calibration maximizes the objective function.

cal_q_transfo

A string indicating how runoff should be transformed (see transfo_q).

lambda

Optional. A numeric value or vector used for regularization or multi-objective weighting.

do_transfo_param

Logical. If TRUE, parameters are transformed to a unit hypercube before calibration.

cal_par

A list of calibration settings specific to the chosen calibration function. Defaults to default_cal_par, but can be customized by the user.

Value

A list or object containing the results of the calibration, including optimized parameters and performance metrics.

Note

This function requires the hydroPSO package to be installed. Not imported as this package depends on deprecated packages as sp etc.

Examples

if (FALSE) {
cal_output <- call_cal_fn(
  cal_fn = "DEoptim",
  hydro_data = hydro_data,
  split_indices = split_data_set(...),
  model = "GR4J",
  input = create_input(...),
  error_crit = "KGE",
  cal_maximize = TRUE,
  cal_q_transfo = "none",
  do_transfo_param = TRUE,
  cal_par = default_cal_par
)
}