Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dont write _ARRAY_DIMENSIONS to icechunk #286

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ci/upstream.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ channels:
- conda-forge
- nodefaults
dependencies:
- xarray>=2024.10.0
- h5netcdf
- h5py
- hdf5
Expand All @@ -25,6 +26,5 @@ dependencies:
- pip
- pip:
- icechunk # Installs zarr v3 as dependency
- git+https://github.com/pydata/xarray@zarr-v3 # zarr-v3 compatibility branch
- git+https://github.com/zarr-developers/numcodecs@zarr3-codecs # zarr-v3 compatibility branch
# - git+https://github.com/fsspec/kerchunk@main # kerchunk is currently incompatible with zarr-python v3 (https://github.com/fsspec/kerchunk/pull/516)
2 changes: 2 additions & 0 deletions docs/releases.rst
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ Bug fixes
- Fixed regression in `fill_value` handling for datetime dtypes making virtual
Zarr stores unreadable (:pull:`206`)
By `Timothy Hodson <https://github.com/thodson-usgs>`_
- Fixed bug with writing of `dimension_names` into zarr metadata.
(:pull:`286`) By `Tom Nicholas <https://github.com/TomNicholas>`_.

Documentation
~~~~~~~~~~~~~
Expand Down
2 changes: 1 addition & 1 deletion virtualizarr/tests/test_writers/test_icechunk.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def test_write_new_virtual_variable(
# assert dict(arr.attrs) == {"units": "km"}

# check dimensions
assert arr.attrs["_ARRAY_DIMENSIONS"] == ["x", "y"]
assert arr.metadata.dimension_names == ("x", "y")


def test_set_single_virtual_ref_without_encoding(
Expand Down
1 change: 0 additions & 1 deletion virtualizarr/writers/icechunk.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,6 @@ def write_virtual_variable_to_icechunk(
# TODO it would be nice if we could assign directly to the .attrs property
for k, v in var.attrs.items():
arr.attrs[k] = encode_zarr_attr_value(v)
arr.attrs["_ARRAY_DIMENSIONS"] = encode_zarr_attr_value(var.dims)
Copy link
Member Author

Choose a reason for hiding this comment

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

It's not necessary to write these because we already have dimension_names specified above in

arr = group.require_array(
        name=name,
        shape=zarray.shape,
        chunk_shape=zarray.chunks,
        dtype=encode_dtype(zarray.dtype),
        codecs=zarray._v3_codec_pipeline(),
        dimension_names=var.dims,
        fill_value=zarray.fill_value,
        # TODO fill_value?
    )


_encoding_keys = {"_FillValue", "missing_value", "scale_factor", "add_offset"}
for k, v in var.encoding.items():
Expand Down
Loading