Skip to content

Conversation

TomNicholas
Copy link
Member

@TomNicholas TomNicholas commented Jul 15, 2025

Follow-up to #618, aiming to close #676

  • Closes Data type failure on develop #676
  • Tests added
  • Tests passing
  • Full type hint coverage
  • Changes are documented in docs/releases.rst
  • New functions/methods are listed in api.rst
  • New functionality has documentation

@TomNicholas TomNicholas marked this pull request as draft July 15, 2025 19:10
@TomNicholas
Copy link
Member Author

Note that I've found at least two upstream issues contributing to problems here (as well of plenty of other changes needed):

@TomNicholas
Copy link
Member Author

This PR now depends on #680 as a (permanent) workaround for zarr-developers/zarr-python#3254, so #680 should be merged first.

@TomNicholas TomNicholas added the zarr-python Relevant to zarr-python upstream label Jul 16, 2025
raise NotImplementedError("Unsure how to handle broadcasting like this")

if not utils.metadata_identical(self.metadata, other.metadata):
if not self.metadata.to_dict() == other.metadata.to_dict():
Copy link
Member Author

@TomNicholas TomNicholas Jul 17, 2025

Choose a reason for hiding this comment

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

This comment explains why were are now able to simplify this: zarr-developers/zarr-python#2930 (comment)

@TomNicholas TomNicholas marked this pull request as ready for review July 17, 2025 10:52
Comment on lines +349 to +351
if roundtrip_func == roundtrip_as_in_memory_icechunk:
pytest.xfail(reason="xarray can't decode the ns datetime fill_value")

Copy link
Member Author

@TomNicholas TomNicholas Jul 17, 2025

Choose a reason for hiding this comment

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

As zarr-developers/zarr-python#2616 was closed, these xfails became xpasses!

Except for this one case - roundtripping via Icechunk, which fails with an error inside xarray's zarr decoders... I don't really understand why this matters, but it should be treated as a separable issue from this PR.

cc @sharkinsspatial

Copy link
Member Author

Choose a reason for hiding this comment

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

Raised #686 to track this

Copy link
Member

@maxrjones maxrjones left a comment

Choose a reason for hiding this comment

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

Nice! 🎉

Comment on lines 159 to 167
native_dtype = v3_metadata.data_type.to_native_dtype()
v2_compatible_data_type = parse_data_type(native_dtype, zarr_format=2)

v2_metadata = ArrayV2Metadata(
shape=v3_metadata.shape,
dtype=v3_metadata.data_type.to_numpy(),
dtype=v2_compatible_data_type,
chunks=v3_metadata.chunks,
fill_value=fill_value or v3_metadata.fill_value,
compressor=compressor_config,
Copy link
Member Author

@TomNicholas TomNicholas Jul 17, 2025

Choose a reason for hiding this comment

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

@d-v-b here is where I'm potentially unecessarily converting back and forth

Copy link
Member Author

@TomNicholas TomNicholas Jul 17, 2025

Choose a reason for hiding this comment

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

Removed in 925ffec

@TomNicholas TomNicholas merged commit 1a00c95 into zarr-developers:develop Jul 17, 2025
11 checks passed
@TomNicholas TomNicholas deleted the zarr-data-types-refactor-compat2 branch July 17, 2025 13:00
@martindurant
Copy link
Member

Kerchunk CI has been failing too, I assume doe to the same reasons. Do you have recommendations of how to fix on our end? Or should zarr do something?

@TomNicholas
Copy link
Member Author

Zarr 3.1.0 introduced significant changes in order to accommodate a more flexible data types system. I'm not surprised that Kerchunk breaks too - both Xarray and VirtualiZarr needed to be updated to adapt. But the specific errors in Kerchunk look different to the ones I had to deal with here. (That's presumably because unlike Kerchunk VirtualiZarr mostly deals with data types via importing the semi-private internal dataclass zarr.core.metadata.ArrayV3Metadata.)

@martindurant you should probably raise an issue on Kerchunk and tag @d-v-b to discuss.

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

Labels

dependencies Updates a dependency zarr-python Relevant to zarr-python upstream

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Data type failure on develop

3 participants