-
Notifications
You must be signed in to change notification settings - Fork 16
Statistical methods
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, 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).
Quantile mapping uses the relationship between historical forecasts and a reference dataset. A curve is created by sorting the forecast and reference points.
curve = gridpp.quantile_mapping_curve(ref, fcst)
where fcst
is a 1D vector of forecast samples, ref
is a 1D vector of reference samples, and policy
is an extrapolation policcy specifying how values are extrapolated outside the domain of fcst
. The following extrapolation policies are supported: 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); and gridpp.Zero
, a slope of 0 outside the curve.
Here is an example:
input = 275
fcst = [250, 270, 290, 310]
ref = [240, 275, 290, 305]
gridpp.quantile_mapping(input, fcst, ref, gridpp.OneToOne)