improver.cli.enforce_consistent_forecasts module
CLI to enforce consistency between two forecasts.
- process(*cubes, ref_name=None, additive_amount=[0.0], multiplicative_amount=[1.0], comparison_operator=['>='], diff_for_warning=None)[source]
Module to enforce that the values in the forecast cube are not less than, not greater than, or between some linear function(s) of the corresponding values in the reference forecast.
- Parameters:
cubes (iris.cube.CubeList or list of iris.cube.Cube) –
- containing:
- forecast_cube (iris.cube.Cube):
Cube of forecasts to be updated by using the reference forecast to create a bound on the value of the forecasts.
- ref_forecast (iris.cube.Cube)
Cube of forecasts used to create a bound for the values in forecast_cube. It must be the same shape as forecast_cube but have a different name.
ref_name (str) – Name of ref_forecast cube
additive_amount (List[float]) – The amount to be added to the reference forecast (in the units of the reference forecast) prior to enforcing consistency between the forecast and reference forecast. If both an additive_amount and multiplicative_amount are specified then addition occurs after multiplication. If a list is provided, then it must contain two float elements; one for defining the lower bound and one the upper.This option cannot be used for probability forecasts, if it is then an error will be raised.
multiplicative_amount (List[float]) – The amount to multiply the reference forecast by prior to enforcing consistency between the forecast and reference forecast. If both an additive_amount and multiplicative_amount are specified then addition occurs after multiplication. If a list is provided, then it must contain two float elements; one for defining the lower bound and one the upper.This option cannot be used for probability forecasts, if it is then an error will be raised.
comparison_operator (List[str]) – Determines whether the forecast is enforced to be not less than or not greater than the reference forecast. Valid choices for enforcing one bound are “>=”, for not less than, and “<=” for not greater than. Valid choices for defining two bounds are [“>=”, “<=”] or [“<=”, “>=”].
diff_for_warning (float) – If assigned, the plugin will raise a warning if any absolute change in forecast value is greater than this value.
- Returns:
A forecast cube with identical metadata to forecast but the forecasts are enforced to adhere to the defined bounds.
- Return type:
- Raises:
ValueError – if additive_amount, multiplicative_amount, and comparison_operator are of mismatching or incorrect lengths.
ValueError – if incorrect number of cubes are provided.