## ----include = FALSE----------------------------------------------------------
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.align = "center",
  warning = FALSE,
  message = FALSE,
  eval = FALSE
)

## ----load_package-------------------------------------------------------------
# library(clim4health)

## -----------------------------------------------------------------------------
# hcst_path <- system.file("extdata/hindcast/", package = "clim4health")
# hcst_path <- paste0(hcst_path, "/")
# hcst <- c4h_load(hcst_path,
#                  variable = "t2m",
#                  year = 2010:2012,
#                  month = 1,
#                  leadtime_month = "all",
#                  ext = "nc")
# 
# rean_path <- system.file("extdata/reanalysis/", package = "clim4health")
# rean_path <- paste0(rean_path, "/")
# rean <- c4h_load(rean_path,
#                  variable = "t2m",
#                  year = 2010:2012,
#                  month = 1,
#                  leadtime_month = 1:3,
#                  ext = "nc")

## -----------------------------------------------------------------------------
# hcst <- c4h_convert_units(hcst, to = "celsius")
# rean <- c4h_convert_units(rean, to = "celsius")
# 
# dwn <- c4h_downscale("Intbc", exp = hcst, obs = rean,
#                      method_remap = "bilinear", method_bc = "evmos")

## ----c4h_verify_parameters,fig.width=10, fig.height=10, fig.align='center', out.width='100%', echo= FALSE, fig.cap="Figure 1: Structure of the c4h_verify function, outlining its key arguments and general functionality."----
# knitr::include_graphics("https://gitlab.earth.bsc.es/ghr/clim4health/-/blob/main/inst/figures/clim4health_verification_parameters.svg?ref_type=heads")

## ----c4h_verify_ROC,fig.width=10, fig.height=10, fig.align='center', out.width='100%', echo= FALSE, fig.cap="Figure 2: For the two temperature events (temperature in the upper quintile category, red; temperature in the lower quintile category, blue) the hit rates and false alarm rates associated with a range of 'trigger' thresholds (triangles) are plotted. The vertical axis gives the hit rate, defined as the number of times the event was forecast (with probability above a certain threshold) and later observed to occur. Source: UK Met Office."----
# knitr::include_graphics("https://gitlab.earth.bsc.es/ghr/clim4health/-/blob/main/inst/figures/metofficegovuk_xsmall.gif?ref_type=heads")

## -----------------------------------------------------------------------------
# skill <- c4h_verify(exp = dwn$exp,
#                     obs = dwn$obs,
#                     metrics = c("BSS", "CRPSS"),
#                     brier_thresholds = c(0.1, 0.9))

## -----------------------------------------------------------------------------
# names(skill)

## -----------------------------------------------------------------------------
# names(skill$BSS10)
# 
# print(skill$BSS10$bss$dims)

## -----------------------------------------------------------------------------
# c4h_plotskill(skill$BSS10$bss, skill$BSS10$sign, ensemble = TRUE, boundaries = "countries")

