Skip to contents

Applies several SWAT parameter updates by iterating over rows of `parameter_info` and internally calling change_parameter. Commonly used in calibration or sensitivity workflows, and integrates with run_swat and calibrate_swat.

Usage

change_multiple_parameters(parameter_info, subbasins = NULL)

Arguments

parameter_info

data.frame or tibble. Each row defines one parameter update and must include: `component`, `parameter`, `value`, `method`. Optional columns: `version` (defaults to "SWAT") and `plant_type` (required when `component = "plant.dat"`).

subbasins

numeric. Vector of subbasin IDs where the changes should be applied. If `NULL` (default), changes are applied globally.

Value

A list with one element per row of `parameter_info`. Each element is the value returned by change_parameter.

See also

Examples

# \donttest{
library(tibble)

tmpdir <- tempdir()
get_swat_example(tmpdir)
setwd(file.path(tmpdir, "TxtInOut"))

# Define multiple parameter changes
parameter_info <- tibble(
  component = c(".gw", ".mgt"),
  parameter = c("GW_DELAY", "CN2"),
  value     = c(30, 0.10),
  method    = c("v", "r")
)

# Apply changes to subbasins 1 and 2
results <- change_multiple_parameters(
  parameter_info, subbasins = c(1, 2)
)

# Apply changes globally (all subbasins)
results_global <- change_multiple_parameters(parameter_info)
# }