Commit 10f8abe
authored
fix: resolve chunks=False to chunk size 1 on zero-length axes (zarr-developers#4328)
* fix: resolve chunks=False to chunk size 1 on zero-length axes
`chunks=False` means "one chunk covering the whole array", but on a
zero-length axis it built a chunk of size 0. For Zarr format 3 this was
rejected by RegularChunkGridMetadata with "integer chunk edge length
must be >= 1, got 0"; with shards="auto" it raised ZeroDivisionError on
both formats; and for Zarr format 2 it silently wrote `chunks: [0]`,
which corrupted reads after the axis was later resized.
Route `False` through the `-1` sentinel so the zero-length clamp added
in zarr-developers#4307 (max(span, 1), matching _guess_regular_chunks) lives in one
place. Both spellings now yield chunk size 1 on empty axes.
Rebased over zarr-developers#4218, which rewrote normalize_chunks_nd to build
FixedDimension/VaryingDimension grids: the False branch now falls
through to the -1 path instead of returning a ChunkGrid directly, and
the test table expectations use the new bare-int / tuple form.
Assisted-by: ClaudeCode:claude-fable-5-1
* chore: rename changelog fragment to the PR number
Assisted-by: ClaudeCode:claude-fable-5-11 parent a1b4416 commit 10f8abe
3 files changed
Lines changed: 67 additions & 20 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
808 | 808 | | |
809 | 809 | | |
810 | 810 | | |
811 | | - | |
| 811 | + | |
| 812 | + | |
812 | 813 | | |
813 | | - | |
814 | | - | |
815 | | - | |
| 814 | + | |
816 | 815 | | |
817 | 816 | | |
818 | 817 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
| 2 | + | |
2 | 3 | | |
3 | 4 | | |
4 | 5 | | |
| |||
87 | 88 | | |
88 | 89 | | |
89 | 90 | | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
90 | 95 | | |
91 | 96 | | |
92 | 97 | | |
| |||
362 | 367 | | |
363 | 368 | | |
364 | 369 | | |
| 370 | + | |
| 371 | + | |
365 | 372 | | |
366 | | - | |
367 | | - | |
368 | | - | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
369 | 381 | | |
370 | | - | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
371 | 387 | | |
372 | 388 | | |
373 | | - | |
| 389 | + | |
374 | 390 | | |
375 | | - | |
376 | | - | |
377 | | - | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
378 | 397 | | |
379 | | - | |
380 | | - | |
381 | | - | |
382 | | - | |
383 | | - | |
384 | | - | |
385 | | - | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
0 commit comments