UGRID load loses the mesh when a connectivity variable lacks cf_role or start_index
Maintainers usually reply within 1 day
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 62/100
Research direction
Start in _build_connectivity in iris.fileformats.netcdf.ugrid_load, where cf_role and start_index are read directly from the connectivity variable. Reproduce by saving iris.tests.stock.mesh.sample_mesh_cube, removing start_index, and reloading. Done when a missing start_index falls back to 0 and the pinned test in lib/iris/tests/integration/test_cf.py is inverted. Decide how a missing cf_role should fail, with a message that names the attribute.
Written by the indexing model from the issue text.
Description
(posted by Claude Opus)
iris.fileformats.netcdf.ugrid_load._build_connectivity reads cf_role and start_index straight off the connectivity variable, and a file missing either one loses its mesh: the mesh build raises, the failure lands in iris.loading.LOAD_PROBLEMS, and the user gets an IrisLoadWarning and a mesh-less cube.
Neither read is guarded, and nothing upstream guarantees either attribute. CFUGridConnectivityVariable.identify finds the connectivity variable through the mesh variable's role attribute — face_node_connectivity and friends — so it never looks at the connectivity variable's own cf_role.
start_index is the clearer bug of the two: CF-UGRID makes it optional with a default of 0, and iris.mesh.Connectivity already defaults it to 0, so the loader should fall back rather than raise. cf_role is required by UGRID, so raising is defensible, but the message a user gets does not say which attribute was missing.
Reproduced by saving iris.tests.stock.mesh.sample_mesh_cube, deleting start_index from the connectivity variables, and reloading.
Found while moving the last internal CF attribute reads off CFVariable.__getattr__. Not fixed there: that branch is behaviour-only apart from the deprecation it adds. The current behaviour is pinned by a test in lib/iris/tests/integration/test_cf.py, which will need inverting when this is fixed.
- Dominant language
- Python
- Stars
- 730
- Forks
- 322
- Avg merge
- 1d 18h
- Merged PRs (30d)
- 21
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from SciTools/iris
-
Link Checker ReportOpenBot Type: Bug Type: Documentation
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
Maintainers usually reply within 1 day
-
guess_bounds(yearly=True) fails on a single point, monthly=True worksPossibly taken @pp-mo claimed this 29 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 90/100
SciTools/iris#7311 · 2 comments · 1 assignee ·
Maintainers usually reply within 1 day
-
Agentic
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
Maintainers usually reply within 1 day
Similar issues
-
documentation
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
awslabs/social-messaging-agent-runtime-toolkit#140 ·
Maintainers usually reply within 1 day
-
subtask
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
fga-eps-mds/2026.2-MeasureSoftGram-DOC#187 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
txn2/mcp-data-platform#2493 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
YO-WHATS-UP2/minigit#78 ·
Maintainers usually reply within 3 days
-
documentation
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
liberation-data/drivine-python#432 ·
Maintainers usually reply within 1 day