MCPcopy
hub / github.com/dask/dask / map_overlap

Function map_overlap

dask/array/_array_expr/_overlap.py:515–799  ·  view source on GitHub ↗

Map a function over blocks of arrays with some overlap We share neighboring zones between blocks of the array, map a function, and then trim away the neighboring strips. If depth is larger than any chunk along a particular axis, then the array is rechunked. Note that this funct

(
    func,
    *args,
    depth=None,
    boundary=None,
    trim=True,
    align_arrays=True,
    allow_rechunk=True,
    **kwargs,
)

Source from the content-addressed store, hash-verified

513
514
515def map_overlap(
516 func,
517 *args,
518 depth=None,
519 boundary=None,
520 trim=True,
521 align_arrays=True,
522 allow_rechunk=True,
523 **kwargs,
524):
525 """Map a function over blocks of arrays with some overlap
526
527 We share neighboring zones between blocks of the array, map a
528 function, and then trim away the neighboring strips. If depth is
529 larger than any chunk along a particular axis, then the array is
530 rechunked.
531
532 Note that this function will attempt to automatically determine the output
533 array type before computing it, please refer to the ``meta`` keyword argument
534 in ``map_blocks`` if you expect that the function will not succeed when
535 operating on 0-d arrays.
536
537 Parameters
538 ----------
539 func: function
540 The function to apply to each extended block.
541 If multiple arrays are provided, then the function should expect to
542 receive chunks of each array in the same order.
543 args : dask arrays
544 depth: int, tuple, dict or list, keyword only
545 The number of elements that each block should share with its neighbors
546 If a tuple or dict then this can be different per axis.
547 If a list then each element of that list must be an int, tuple or dict
548 defining depth for the corresponding array in `args`.
549 Asymmetric depths may be specified using a dict value of (-/+) tuples.
550 Note that asymmetric depths are currently only supported when
551 ``boundary`` is 'none'.
552 The default value is 0.
553 boundary: str, tuple, dict or list, keyword only
554 How to handle the boundaries.
555 Values include 'reflect', 'periodic', 'nearest', 'none',
556 or any constant value like 0 or np.nan.
557 If a list then each element must be a str, tuple or dict defining the
558 boundary for the corresponding array in `args`.
559 The default value is 'reflect'.
560 trim: bool, keyword only
561 Whether or not to trim ``depth`` elements from each block after
562 calling the map function.
563 Set this to False if your mapping function already does this for you
564 align_arrays: bool, keyword only
565 Whether or not to align chunks along equally sized dimensions when
566 multiple arrays are provided. This allows for larger chunks in some
567 arrays to be broken into smaller ones that match chunk sizes in other
568 arrays such that they are compatible for block function mapping. If
569 this is false, then an error will be thrown if arrays do not already
570 have the same number of blocks in each dimension.
571 allow_rechunk: bool, keyword only
572 Allows rechunking, otherwise chunk sizes need to match and core

Callers 2

map_overlapMethod · 0.90
sliding_window_viewFunction · 0.70

Calls 15

unify_chunks_exprFunction · 0.90
new_collectionFunction · 0.90
map_blocksFunction · 0.90
allFunction · 0.85
maxFunction · 0.85
popMethod · 0.80
coerceFunction · 0.70
assert_int_chunksizeFunction · 0.70
coerce_depthFunction · 0.70
overlapFunction · 0.70
trim_internalFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…