Skip to content

Commit e547401

Browse files
d-v-bclaude
andcommitted
docs(api): describe what zarr.create does with chunks=None, False and True
The docstring said True guesses the chunk shape and is the default; None is the default and True raises. The auto-chunking error now tells create_array callers to pass "auto" rather than the None they just passed. Assisted-by: ClaudeCode:claude-opus-5-5 Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 47587bc commit e547401

3 files changed

Lines changed: 11 additions & 9 deletions

File tree

‎src/zarr/api/asynchronous.py‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -960,10 +960,10 @@ async def create(
960960
shape : int or tuple of ints
961961
Array shape.
962962
chunks : ChunksLike, optional
963-
Chunk shape. If True, will be guessed from `shape` and `dtype`. If
964-
False, will be set to `shape`, i.e., single chunk for the whole array.
965-
If an int, the chunk size in each dimension will be given by the value
966-
of `chunks`. Default is True.
963+
Chunk shape. If None (the default), it is guessed from `shape` and `dtype`. If
964+
False, it is set to `shape`, i.e., a single chunk for the whole array. If an
965+
int, the chunk size in each dimension is given by the value of `chunks`.
966+
`True` is not a chunk shape and raises a `ValueError`.
967967
dtype : str or dtype, optional
968968
NumPy dtype.
969969
compressor : Codec, optional

‎src/zarr/api/synchronous.py‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -677,10 +677,10 @@ def create(
677677
shape : int or tuple of ints
678678
Array shape.
679679
chunks : ChunksLike, optional
680-
Chunk shape. If True, will be guessed from `shape` and `dtype`. If
681-
False, will be set to `shape`, i.e., single chunk for the whole array.
682-
If an int, the chunk size in each dimension will be given by the value
683-
of `chunks`. Default is True.
680+
Chunk shape. If None (the default), it is guessed from `shape` and `dtype`. If
681+
False, it is set to `shape`, i.e., a single chunk for the whole array. If an
682+
int, the chunk size in each dimension is given by the value of `chunks`.
683+
`True` is not a chunk shape and raises a `ValueError`.
684684
dtype : str or dtype, optional
685685
NumPy dtype.
686686
compressor : Codec, optional

‎src/zarr/core/chunk_grids.py‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -824,7 +824,9 @@ def normalize_chunks_nd(
824824

825825
if chunks is None or chunks is True:
826826
raise ValueError(
827-
f'{chunks!r} is not a valid chunk input. Use chunks=None or chunks="auto" from the top-level API for auto-chunking, or pass an int / tuple of ints.'
827+
f"{chunks!r} is not a valid chunk input. For automatic chunking pass "
828+
f'chunks="auto" to `create_array` or chunks=None to `zarr.create`; otherwise '
829+
f"pass an int or a sequence of ints."
828830
)
829831

830832
# handle no chunking: one chunk covering every axis.

0 commit comments

Comments
 (0)