Skip to content

Commit a90a26f

Browse files
authored
Merge pull request #738 from davidhassell/lbproc-131072
Recognise LBPROC 131072 when reading UM files
2 parents a19d870 + fc5407d commit a90a26f

File tree

2 files changed

+39
-1
lines changed

2 files changed

+39
-1
lines changed

Changelog.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ version NEXT
1212
* Fix misleading error message when it is not possible to create area
1313
weights requested from `cf.Field.collapse`
1414
(https://github.com/NCAS-CMS/cf-python/issues/731)
15+
* Fix bug in `cf.read` when reading UM files that caused LBPROC value
16+
131072 (Mean over an ensemble of parallel runs) to be ignored
17+
(https://github.com/NCAS-CMS/cf-python/issues/737)
1518

1619
----
1720

cf/read_write/um/umread.py

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1583,16 +1583,51 @@ def create_bounds_array(self, bounds0, bounds1):
15831583
def create_cell_methods(self):
15841584
"""Create the cell methods.
15851585
1586+
**UMDP F3**
1587+
1588+
LBPROC Processing code. This indicates what processing has
1589+
been done to the basic field. It should be 0 if no processing
1590+
has been done, otherwise add together the relevant numbers
1591+
from the list below:
1592+
1593+
1 Difference from another experiment.
1594+
2 Difference from zonal (or other spatial) mean.
1595+
4 Difference from time mean.
1596+
8 X-derivative (d/dx)
1597+
16 Y-derivative (d/dy)
1598+
32 Time derivative (d/dt)
1599+
64 Zonal mean field
1600+
128 Time mean field
1601+
256 Product of two fields
1602+
512 Square root of a field
1603+
1024 Difference between fields at levels BLEV and BRLEV
1604+
2048 Mean over layer between levels BLEV and BRLEV
1605+
4096 Minimum value of field during time period
1606+
8192 Maximum value of field during time period
1607+
16384 Magnitude of a vector, not specifically wind speed
1608+
32768 Log10 of a field
1609+
65536 Variance of a field
1610+
131072 Mean over an ensemble of parallel runs
1611+
15861612
:Returns:
15871613
1588-
`list`
1614+
`list` of `str`
1615+
The cell methods.
15891616
15901617
"""
15911618
cell_methods = []
15921619

15931620
LBPROC = self.lbproc
15941621
LBTIM_IB = self.lbtim_ib
15951622
tmean_proc = 0
1623+
1624+
# ------------------------------------------------------------
1625+
# Ensemble mean cell method
1626+
# ------------------------------------------------------------
1627+
if 131072 <= LBPROC < 262144:
1628+
cell_methods.append("realization: mean")
1629+
LBPROC -= 131072
1630+
15961631
if LBTIM_IB in (2, 3) and LBPROC in (128, 192, 2176, 4224, 8320):
15971632
tmean_proc = 128
15981633
LBPROC -= 128

0 commit comments

Comments
 (0)