Repository navigation
fix(dtype): write the generic time unit in brackets in Zarr format 2 metadata - #4581
Merged
Merged
Conversation
…metadata The v2 spec requires the unit of a datetime64 or timedelta64 dtype in brackets, but a generic-unit time dtype serialized as NumPy's unitless typestr (<M8), which the spec forbids. The generic unit is now written explicitly — <M8[generic], or <M8[2generic] with a scale, as scaled generic units already were — which NumPy parses back to the same dtype. The unitless spellings stay readable as the generic unit. Fixes zarr-developers#4580 Assisted-by: ClaudeCode:claude-fable-5
Assisted-by: ClaudeCode:claude-fable-5
…ime types The generic-unit bracketing moves to TimeDTypeBase._v2_name, which both to_json implementations call, instead of being duplicated in each. Assisted-by: ClaudeCode:claude-fable-5
… tests The one-off unitless-time test becomes json_alias_v2_params on the shared dtype test base: (alias, canonical) pairs asserting that reading either spelling gives the same dtype and writing gives the canonical one. The time types list the unitless generic spellings and NumPy's microsecond alias; other types can list their aliases the same way. Assisted-by: ClaudeCode:claude-fable-5
Contributor
Author
|
this is a simple bugfix that brings us into spec compliance (with the v2 spec) so I will self-merge this |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4581 +/- ##
=======================================
Coverage 94.75% 94.75%
=======================================
Files 94 94
Lines 13704 13704
=======================================
Hits 12985 12985
Misses 719 719
🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
We write invalid v2
dtypemetadata for datetime / timedelta data. See #4580. This PR fixes that by ensuring that we always serializedtypemetadata with the unit enclosed in brackets, even for the"generic"unit.Author attestation
TODO
docs/user-guide/*.mdchanges/