MCPcopy Create free account
hub / github.com/dask/dask / round_to

Function round_to

dask/array/core.py:3444–3458  ·  view source on GitHub ↗

Return a chunk dimension that is close to an even multiple or factor We want values for c that are nicely aligned with s. If c is smaller than s we use the original chunk size and accept an uneven chunk at the end. If c is larger than s then we want the largest multiple of s that

(c, s)

Source from the content-addressed store, hash-verified

3442
3443
3444def round_to(c, s):
3445 """Return a chunk dimension that is close to an even multiple or factor
3446
3447 We want values for c that are nicely aligned with s.
3448
3449 If c is smaller than s we use the original chunk size and accept an
3450 uneven chunk at the end.
3451
3452 If c is larger than s then we want the largest multiple of s that is still
3453 smaller than c.
3454 """
3455 if c <= s:
3456 return max(1, int(c))
3457 else:
3458 return c // s * s
3459
3460
3461def _get_chunk_shape(a):

Callers 1

auto_chunksFunction · 0.85

Calls 1

maxFunction · 0.90

Tested by

no test coverage detected