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
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ Version NEXTVERSION
* Fix bug that caused `cfdm.write` to fail when a parametric Z
dimension coordinate did not have a ``computed_standard_name``
attribute (https://github.com/NCAS-CMS/cfdm/issues/303)
* Fix bug that caused `cfdm.read` to fail to read at all
datasets including variables with badly-encoded UGRID meshes
(https://github.com/NCAS-CMS/cfdm/issues/315)
* New class `cfdm.H5netcdfArray`
* New class `cfdm.NetCDF4Array`
* New dependency: ``h5netcdf>=1.3.0``
Expand Down
6 changes: 4 additions & 2 deletions cfdm/read_write/netcdf/netcdfread.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from dataclasses import dataclass, field
from functools import reduce
from math import nan, prod
from pprint import pformat
from typing import Any
from urllib.parse import urlparse
from uuid import uuid4
Expand Down Expand Up @@ -3787,9 +3788,10 @@ def _create_field_or_domain(
ugrid = False
logger.warning(
"There was a problem parsing the UGRID mesh "
f"topology variable {mesh.mesh_ncvar!r}: "
f"Ignoring the UGRID mesh for {field_ncvar!r}."
"topology variable. Ignoring the UGRID mesh "
f"for {field_ncvar!r}."
)
logger.debug(f"Mesh dictionary is: {pformat(g['mesh'])}")

if ugrid:
# The UGRID specification is OK, so get the auxiliary
Expand Down
Loading