Skip to contents

The probability for a threshold for an ensemble is computed. This is by default for threshold exceedence (P(fcst >= threshold)), but the probability for being below the threshold, or between or outside of two thresholds can also be calculated.

Usage

ens_prob(
  x,
  threshold = 0,
  comparator = c("ge", "gt", "le", "lt", "between", "outside"),
  include_low = TRUE,
  include_high = TRUE,
  ...
)

Arguments

x

A harp_ens_grid_df or harp_ens_point_df data frame, a geolist, or a harp_list containing ensemble data frames.

threshold

A threshold for computing binary probabilities. If comparator = "between", it must be a two element vector. Set to NA to use the raw data.

comparator

How to compare x with the threshold to compute binary probabilities. Can be "ge", "gt", "le", or "lt" for >=, >, <= and < respectively. Can also be "between" or "outside", in which case the binary probability of being between or outside of the two values given in threshold is computed.

include_low

Logical. Whether to include to the lower of the two thresholds in the comparison when comparator = "between" or comparator = "outside".

include_high

Logical. Whether to include to the higher of the two thresholds in the comparison when comparator = "between" or comparator = "outside".

...

Used for methods.

Value

An object of the same class as x with the probabilities computed

Details

Note that when a geolist is passed to the function, each element of the geolist is assumed to be an ensemble member.

Examples

p_ge_0.5 <- ens_prob(ens_grid_df, 0.5)
image(p_ge_0.5$prob_ge_0.5[[1]])


p_le_0.1 <- ens_prob(ens_grid_df, 0.1, comparator = "le")
image(p_le_0.1$prob_le_0.1[[1]])


p_btw_0.25_0.75 <- ens_prob(
  ens_grid_df, c(0.25, 0.75), comparator = "between"
)
image(p_btw_0.25_0.75$prob_between_0.25_0.75[[1]])