Skip to content

Statistical methods

Thomas Nipen edited this page Nov 25, 2023 · 18 revisions

Gridpp supports a number of basic statistical methods for gridded forecasts. Many of these methods can be represented by a calibration curve.

The function apply_curve performs this adjustment. The curve itself can be constructed by using various methods.

adjusted_fcst = gridpp.apply_curve(input, ref_curve, fcst_curve, policy_below, policy_above)

where input is either a scalar, a 1D vector, or a 2D vector; curve is a calibration curve; and policy_below and policy_above define how to treat inputs that are outside the domain of the calibration curve (see Extrapolation curve below).

When the input is 2D (i.e. a gridded forecasts), the calibration curve can either be 1D (same correction on every grid point) or 3D (different curve for each grid point). In the 3D case, the last dimension is the curve dimension.

Quantile mapping

Quantile mapping uses the relationship between historical forecasts and a reference dataset. A curve is created by sorting the forecast and reference points.

ref_curve, fcst_curve = gridpp.quantile_mapping_curve(ref, fcst)

where fcst is a 1D vector of forecast samples and ref is a 1D vector of reference samples

Here is an example where a curve is computed and applied to an input:

input = 275
fcst = [250, 270, 290, 310]
ref = [240, 275, 290, 305]
ref_curve, fcst_curve = gridpp.quantile_mapping_curve(ref, fcst)
adjusted = gridpp.apply_curve(input, ref_curve, fcst_curve, gridpp.OneToOne, gridpp.OneToOne)

Extrapolation policy

The extrapolation policy specifies how values are extrapolated outside the domain of the curve. The following extrapolation policies are supported:

Policy Description
gridpp.OneToOne A one-to-one line is used outside the domain
gridpp.MeanSlope The slope between the two extreme points on the curve is used to extrapolate
gridpp.NearstSlope The slope between the two lowest points is used below the curve (similarly for the two highest points)
gridpp.Zero A slope of 0 outside the curve
Clone this wiki locally