MCPcopy
hub / github.com/dask/dask / overlap

Function overlap

dask/array/overlap.py:376–461  ·  view source on GitHub ↗

Share boundaries between neighboring blocks Parameters ---------- x: da.Array A dask array depth: dict The size of the shared boundary per axis boundary: dict The boundary condition on each axis. Options are 'reflect', 'periodic', 'nearest', 'non

(x, depth, boundary, *, allow_rechunk=True)

Source from the content-addressed store, hash-verified

374
375
376def overlap(x, depth, boundary, *, allow_rechunk=True):
377 """Share boundaries between neighboring blocks
378
379 Parameters
380 ----------
381
382 x: da.Array
383 A dask array
384 depth: dict
385 The size of the shared boundary per axis
386 boundary: dict
387 The boundary condition on each axis. Options are 'reflect', 'periodic',
388 'nearest', 'none', or an array value. Such a value will fill the
389 boundary with that value.
390 allow_rechunk: bool, keyword only
391 Allows rechunking, otherwise chunk sizes need to match and core
392 dimensions are to consist only of one chunk.
393
394 The depth input informs how many cells to overlap between neighboring
395 blocks ``{0: 2, 2: 5}`` means share two cells in 0 axis, 5 cells in 2 axis.
396 Axes missing from this input will not be overlapped.
397
398 Any axis containing chunks smaller than depth will be rechunked if
399 possible, provided the keyword ``allow_rechunk`` is True (recommended).
400
401 Examples
402 --------
403 >>> import numpy as np
404 >>> import dask.array as da
405
406 >>> x = np.arange(64).reshape((8, 8))
407 >>> d = da.from_array(x, chunks=(4, 4))
408 >>> d.chunks
409 ((4, 4), (4, 4))
410
411 >>> g = da.overlap.overlap(d, depth={0: 2, 1: 1},
412 ... boundary={0: 100, 1: 'reflect'})
413 >>> g.chunks
414 ((8, 8), (6, 6))
415
416 >>> np.array(g)
417 array([[100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100],
418 [100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100],
419 [ 0, 0, 1, 2, 3, 4, 3, 4, 5, 6, 7, 7],
420 [ 8, 8, 9, 10, 11, 12, 11, 12, 13, 14, 15, 15],
421 [ 16, 16, 17, 18, 19, 20, 19, 20, 21, 22, 23, 23],
422 [ 24, 24, 25, 26, 27, 28, 27, 28, 29, 30, 31, 31],
423 [ 32, 32, 33, 34, 35, 36, 35, 36, 37, 38, 39, 39],
424 [ 40, 40, 41, 42, 43, 44, 43, 44, 45, 46, 47, 47],
425 [ 16, 16, 17, 18, 19, 20, 19, 20, 21, 22, 23, 23],
426 [ 24, 24, 25, 26, 27, 28, 27, 28, 29, 30, 31, 31],
427 [ 32, 32, 33, 34, 35, 36, 35, 36, 37, 38, 39, 39],
428 [ 40, 40, 41, 42, 43, 44, 43, 44, 45, 46, 47, 47],
429 [ 48, 48, 49, 50, 51, 52, 51, 52, 53, 54, 55, 55],
430 [ 56, 56, 57, 58, 59, 60, 59, 60, 61, 62, 63, 63],
431 [100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100],
432 [100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100]])
433 """

Callers 1

map_overlapFunction · 0.70

Calls 12

maxFunction · 0.85
anyFunction · 0.85
minFunction · 0.85
coerce_depthFunction · 0.70
coerce_boundaryFunction · 0.70
boundariesFunction · 0.70
overlap_internalFunction · 0.70
valuesMethod · 0.45
rechunkMethod · 0.45
getMethod · 0.45
itemsMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…