Following an upgrade from IMPROVER version 1.4.0 to 1.7.0, an issue has arisen with the bias (forecast_error) cubes used in applying simple bias correction (which is used within the BoM for statistical downscaling of global ensemble models). It appears that the masked areas of the analysis (truth) dataset are no longer being retained and instead filled with values of -9.96921e+36. Consequently, these bad values are being applied during the bias-correction step.
Tracking down the source, it appears that between IMPROVER version 1.4.0 and 1.5.0, the behaviour of the following operation has changed:
https://github.com/metoppv/improver/blob/a1b744b51576c2f2fd3e5cba3afb53af6e30643e/improver/calibration/simple_bias_correction.py#L77
where forecasts and truths are iris.cube.Cube objects. Previously the mask was the logical_or of forecasts.data.mask and truths.data.mask, however following 1.5.0 this has changed to copying the mask from the first argument. Thus the mask is no longer retained and the -9.96921e+36 values are coming through via the default fill value for truth.data in the the masked areas.
Reviewing the commit history, there is no obvious change that would explain what is happening here.
A simple fix is to explicit perform the logical_or operation on the masks to ensure that the mask is carried over to the forecast_error cube. However, without understanding the reason behind this change, it is difficult to say whether this is an isolated issue or could have arisen in other parts of the codebase.
Following an upgrade from IMPROVER version 1.4.0 to 1.7.0, an issue has arisen with the bias (forecast_error) cubes used in applying simple bias correction (which is used within the BoM for statistical downscaling of global ensemble models). It appears that the masked areas of the analysis (truth) dataset are no longer being retained and instead filled with values of
-9.96921e+36
. Consequently, these bad values are being applied during the bias-correction step.Tracking down the source, it appears that between IMPROVER version 1.4.0 and 1.5.0, the behaviour of the following operation has changed: https://github.com/metoppv/improver/blob/a1b744b51576c2f2fd3e5cba3afb53af6e30643e/improver/calibration/simple_bias_correction.py#L77 where
forecasts
andtruths
areiris.cube.Cube
objects. Previously the mask was the logical_or offorecasts.data.mask
andtruths.data.mask
, however following 1.5.0 this has changed to copying the mask from the first argument. Thus the mask is no longer retained and the-9.96921e+36
values are coming through via the default fill value fortruth.data
in the the masked areas.Reviewing the commit history, there is no obvious change that would explain what is happening here.
A simple fix is to explicit perform the logical_or operation on the masks to ensure that the mask is carried over to the forecast_error cube. However, without understanding the reason behind this change, it is difficult to say whether this is an isolated issue or could have arisen in other parts of the codebase.