Skip to contents

This function calculates various performance metrics for a given simulation and observed data.

Usage

calculate_performance(
  sim,
  obs,
  par_name = NULL,
  perf_metrics = NULL,
  period = NULL,
  fn_summarize = "mean"
)

Arguments

sim

Object from SWATrunR

obs

Dataframe for the observed data with two columns: date and value.

par_name

(optional) Character for name of the parameter set to be used. Default par_name = NULL, which select first variable in sim object. But if you have multiple parameter sets, you can use this argument to select the one you want to use. Example par_name = "flo_day" or par_name = no3_day_conc".

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 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.

period

(optional) Character describing, which time interval to display. Default period = NULL, which mean not activated, other examples are "day", "week", "month", etc). See lubridate::floor_date for details.

fn_summarize

(optional) Function to recalculate to the specified time interval. Default fn_summarize ="mean", other examples are "median", "sum". See dplyr::summarise for details.

Value

A dataframe with the performance metrics and ranking.

Examples

if (FALSE) {
obj_tbl <- calculate_performance(sim = sim_flow, obs, "flo_day", c("kge", "nse"), "month", "sum")
}