diff --git a/Changelog.rst b/Changelog.rst index c6e6b25d5c..7b6dbd7576 100644 --- a/Changelog.rst +++ b/Changelog.rst @@ -12,6 +12,9 @@ version NEXT * Fix misleading error message when it is not possible to create area weights requested from `cf.Field.collapse` (https://github.com/NCAS-CMS/cf-python/issues/731) +* Fix bug in `cf.read` when reading UM files that caused LBPROC value + 131072 (Mean over an ensemble of parallel runs) to be ignored + (https://github.com/NCAS-CMS/cf-python/issues/737) ---- diff --git a/cf/read_write/um/umread.py b/cf/read_write/um/umread.py index 57d01213f5..c073adb2fa 100644 --- a/cf/read_write/um/umread.py +++ b/cf/read_write/um/umread.py @@ -1583,9 +1583,36 @@ def create_bounds_array(self, bounds0, bounds1): def create_cell_methods(self): """Create the cell methods. + **UMDP F3** + + LBPROC Processing code. This indicates what processing has + been done to the basic field. It should be 0 if no processing + has been done, otherwise add together the relevant numbers + from the list below: + + 1 Difference from another experiment. + 2 Difference from zonal (or other spatial) mean. + 4 Difference from time mean. + 8 X-derivative (d/dx) + 16 Y-derivative (d/dy) + 32 Time derivative (d/dt) + 64 Zonal mean field + 128 Time mean field + 256 Product of two fields + 512 Square root of a field + 1024 Difference between fields at levels BLEV and BRLEV + 2048 Mean over layer between levels BLEV and BRLEV + 4096 Minimum value of field during time period + 8192 Maximum value of field during time period + 16384 Magnitude of a vector, not specifically wind speed + 32768 Log10 of a field + 65536 Variance of a field + 131072 Mean over an ensemble of parallel runs + :Returns: - `list` + `list` of `str` + The cell methods. """ cell_methods = [] @@ -1593,6 +1620,14 @@ def create_cell_methods(self): LBPROC = self.lbproc LBTIM_IB = self.lbtim_ib tmean_proc = 0 + + # ------------------------------------------------------------ + # Ensemble mean cell method + # ------------------------------------------------------------ + if 131072 <= LBPROC < 262144: + cell_methods.append("realization: mean") + LBPROC -= 131072 + if LBTIM_IB in (2, 3) and LBPROC in (128, 192, 2176, 4224, 8320): tmean_proc = 128 LBPROC -= 128