Skip to content
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
14 changes: 12 additions & 2 deletions cubed/core/ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -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, AttributeError):
from zarr.core.chunk_grids import RegularChunkGrid

return OrthogonalIndexer(
selection, shape, RegularChunkGrid(chunk_shape=chunks)
)
else:
from zarr.indexing import OrthogonalIndexer

Expand Down
4 changes: 2 additions & 2 deletions cubed/tests/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand Down
Loading