MCPcopy Index your code
hub / github.com/pydata/xarray / explicit_chunks

Function explicit_chunks

xarray/tests/test_backends_api.py:163–176  ·  view source on GitHub ↗

Return explicit chunks, expanding any integer member to a tuple of integers.

(chunks, shape)

Source from the content-addressed store, hash-verified

161
162
163def explicit_chunks(chunks, shape):
164 """Return explicit chunks, expanding any integer member to a tuple of integers."""
165 # Emulate `dask.array.core.normalize_chunks` but for simpler inputs.
166 return tuple(
167 (
168 (
169 (size // chunk) * (chunk,)
170 + ((size % chunk,) if size % chunk or size == 0 else ())
171 )
172 if isinstance(chunk, Number)
173 else chunk
174 )
175 for chunk, size in zip(chunks, shape, strict=True)
176 )
177
178
179@requires_dask

Callers 3

test_honor_chunksMethod · 0.85
test_split_chunksMethod · 0.85
test_join_chunksMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…