Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cf.read fails for some PP data with a single vertical level #667

Closed
davidhassell opened this issue Jun 12, 2023 · 0 comments · Fixed by #668
Closed

cf.read fails for some PP data with a single vertical level #667

davidhassell opened this issue Jun 12, 2023 · 0 comments · Fixed by #668
Labels
bug Something isn't working um/pp Relating to UM or PP format files
Milestone

Comments

@davidhassell
Copy link
Collaborator

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
@davidhassell davidhassell added bug Something isn't working um/pp Relating to UM or PP format files labels Jun 12, 2023
@davidhassell davidhassell added this to the Next release milestone Jun 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working um/pp Relating to UM or PP format files
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant