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

Function map_overlap

dask/array/_array_expr/_overlap.py:516–802  ·  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

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