diff --git a/docs/releases.md b/docs/releases.md index 8fd182b7b..7bb3340e0 100644 --- a/docs/releases.md +++ b/docs/releases.md @@ -20,6 +20,8 @@ By [Tom Nicholas](https://github.com/TomNicholas). - Fix handling of big-endian data in Icechunk by making sure that non-default zarr serializers are included in the zarr array metadata [#766](https://github.com/zarr-developers/VirtualiZarr/issues/766). By [Max Jones](https://github.com/maxrjones) +- Fix handling of big-endian data in Kerchunk references [#769](https://github.com/zarr-developers/VirtualiZarr/issues/769). + By [Max Jones](https://github.com/maxrjones) ### Documentation diff --git a/virtualizarr/tests/test_writers/test_kerchunk.py b/virtualizarr/tests/test_writers/test_kerchunk.py index 4faf99273..6b778baa2 100644 --- a/virtualizarr/tests/test_writers/test_kerchunk.py +++ b/virtualizarr/tests/test_writers/test_kerchunk.py @@ -5,7 +5,6 @@ from xarray import Dataset from zarr.core.metadata.v2 import ArrayV2Metadata -from conftest import ARRAYBYTES_CODEC from virtualizarr.manifests import ChunkManifest, ManifestArray from virtualizarr.tests import requires_fastparquet, requires_kerchunk from virtualizarr.utils import JSON, convert_v3_to_v2_metadata, kerchunk_refs_as_json @@ -194,12 +193,18 @@ def test_accessor_to_kerchunk_parquet(self, tmp_path, array_v3_metadata): } -def testconvert_v3_to_v2_metadata(array_v3_metadata): +@pytest.mark.parametrize("endian,expected_dtype_char", [("little", "<"), ("big", ">")]) +def test_convert_v3_to_v2_metadata( + array_v3_metadata, endian: str, expected_dtype_char: str +): shape = (5, 20) chunks = (5, 10) codecs = [ - ARRAYBYTES_CODEC, - {"name": "numcodecs.delta", "configuration": {"dtype": "") + dtype = data_type_registry.match_dtype(dtype=na_dtype) + else: + dtype = v3_metadata.data_type v2_metadata = ArrayV2Metadata( shape=v3_metadata.shape, - dtype=v3_metadata.data_type, + dtype=dtype, chunks=v3_metadata.chunks, fill_value=fill_value or v3_metadata.fill_value, filters=v2_codecs