This function automates a simple sensitivity analysis for your SWAP project.
Pass the project path, a SWAP parameter you would like to vary, as well as
the values you would like to vary it by. If you pass a statistical
performance indicator (statistic
, those supported by package hydroGOF
)
you will get your results in terms of that indicator. If you do not pass a
statistic
parameter, you will get output with respect to your
obs_variable
. Note: if your obs_variable
is not present in your observed
data, no worries, the plot will just not include observed data.
Usage
check_swap_sensitivity(
project_path,
variable,
values,
row = NULL,
statistic = NULL,
obs_variable = NULL,
depth = NULL,
cleanup = TRUE,
swap_file = "swap.swp",
n_cores = NULL,
autoset_output = FALSE,
force = TRUE,
verbose = FALSE,
timeout = Inf
)
Arguments
- project_path
path to the project directory (string)
- variable
SWAP parameter to alter (string)
- values
Parameter set to vary your variable across (vector)
- row
(optional, numeric) if your parameter is stored in a table you need to pass the row in which it is in
- statistic
(optional, string) if you would like to evaluate the sensitivity of model performance to the passed parameter set, please specify which statistical indicator you would like to use (supported by
hydroGOF
)- obs_variable
(optional, string) the observed variable you would like model performance to be evaluated with (required if
statistic
is passed) or the output variable you would to see how the sensitivity of (requiresstatistic
to be not passed)- depth
(optional, numeric) if your
obs_variable
has a respective depth, pass it here (cm)- cleanup
(optional, Boolean) delete the model files (results) after function completion?
- swap_file
(optional, string) SWAP file to run, by default "swap.swp"
- n_cores
(optional, numeric) The number of CPU cores to run the sensitivity analysis on.
- autoset_output
(optional, Boolean) Match model output to observed data?
- force
(optional, Boolean) If an rswap directory already exists, no new one will be generated/reloaded unless force=TRUE. Defaults to TRUE
- verbose
(optional, Boolean) Print actions to console?
- timeout
(optional, numeric) Maximum model run time in seconds. Unlimited by default.
Examples
# This function cannot execute example code as it relies on the externally
# provided swap model
if(FALSE){
exe_path = "../swap.exe"
path = rswap_init(swap_exe = exe_path)
check_swap_sensitivity(project_path = path,
variable = "OSAT",row = 1, values = seq(0.32, 0.48, by = 0.01),
obs_variable = "WC", depth = 15,
autoset_output = TRUE, verbose = F)
}