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

Prevent read error for datasets including badly-encoded UGRID meshes #316

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

sadielbartholomew
Copy link
Member

Closes #315. For the need for a quite specific dataset to test against and lack of bandwidth before we are due to do the new release set, I am not adding a test to capture the bug, which I appreciate is not ideal but there is a test in the new cf-plot suite which exposed this, which I think is good enough*.

*This involves updating the code snippet for the appropriate cf-plot example, where the field indexing seems to have changed so that I've matched the relevant fields like so to update it to work with this branch, whereas before it hit the error covered in the associated issue on the initial read:

>>> f = cf.read("/home/slb93/git-repos/cf-plot/cfplot/test/cfplot_data/lfric_initial.nc")
There was a problem parsing the UGRID mesh topology variable. Ignoring the UGRID mesh for 'u1'.
There was a problem parsing the UGRID mesh topology variable. Ignoring the UGRID mesh for 'u2'.
>>> pot = f.select_by_identity("air_potential_temperature")[0]
>>> lats = f.select_by_identity("latitude")[0]
>>> lons = f.select_by_identity("longitude")[0]
>>> faces = f.select_by_identity("cf_role=face_edge_connectivity")[1]  # try second of two
>>> pot_crop = pot[4,:]  # reduce
>>> cfp.con(f=pot_crop, face_lons=lons, face_lats=lats, face_connectivity=faces, lines=False)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unable to read some unstructured datasets (UnboundLocalError)
1 participant