View source: R/swat2012_run_swat.R
run_swat2012 | R Documentation |
This function allows to run a SWAT2012 project in R. Basic settings for the SWAT run such as the simulation period or the time interval for the outputs can be done directly. SWAT simulation outputs can be defined that are returned in a 'tidy' format in R. Functionality such as model parametrization, parallel execution of simulations, or incremental saving of simulation runs is provided.
run_swat2012(
project_path,
output,
parameter = NULL,
start_date = NULL,
end_date = NULL,
output_interval = NULL,
years_skip = NULL,
rch_out_var = NULL,
sub_out_var = NULL,
hru_out_var = NULL,
hru_out_nr = NULL,
run_index = NULL,
run_path = NULL,
n_thread = NULL,
save_path = NULL,
save_file = NULL,
return_output = TRUE,
add_parameter = TRUE,
add_date = TRUE,
refresh = TRUE,
keep_folder = FALSE,
quiet = FALSE
)
project_path |
Character string that provides the path to the SWAT project folder (i.e. TxtInOut). |
output |
Define the output variables to extract from the SWAT model
runs. See function |
parameter |
(optional) SWAT model parameters either provided as named
vector or a tibble. The parameter changes provided with |
start_date |
(optional) Start date of the SWAT simulation. Provided as character string in a ymd format (e.g. 'yyyy-mm-dd') or in Date format. |
end_date |
(optional) End date of the SWAT simulation. Provided as character string in a ymd format (e.g. 'yyyy-mm-dd') or in Date format. |
output_interval |
(optional) Time interval in which the SWAT model outputs are written. Provided either as character string ("d" for daily, "m" for monthly, or "y" for yearly) or as SWAT input values (0 for monthly, 1 for daily, 2 for yearly). |
years_skip |
(optional) Integer value to define the number of simulation years that are skipped before writing SWAT model outputs. |
rch_out_var |
(optional) Numeric vector of maximum |
sub_out_var |
(optional) Numeric vector of maximum |
hru_out_var |
(optional) Numeric vector of maximum |
hru_out_nr |
(optional) Numeric vector of maximum |
run_index |
(optional) Numeric vector (e.g. |
run_path |
(optional) Character string that provides the path where the '.model_run' folder is written and the SWAT models are executed. If NULL '.model_run' is built in the project folder. |
n_thread |
(optional) Number of threads to be used for the parallel model run. If not provided models are run on single core. The parameter is ineffective for single simulations. |
save_path |
(optional) Character string to define the path where the
model runs are saved if |
save_file |
(optional) Character string to define the name of the folder where data bases are generated that store the simulations incrementally. |
return_output |
(optional) Logical. Whether outputs should be returned
or not. Set |
add_parameter |
(optional) Logical. If |
add_date |
(optional) Logical. If |
refresh |
(optional) Logical. |
keep_folder |
(optional) Logical. If |
quiet |
(optional) Logical. If |
Returns the simulation results for the defined output variables as a tibble. If more than one parameter set was provided a list of tibbles is returned where each column is a model run and each list entry is an output variable.
To learn the basics on how to use SWATplusR
see the
Get started
page on the package's github page.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.