Skip to content

Preserve dataset attributes when converting CF geometries - #699

Open
Boulea7 wants to merge 1 commit into
xarray-contrib:mainfrom
Boulea7:fix/preserve-geometry-dataset-attrs
Open

Boulea7 wants to merge 1 commit into
xarray-contrib:mainfrom
Boulea7:fix/preserve-geometry-dataset-attrs

Conversation

@Boulea7

@Boulea7 Boulea7 commented Dec 3, 2026

Copy link
Copy Markdown

Encoding a dataset with geometry drops its global attributes before writing. Decoding a CF file that already has global attributes also drops them.

I checked this with three locations and 28 time steps from xarray’s public NCEP air-temperature dataset. The Zarr round trip kept all 84 temperatures but lost the source title, description, platform, references and conventions. Passing the input attributes to each Dataset constructor preserves all five. With a station geometry index, the reopened dataset then compares identical to the input.

The existing point, polygon and multi-geometry tests now check both encoded attributes and the decoded dataset. The full suite passed 301 tests and skipped one.

OpenAI Codex prepared the patch, tests and description.

This branch has not been deployed

No deployments
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.

1 participant