calc_fc_cats: Get probabilities of forecast categories

View source: R/calc_fc_cats.R

calc_fc_catsR Documentation

Get probabilities of forecast categories

Description

Calculates index for hindcasts and forecasts and then derives category thresholds from hindcasts and calculates forecast probabilities for each category. The function works with gridded or station data (all input data needs to be of same type) and first calculates the chosen index (using calc_index) for hindcasts and forecasts and then divides the forecast into categories (e.g. terciles for ncat=3) based on the climatology of the hindcasts. It outputs the forecast probabilities for each category as well as the category thresholds.

Usage

calc_fc_cats(
  fc,
  hc,
  index,
  index_args = list(),
  selyears = NULL,
  prob,
  ncat = 3,
  counts = FALSE
)

Arguments

fc

Forecasts. "climindvis_index" object of type fc_p/fc_grid as output from make_object using an ensemble daily seasonal forecasts.

hc

Hindcasts. "climindvis_index" object of type hc_p/hc_grid as output from make_object using an ensemble of daily seasonal hindcasts.

index

Name of index to be calculated., e.g. index = "dd" or index = "tnn". For list of indices see indices_list

index_args

List of arguments for index. See indices_list.

selyears

Integer array of years to be selected from data. For indices with quantiles, years as defined in index_args are used for quantile calculation, but only selected years are plotted. For functions using seasonal forecast data, selyears is only applied to hindcasts.

prob

Probability thresholds for converting continuous forecasts to category forecasts. If not provided then ncat equidistant categories are calulated: (1:(ncat-1))/ncat).

ncat

Number of forecast categories. Default = 3.

counts

Logical. Should number of ensemble members per category be returned instead of probabilities. Default=FALSE

Value

Object of class index and "climindvis_fc" with following entries:

  • cprob/ccount: Array of forecast probabilities/counts for each category with named dimensions

  • cpinfo: Named list with additional information. Absolute category threshold values from hindcasts (prob_th) and the corresponding probability tresholds (prob), number of cateogories (ncat) and dimensions and dimension names of cprob (cpdims,cpdimnames).

  • lon: Array of longitudes

  • lat: Array of latitudes

  • index_info: Named list with information on index such as index name and aggregation type

  • data_info$fc and $hc :Data_info taken from fc and hc input objects, e.g. name of dataset

Note

This function either returns the forecast probabilities (cprob) or, if counts is set to TRUE, the number of ensemble members per category (ccount) . Forecast probabilities are calculated as follows: ccounts/number of ensemble members *100. These values are rounded to the nearest integer, therefore adding the forecast probabilities of all categories may not always add up to 100. Note that for some forecast the year dimension might be greater than one, e.g. for a November forecast and monthly temporal aggregation, the first two months (Nov. + Dez) are from another year than the following months.

Examples


## Load example climindvis objects:

data("object_hc_st", "object_fc_st")

calc_fc_cats(fc = object_fc_st, hc = object_hc_st, index = "tnn", index_args = list(aggt="seasonal"))


data("object_hc_grid", "object_fc_grid")

calc_fc_cats(fc = object_fc_grid, hc = object_hc_grid, index = "tnn", index_args = list(aggt="seasonal"))



Climandes/ClimIndVis documentation built on June 9, 2025, 7:09 p.m.