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.
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
)
path to the project directory (string)
SWAP parameter to alter (string)
Parameter set to vary your variable across (vector)
(optional, numeric) if your parameter is stored in a table you need to pass the row in which it is in
(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
)
(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 (requires
statistic
to be not passed)
(optional, numeric) if your obs_variable
has a respective
depth, pass it here (cm)
(optional, Boolean) delete the model files (results) after function completion?
(optional, string) SWAP file to run, by default "swap.swp"
(optional, numeric) The number of CPU cores to run the sensitivity analysis on.
(optional, Boolean) Match model output to observed data?
(optional, Boolean) If an rswap directory already exists, no new one will be generated/reloaded unless force=TRUE. Defaults to TRUE
(optional, Boolean) Print actions to console?
(optional, numeric) Maximum model run time in seconds. Unlimited by default.
Prints interactive plot and returns dataframe of the results.
# 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)
}