Skip to content

Commit 7b522f9

Browse files
committed
Document unique_edge_lengths purpose
1 parent 8b15c98 commit 7b522f9

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

src/zarr/core/chunk_grids.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,12 @@ def data_size(self, chunk_ix: int) -> int:
8787

8888
@property
8989
def unique_edge_lengths(self) -> Iterable[int]:
90-
"""Distinct chunk edge lengths for this dimension."""
90+
"""Distinct chunk edge lengths for this dimension.
91+
92+
Used by shard validation to check that every unique edge length
93+
is divisible by the inner chunk size. O(1) for fixed dimensions
94+
since there is only one edge length.
95+
"""
9196
return (self.size,)
9297

9398
def indices_to_chunks(self, indices: npt.NDArray[np.intp]) -> npt.NDArray[np.intp]:
@@ -181,7 +186,12 @@ def data_size(self, chunk_ix: int) -> int:
181186

182187
@property
183188
def unique_edge_lengths(self) -> Iterable[int]:
184-
"""Distinct chunk edge lengths for this dimension (lazily deduplicated)."""
189+
"""Distinct chunk edge lengths for this dimension (lazily deduplicated).
190+
191+
Used by shard validation to check that every unique edge length
192+
is divisible by the inner chunk size. Lazy deduplication avoids
193+
materializing all edges for dimensions with many repeated sizes.
194+
"""
185195
seen: set[int] = set()
186196
for e in self.edges:
187197
if e not in seen:

0 commit comments

Comments
 (0)