Skip to content

Commit 12f6012

Browse files
authored
Fix Group.array() with data argument (#2668)
1 parent bc5877b commit 12f6012

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/zarr/core/group.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2729,6 +2729,8 @@ def array(
27292729
Whether to overwrite an array with the same name in the store, if one exists.
27302730
config : ArrayConfig or ArrayConfigLike, optional
27312731
Runtime configuration for the array.
2732+
data : array_like
2733+
The data to fill the array with.
27322734
27332735
Returns
27342736
-------
@@ -2737,7 +2739,7 @@ def array(
27372739
compressors = _parse_deprecated_compressor(compressor, compressors)
27382740
return Array(
27392741
self._sync(
2740-
self._async_group.create_array(
2742+
self._async_group.create_dataset(
27412743
name=name,
27422744
shape=shape,
27432745
dtype=dtype,
@@ -2754,6 +2756,7 @@ def array(
27542756
overwrite=overwrite,
27552757
storage_options=storage_options,
27562758
config=config,
2759+
data=data,
27572760
)
27582761
)
27592762
)

tests/test_group.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -619,8 +619,7 @@ def test_group_create_array(
619619
array[:] = data
620620
elif method == "array":
621621
with pytest.warns(DeprecationWarning):
622-
array = group.array(name="array", shape=shape, dtype=dtype)
623-
array[:] = data
622+
array = group.array(name="array", data=data, shape=shape, dtype=dtype)
624623
else:
625624
raise AssertionError
626625

0 commit comments

Comments
 (0)