Skip to contents

Computes validation metrics for specified subseasonal periods within a hydrological dataset. For each named period in val_subseason, the function subsets the data using the provided indices and calculates performance metrics using calc_validation_results.

Usage

calc_subseasonal_validation_results(
  val_subseason,
  dates,
  ind,
  period_name,
  col_name = "period",
  Qsim,
  Qobs,
  val_crit_transfo = "KGE__none"
)

Arguments

val_subseason

A named list where each element is a character vector of two-digit month codes (e.g., "06", "07") defining the months for each subseasonal period.

dates

A vector of dates (e.g., of class Date or POSIXct) corresponding to the time series.

ind

A vector of indices used to subset the hydrological data.

period_name

A string indicating the name of the period (e.g., "calibration" or "validation"), which will be added as a column in the output.

col_name

A string specifying the name of the additional column to be added to the output (default is "period").

Qsim

A numeric vector of simulated runoff values.

Qobs

A numeric vector of observed runoff values.

val_crit_transfo

A character vector specifying validation criteria and runoff transformations, separated by "__". Optionally, a third part can specify a lambda parameter. Supported criteria are those from the hydroGOF package and must be compatible with calc_hydroGOF. Supported transformations are described in transfo_q.

Value

A data frame similar to the output of validate_model, but with two additional columns: one for the subseasonal period (e.g., "spring", "summer") and one for the period name (e.g., "calibration"), as specified by col_name and period_name.

Examples

perf_cal <- calc_subseasonal_validation_results(
  val_subseason = list(
    spring = c("02", "03", "04", "05"),
    summer = c("06", "07", "08", "09")
  ),
  dates = hydro_data$BasinObs$DatesR,
  ind = split_indices$ind_cal,
  period_name = "calibration",
  col_name = "period",
  Qsim = simulation_results$Qsim,
  Qobs = Qobs,
  val_crit_transfo = c(
    "KGE__none", "NSE__none", "VE__none", "pbias__none",
    "KGE__inv", "NSE__inv",
    "KGE__sqrt", "NSE__sqrt"
  )
)
#> Error in purrr::map(val_subseason, ~find_monthly_indices(dates, .x, ind)):  In index: 1.
#>  With name: spring.
#> Caused by error in `data.frame()`:
#> ! object 'hydro_data' not found