This function prepares and writes a calibration.cal file based on the
provided parameter table. If multiple run IDs are supplied, separate
calibration folders and files will be created for each run.
Arguments
- par
A data frame containing SWAT+ parameter definitions and values. Column names should indicate which file the parameter belongs to and how it is modified. Examples of column naming conventions include:
"esco.hru | change = absval"— absolute value change"awc.sol | change = relchg"— relative change
For full details on parameter definitions and conventions, see: https://biopsichas.github.io/SWATtunR/articles/hc-par.html#hc_step2
- model_path
Path to the SWAT+ model directory.
- write_path
Optional. Directory where the calibration file(s) will be written. If
NULL(default), files are written intomodel_path.- i_run
An integer or integer vector specifying run ID(s). Default is
1.If multiple run IDs are supplied (e.g.
c(1, 3, 5)), calibration files will be written into:<write_path>/cal_files/cal_1/calibration.cal<write_path>/cal_files/cal_3/calibration.cal<write_path>/cal_files/cal_5/calibration.cal
Note
To use a specific generated calibration file in a SWAT+ model run, copy it
into the model directory and update the file.cio entry accordingly.
Examples
if (FALSE) { # \dontrun{
write_cal_file(my_parameter_table, "path/to/model", i_run = 1)
write_cal_file(my_parameter_table, "path/to/model", i_run = c(1, 3, 5))
} # }
