Skip to content

Commit 3e4c2fb

Browse files
authored
Remove zarray and zarray_maybe_lazy properties from Cubed Array. (#743)
These are not meant for general use.
1 parent 5e0610b commit 3e4c2fb

File tree

2 files changed

+5
-14
lines changed

2 files changed

+5
-14
lines changed

cubed/core/array.py

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -47,16 +47,6 @@ def __init__(self, name, zarray, spec, plan):
4747
self.spec = spec or spec_from_config(config)
4848
self.plan = plan
4949

50-
@property
51-
def zarray_maybe_lazy(self):
52-
"""The underlying Zarr array or LazyZarrArray. Use this during planning, before the computation has started."""
53-
return self._zarray
54-
55-
@property
56-
def zarray(self):
57-
"""The underlying Zarr array. May only be used during the computation once the array has been created."""
58-
return open_if_lazy_zarr_array(self._zarray)
59-
6050
@property
6151
def blocks(self):
6252
"""An array-like interface to the blocks of an array."""
@@ -123,7 +113,8 @@ def _read_stored(self):
123113
# Only works if the array has been computed
124114
if self.size > 0:
125115
# read back from zarr
126-
return numpy_array_to_backend_array(self.zarray[...])
116+
zarray = open_if_lazy_zarr_array(self._zarray)
117+
return numpy_array_to_backend_array(zarray[...])
127118
else:
128119
# this case fails for zarr, so just return an empty array of the correct shape
129120
return nxp.empty(self.shape, dtype=self.dtype)

cubed/core/ops.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ def blockwise(
286286

287287
# replace arrays with zarr arrays
288288
zargs = list(args)
289-
zargs[::2] = [a.zarray_maybe_lazy for a in arrays]
289+
zargs[::2] = [a._zarray for a in arrays]
290290
in_names = [a.name for a in arrays]
291291

292292
extra_source_arrays = kwargs.pop("extra_source_arrays", [])
@@ -438,7 +438,7 @@ def _general_blockwise(
438438
assert len(arrays) > 0
439439

440440
# replace arrays with zarr arrays
441-
zargs = [a.zarray_maybe_lazy for a in arrays]
441+
zargs = [a._zarray for a in arrays]
442442
in_names = [a.name for a in arrays]
443443

444444
extra_source_arrays = kwargs.pop("extra_source_arrays", [])
@@ -1079,7 +1079,7 @@ def rechunk(x, chunks, *, target_store=None, min_mem=None, use_new_impl=True):
10791079
name_int = f"{name}-int"
10801080
temp_store = new_temp_path(name=name_int, spec=spec)
10811081
ops = primitive_rechunk(
1082-
x.zarray_maybe_lazy,
1082+
x._zarray,
10831083
source_array_name=name,
10841084
int_array_name=name_int,
10851085
target_chunks=target_chunks,

0 commit comments

Comments
 (0)