From fe83fb4288c787a8047eb0005b9699f354e1a10d Mon Sep 17 00:00:00 2001 From: lucyhao Date: Wed, 13 Aug 2025 14:47:32 -0400 Subject: [PATCH 1/2] new doc message for creating arrays with data --- src/zarr/core/group.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/zarr/core/group.py b/src/zarr/core/group.py index 4bdc7b549f..9ef8481b9a 100644 --- a/src/zarr/core/group.py +++ b/src/zarr/core/group.py @@ -2476,12 +2476,11 @@ def create_array( The name of the array relative to the group. If ``path`` is ``None``, the array will be located at the root of the store. shape : ChunkCoords, optional - Shape of the array. Can be ``None`` if ``data`` is provided. + Shape of the array. Must be ``None`` if ``data`` is provided. dtype : npt.DTypeLike | None - Data type of the array. Can be ``None`` if ``data`` is provided. + Data type of the array. Must be ``None`` if ``data`` is provided. data : Array-like data to use for initializing the array. If this parameter is provided, the - ``shape`` and ``dtype`` parameters must be identical to ``data.shape`` and ``data.dtype``, - or ``None``. + ``shape`` and ``dtype`` parameters must be ``None``. chunks : ChunkCoords, optional Chunk shape of the array. If not specified, default are guessed based on the shape and dtype. From a25722ffab67a39a749fdccfa39c8ac2e7f05d9e Mon Sep 17 00:00:00 2001 From: lucyhao Date: Wed, 13 Aug 2025 15:09:36 -0400 Subject: [PATCH 2/2] also change create_array data docs in api --- src/zarr/api/synchronous.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/zarr/api/synchronous.py b/src/zarr/api/synchronous.py index 50a1c0fa20..db113f76d0 100644 --- a/src/zarr/api/synchronous.py +++ b/src/zarr/api/synchronous.py @@ -783,13 +783,12 @@ def create_array( The name of the array within the store. If ``name`` is ``None``, the array will be located at the root of the store. shape : ChunkCoords, optional - Shape of the array. Can be ``None`` if ``data`` is provided. + Shape of the array. Must be ``None`` if ``data`` is provided. dtype : ZDTypeLike, optional - Data type of the array. Can be ``None`` if ``data`` is provided. + Data type of the array. Must be ``None`` if ``data`` is provided. data : np.ndarray, optional Array-like data to use for initializing the array. If this parameter is provided, the - ``shape`` and ``dtype`` parameters must be identical to ``data.shape`` and ``data.dtype``, - or ``None``. + ``shape`` and ``dtype`` parameters must be ``None``. chunks : ChunkCoords, optional Chunk shape of the array. If not specified, default are guessed based on the shape and dtype.