Skip to content

Commit 9795f77

Browse files
committed
group: the meta_array argument is now used for new arrays
1 parent 0bf1cf0 commit 9795f77

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

zarr/hierarchy.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ def typestr(o):
313313

314314
def __getstate__(self):
315315
return (self._store, self._path, self._read_only, self._chunk_store,
316-
self.attrs.cache, self._synchronizer)
316+
self.attrs.cache, self._synchronizer, self._meta_array)
317317

318318
def __setstate__(self, state):
319319
self.__init__(*state)
@@ -371,11 +371,12 @@ def __getitem__(self, item):
371371
if contains_array(self._store, path):
372372
return Array(self._store, read_only=self._read_only, path=path,
373373
chunk_store=self._chunk_store,
374-
synchronizer=self._synchronizer, cache_attrs=self.attrs.cache)
374+
synchronizer=self._synchronizer, cache_attrs=self.attrs.cache,
375+
meta_array=self._meta_array)
375376
elif contains_group(self._store, path):
376377
return Group(self._store, read_only=self._read_only, path=path,
377378
chunk_store=self._chunk_store, cache_attrs=self.attrs.cache,
378-
synchronizer=self._synchronizer)
379+
synchronizer=self._synchronizer, meta_array=self._meta_array)
379380
else:
380381
raise KeyError(item)
381382

@@ -898,7 +899,8 @@ def _require_dataset_nosync(self, name, shape, dtype=None, exact=False,
898899
cache_attrs = kwargs.get('cache_attrs', self.attrs.cache)
899900
a = Array(self._store, path=path, read_only=self._read_only,
900901
chunk_store=self._chunk_store, synchronizer=synchronizer,
901-
cache_metadata=cache_metadata, cache_attrs=cache_attrs)
902+
cache_metadata=cache_metadata, cache_attrs=cache_attrs,
903+
meta_array=self._meta_array)
902904
shape = normalize_shape(shape)
903905
if shape != a.shape:
904906
raise TypeError('shape do not match existing array; expected {}, got {}'

zarr/tests/test_cupy.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,4 +135,5 @@ def test_group(tmp_path, compressor, store_type):
135135
assert a.shape == (10, 11)
136136
assert a.dtype == int
137137
assert isinstance(a, Array)
138+
assert isinstance(a[:], cupy.ndarray)
138139
assert (a[:] == 1).all()

0 commit comments

Comments
 (0)