Skip to content
This repository has been archived by the owner on Nov 12, 2024. It is now read-only.

Switch to _ARRAY_DIMENSIONS for xarray #3

Merged
merged 1 commit into from
Oct 11, 2024
Merged

Conversation

mpiannucci
Copy link

  • Closes #xxxx
  • 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

@mpiannucci
Copy link
Author

This is the latest... more to follow when xarray changes are in main hopefully tomorrow

@@ -127,7 +132,7 @@ async 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["DIMENSION_NAMES"] = encode_zarr_attr_value(var.dims)
arr.attrs["_ARRAY_DIMENSIONS"] = encode_zarr_attr_value(var.dims)

Choose a reason for hiding this comment

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

Did I just make DIMENSION_NAMES up?

Copy link
Author

Choose a reason for hiding this comment

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

I'm not sure haha but this is what xarray needs

Choose a reason for hiding this comment

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

Zarr V3 actual has native support for dimension names, but it's not supported in Xarray yet. So put a flag that we should change this eventually.

Copy link
Author

Choose a reason for hiding this comment

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

we are just going to have both for now with this pr.

arr = group.require_array(
name=name,
shape=zarray.shape,
chunk_shape=zarray.chunks,
dtype=encode_dtype(zarray.dtype),
codecs=zarray._v3_codec_pipeline(),
#codecs=codecs,

Choose a reason for hiding this comment

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

Does the codec pipeline stuff not work at all?

Copy link
Author

@mpiannucci mpiannucci Oct 10, 2024

Choose a reason for hiding this comment

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

Currently crashing when zlib is included. I'm gunna wait till the next cut of zarr v3 to try again there

@@ -25,7 +25,7 @@
}


def dataset_to_icechunk(ds: Dataset, store: "IcechunkStore") -> None:
async def dataset_to_icechunk_async(ds: Dataset, store: "IcechunkStore") -> None:

Choose a reason for hiding this comment

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

Wouldn't changing this without changing the test break the test?

Copy link
Author

Choose a reason for hiding this comment

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

Didn't change this, extracted it and made both async and sync versions

Choose a reason for hiding this comment

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

Oh yes - sorry I couldn't see that easily when I looked from my phone haha

Copy link

@TomNicholas TomNicholas left a comment

Choose a reason for hiding this comment

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

Feel free to merge

@mpiannucci mpiannucci merged commit 31945cd into icechunk Oct 11, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants