Create a SWAT calibration project
Source:R/multiobjective-01-create_calibration_project.R
create_calibration_project.RdCreates a new SWAT calibration project by copying all required input files
from an existing TxtInOut folder into a new project directory. A
Backup subfolder is also created and populated with the same inputs
so original files can be safely restored during iterative calibration or
sensitivity analyses.
Usage
create_calibration_project(
swat_TxtInOut,
destination_dir = NULL,
project_name,
set_working_dir = TRUE
)Arguments
- swat_TxtInOut
character. Path to the existing SWAT
TxtInOutfolder.- destination_dir
character. Directory where the new project will be created. If
NULL, defaults to the current working directory.- project_name
character. Name for the new calibration project.
- set_working_dir
logical. If
TRUE(default), sets the working directory to the new project'sTxtInOutfolder.
Details
Output files typically generated by SWAT (e.g., output.rch,
output.sub, output.hru, etc.) are excluded from the copy to
keep the project clean and reproducible from inputs.
See also
run_swat for executing SWAT runs, download_swat_exe to obtain the SWAT executable (Windows only), setup_swat to configure simulation period and outputs.
Other Multiobjective calibration:
best_compromise_solution(),
calculate_objectives(),
calibrate_swat()
Examples
# \donttest{
old_wd <- getwd()
on.exit(setwd(old_wd), add = TRUE)
# Write the example SWAT project into a temporary directory
tmpdir <- tempdir()
get_swat_example(tmpdir)
# Create a calibration project (adds Backup) and set it as working directory
create_calibration_project(
swat_TxtInOut = file.path(tmpdir, "TxtInOut"),
destination_dir = tmpdir,
project_name = "calib_project",
set_working_dir = TRUE
)
# }