Skip to content

Commit b708d71

Browse files
committed
[bug] fix _ArrayChunks_ and _ArrayZipSize_
1 parent a1b14fc commit b708d71

1 file changed

Lines changed: 13 additions & 10 deletions

File tree

JData_specification.md

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -684,26 +684,29 @@ Here, the array annotation keywords are defined below:
684684
compressed data) becomes a 1-D JSON array whose elements are the individual chunk
685685
payloads, ordered in row-major (C) sequence across the pre-processed array dimensions.
686686
The last chunk along any dimension may be smaller than the declared chunk shape if the
687-
array extent is not evenly divisible. `"_ArrayZipType_"` and `"_ArrayZipSize_"`,
688-
when present, apply uniformly to every chunk; `"_ArrayZipSize_"` gives the shape of
689-
a **full** chunk (the last, possibly partial, chunk may differ). For example, a
687+
array extent is not evenly divisible. `"_ArrayZipType_"`, when present, applies
688+
uniformly to every chunk. `"_ArrayZipSize_"` **must** be present alongside
689+
`"_ArrayChunks_"` and stores the shape of the **full pre-processed array** (not the
690+
chunk shape); the decoder uses it together with `"_ArrayChunks_"` to determine the
691+
number of chunks per dimension (`ceil(_ArrayZipSize_ / _ArrayChunks_)`) and the
692+
actual shape of each tile, including partial boundary tiles. For example, a
690693
100x100 array stored in 32x32 tiles with zlib compression:
691694
```
692695
{
693-
"_ArrayType_": "single",
694-
"_ArraySize_": [100, 100],
695-
"_ArrayChunks_": [32, 32],
696+
"_ArrayType_": "single",
697+
"_ArraySize_": [100, 100],
698+
"_ArrayChunks_": [32, 32],
696699
"_ArrayZipType_": "zlib",
697-
"_ArrayZipSize_": [32, 32],
700+
"_ArrayZipSize_": [100, 100],
698701
"_ArrayZipData_": [
699702
"<base64-chunk-0-0>", "<base64-chunk-0-1>", "<base64-chunk-0-2>",
700703
"<base64-chunk-0-3>", "<base64-chunk-1-0>", ...
701704
]
702705
}
703706
```
704-
`"_ArrayChunks_"` must not be used together with `"_ArrayZipSize_"` unless
705-
`"_ArrayZipType_"` is also present, since chunk boundaries are only meaningful
706-
in the context of per-chunk compression.
707+
The total number of chunks is `prod(ceil(_ArrayZipSize_ ./ _ArrayChunks_))` = 16
708+
(4×4 tiles); the boundary tiles in the last row and column each have extent 4
709+
(`100 - 3×32`) along the respective dimension.
707710

708711
To facilitate the pre-allocation of the buffer for storage of the array in the parser, when
709712
an ordered object or map is used to store an array, it is recommended that the `"_ArrayType_"`,

0 commit comments

Comments
 (0)