From 1a0b4a5081c0bb5211effd58b6e408f0a2b05f8b Mon Sep 17 00:00:00 2001 From: Max Jones <14077947+maxrjones@users.noreply.github.com> Date: Wed, 8 Apr 2026 16:33:09 -0400 Subject: [PATCH 1/2] Add compatibility with Zarr 3.2.0 --- cubed/core/ops.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/cubed/core/ops.py b/cubed/core/ops.py index 24382035..8d92bfa5 100644 --- a/cubed/core/ops.py +++ b/cubed/core/ops.py @@ -625,10 +625,20 @@ def elemwise(func, *args: "Array", dtype=None) -> "Array": def _create_zarr_indexer(selection, shape, chunks): if zarr.__version__[0] == "3": - from zarr.core.chunk_grids import RegularChunkGrid from zarr.core.indexing import OrthogonalIndexer - return OrthogonalIndexer(selection, shape, RegularChunkGrid(chunk_shape=chunks)) + try: + from zarr.core.chunk_grids import ChunkGrid + + return OrthogonalIndexer( + selection, shape, ChunkGrid.from_sizes(shape, chunks) + ) + except ImportError: + from zarr.core.chunk_grids import RegularChunkGrid + + return OrthogonalIndexer( + selection, shape, RegularChunkGrid(chunk_shape=chunks) + ) else: from zarr.indexing import OrthogonalIndexer From 8a3cad747fa700276d39a6c7d75279bdf3553858 Mon Sep 17 00:00:00 2001 From: Max Jones <14077947+maxrjones@users.noreply.github.com> Date: Wed, 8 Apr 2026 16:44:08 -0400 Subject: [PATCH 2/2] Catch AttributeError --- cubed/core/ops.py | 2 +- cubed/tests/test_core.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cubed/core/ops.py b/cubed/core/ops.py index 8d92bfa5..f99e6396 100644 --- a/cubed/core/ops.py +++ b/cubed/core/ops.py @@ -633,7 +633,7 @@ def _create_zarr_indexer(selection, shape, chunks): return OrthogonalIndexer( selection, shape, ChunkGrid.from_sizes(shape, chunks) ) - except ImportError: + except (ImportError, AttributeError): from zarr.core.chunk_grids import RegularChunkGrid return OrthogonalIndexer( diff --git a/cubed/tests/test_core.py b/cubed/tests/test_core.py index 4504b9c8..8fe8d63c 100644 --- a/cubed/tests/test_core.py +++ b/cubed/tests/test_core.py @@ -581,8 +581,8 @@ def test_default_spec_allowed_mem_exceeded_visualize(tmp_path): with warnings.catch_warnings(record=True) as w: warnings.simplefilter("always") b.visualize(filename=str(tmp_path / "cubed")) - assert len(w) == 1 - assert "exceed allowed memory" in str(w[0].message) + mem_warnings = [x for x in w if "exceed allowed memory" in str(x.message)] + assert len(mem_warnings) == 1 def test_default_spec_config_override():