improver.ensemble_calibration.ensemble_calibration_utilities module

This module defines all the utilities used by the “plugins” specific for ensemble calibration.

improver.ensemble_calibration.ensemble_calibration_utilities.check_predictor_of_mean_flag(predictor_of_mean_flag)[source]

Check the predictor_of_mean_flag at the start of the estimate_coefficients_for_ngr method, to avoid having to check and raise an error later.

Parameters:predictor_of_mean_flag (string) – String to specify the input to calculate the calibrated mean. Currently the ensemble mean (“mean”) and the ensemble realizations (“realizations”) are supported as the predictors.
improver.ensemble_calibration.ensemble_calibration_utilities.convert_cube_data_to_2d(forecast, coord='realization', transpose=True)[source]

Function to convert data from a N-dimensional cube into a 2d numpy array. The result can be transposed, if required.

Parameters:
  • forecast (iris.cube.Cube) – N-dimensional cube to be reshaped.
  • coord (string) – The data will be flattened along this coordinate.
  • transpose (boolean) – If True, the resulting flattened data is transposed. This will transpose a 2d array of the format [:, coord] to [coord, :]. If False, the resulting flattened data is not transposed. This will result in a 2d array of format [:, coord].
Returns:

Reshaped 2d array.

Return type:

forecast_data (numpy.array)