`cf.read` fails for some PP data with a single vertical level
cf.read fails for some PP data with a single vertical level, as follows:
>>> import cf >>> f = cf.read('xolaha@pas80ag.pp') <snip> File ~/cf-python/cf/read_write/um/umread.py:2004, in UMField.create_data(self) 2001 indices = [(i, rec) for i, rec in enumerate(recs)] 2003 if z_axis in self.down_axes: -> 2004 indices = self._reorder_z_axis(indices, z_axis, pmaxes) 2006 for i, rec in indices: 2007 # Find the data type of the array in the file 2008 file_data_type = data_type_in_file(rec) File ~/cf-python/cf/read_write/um/umread.py:1173, in UMField._reorder_z_axis(self, indices, z_axis, pmaxes) 1139 """Reorder the Z axis `Rec` instances. 1140 1141 :Parameters: (...) 1170 1171 """ 1172 indices_new = [] -> 1173 zpos = pmaxes.index(z_axis) 1174 aaa0 = indices[0] 1175 indices2 = [aaa0] ValueError: 'domainaxis1' is not in list
This bug was introduced at v3.15.0, and is easily fixed. PR to follow.
>>> cf.environment(paths=False) Platform: Linux-5.15.0-73-generic-x86_64-with-glibc2.35 HDF5 library: 1.12.2 netcdf library: 4.8.1 udunits2 library: miniconda3/lib/libudunits2.so.0 esmpy/ESMF: 8.2.0 Python: 3.10.10 dask: 2023.4.1 netCDF4: 1.6.2 psutil: 5.9.5 packaging: 23.0 numpy: 1.22.3 scipy: 1.10.1 matplotlib: 3.7.1 cftime: 1.6.2 cfunits: 3.3.6 cfplot: 3.2.12 cfdm: 1.10.1.0 cf: 3.15.1