Registry Mirror
Skip to content

Conversation

@omsatpute61-afk

Copy link
Copy Markdown
Contributor

Summary

FillValueCoder.decode currently expects HDF5-style encoded values for some Zarr fill values, but Zarr metadata is JSON-native.

This PR allows FillValueCoder.decode to accept JSON-native fill values while preserving the existing encoded representation.

Changes

  • Accept None as a fill value.
  • Accept JSON-native numeric values for floating-point dtypes.
  • Accept JSON-native strings for Unicode and byte-string dtypes.
  • Preserve the existing Base64 decoding behavior.

Tests

Added tests covering:

  • None
  • JSON-native float
  • JSON-native Unicode string
  • JSON-native byte string

Tested with:

python -m pytest -o addopts="" xarray/tests/backends/test_zarr.py -k "fill_value_coder"

Result: 13 passed

Fixes #11332

@github-actions github-actions Bot added topic-backends topic-zarr Related to zarr storage library io labels Oct 3, 2026

@headtr1ck headtr1ck left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, one small remark on the tests.
Maybe we could also add the (more E2E) test of the issue?

And feel free to add a whats-new entry!

Comment thread xarray/tests/backends/test_zarr.py Resolved

@headtr1ck headtr1ck left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks good to me.

I think this would still be a useful addition on top of the custom coders support mentioned in the issue.
But somebody with more zarr experience should have another look plz.

@omsatpute61-afk

Copy link
Copy Markdown
Contributor Author

Hi @headtr1ck, just following up on this PR. I've addressed the requested test changes and added the end-to-end coverage. Please let me know if there's anything else you'd like me to adjust. Thanks!

@headtr1ck headtr1ck added the plan to merge Final call for comments label Oct 7, 2026
@headtr1ck
headtr1ck enabled auto-merge (squash) October 9, 2026 11:30
@headtr1ck
headtr1ck merged commit 94302f8 into pydata:main Oct 9, 2026
46 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

io plan to merge Final call for comments topic-backends topic-zarr Related to zarr storage library

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Extend FillValueCoder.decode to accept JSON-native scalars for the zarr backend

2 participants