Skip to contents

This function calculates various performance metrics for two or more variables between a given simulation and observed data.

Usage

calculate_performance_2plus(
  sim,
  vector_var,
  list_obs,
  list_periods = NULL,
  vector_weights = NULL,
  perf_metrics = NULL
)

Arguments

sim

Object from SWATrunR

vector_var

Character vector of variables to be used in performance metric calculation. They should be present in sim object. Example vector_var = c("flo_day_52", "no3_day_52_conc", "gwd_day"). The rest parameters should be provided in the same sequence as variables vector.

list_obs

List of dataframes for the observed data with two columns: 'date', 'value'.

list_periods

(optional) List of two-element character vectors with the start and end dates for the period to be used in the performance metric calculation for each variable. Default list_periods = NULL, means full observation data periods are used. Example list_periods = list(c('2002-01-01', '2011-12-26'), c('2007-01-01', '2008-12-26'), c('2007-01-01', '2011-12-26'))

vector_weights

(optional) Numeric vector of weights for each variable in the vector_var. Default vector_weights = NULL, which means all variables will impact final results the same. vector_weights = c(0.5, 0.3, 0.2). The sum of weights should be 1.

perf_metrics

(optional) Character vector with the names of the performance metrics to used in the rank_tot calculation. Default perf_metrics = NULL, which means that all (in this case c("nse", "kge", "pbias", "r2", "mae")) performance metrics will be used in calculation. Other example could be perf_metrics = c("kge", "nse"), which means that only KGE and NSE will be used in calculation.

Value

A list of two objects. One list 'obj_tbl_list' is storage with all performance metrics for each variable. Another, 'obj_tbl' is dataframe with aggregated results for all variables. This dataframe has final ranking and run ids/

Examples

if (FALSE) {
obj_tbl_m <- calculate_performance_2plus(sim,
  vector_var = c("flo_day_52",  "no3_day_52_conc", "gwd_day"),
  list_obs = list(obs_flow, obs_no3, obs_gwd),
  list_periods = list(c('2002-01-01', '2011-12-26'),
    NULL, c('2007-01-01', '2011-12-26')),
  vector_weights = c(0.5, 0.3, 0.2),
  perf_metrics = c("nse", "kge", "pbias", "r2", "mae"))
}