Skip to content

Comments

Add read support for Zarr spatial and proj conventions#905

Merged
snowman2 merged 6 commits intocorteva:masterfrom
emmanuelmathot:feature/zarr-convention-read-clean
Feb 18, 2026
Merged

Add read support for Zarr spatial and proj conventions#905
snowman2 merged 6 commits intocorteva:masterfrom
emmanuelmathot:feature/zarr-convention-read-clean

Conversation

@emmanuelmathot
Copy link
Contributor

@emmanuelmathot emmanuelmathot commented Feb 4, 2026

Add read support for Zarr spatial and proj conventions

This is the second in a series of PRs splitting #883 as requested by maintainers. Depends on #899, #903, #904.

Changes:

  • Add Convention.ZARR enum value to rioxarray.enum
  • Create zarr.py module with ZarrConvention class implementing ConventionProtocol
  • Register ZarrConvention in _core.py's _CONVENTION_MODULES for automatic convention detection
  • Support proj:wkt2, proj:code, proj:projjson for CRS reading
  • Support spatial:transform, spatial:dimensions for transform and dimension reading
  • Convention declaration checking via zarr_conventions attribute

Architecture:

Reviewer feedback addressed:


Future PRs:

  • PR 3: Writing Zarr CRS (write_crs(convention=Convention.Zarr))
  • PR 4: Writing Zarr Transform (write_transform(convention=Convention.Zarr))

- Add Convention.Zarr enum value
- Create _convention/zarr.py module with ZarrConvention class implementing
  ConventionProtocol for reading CRS, transform, and spatial dimensions
- Support proj:wkt2, proj:code, proj:projjson for CRS reading
- Support spatial:transform, spatial:dimensions for transform and dimension reading
- Register ZarrConvention in _core.py's _CONVENTION_MODULES
- Both conventions are tried when reading regardless of setting (priority changes only)
- Add comprehensive unit tests for Zarr convention parsing and reading
- Add integration tests for Zarr convention with rio accessor

Note: Writing support will be implemented in a future PR.
- Rename Convention.Zarr to Convention.ZARR for UPPER_CASE naming style
- Replace broad 'except Exception' with specific exceptions (KeyError, TypeError, ValueError)
@emmanuelmathot emmanuelmathot marked this pull request as ready for review February 4, 2026 19:42
@snowman2 snowman2 added the enhancement New feature or request label Feb 4, 2026
@snowman2 snowman2 added this to the 0.22.0 milestone Feb 4, 2026
@emmanuelmathot
Copy link
Contributor Author

emmanuelmathot commented Feb 11, 2026

Any updates on this one @snowman2? I dont know how to solve the failing tests.

@snowman2
Copy link
Member

I need to first dig into the GeoZarr spec and want time to review the code before moving forward. Test failures that are unrelated won't block merging.

Possibly relevant:

@snowman2
Copy link
Member

https://xkcd.com/927/

@emmanuelmathot
Copy link
Contributor Author

I understand. Few notes here:

@snowman2 snowman2 merged commit 16789e8 into corteva:master Feb 18, 2026
15 of 22 checks passed
@snowman2
Copy link
Member

Thanks @emmanuelmathot 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants