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

Function boundaries

dask/array/_array_expr/_overlap.py:301–331  ·  view source on GitHub ↗

Add boundary conditions to an array before overlapping See Also -------- periodic constant

(x, depth=None, kind=None)

Source from the content-addressed store, hash-verified

299
300
301def boundaries(x, depth=None, kind=None):
302 """Add boundary conditions to an array before overlapping
303
304 See Also
305 --------
306 periodic
307 constant
308 """
309 if not isinstance(kind, dict):
310 kind = dict.fromkeys(range(x.ndim), kind)
311 if not isinstance(depth, dict):
312 depth = dict.fromkeys(range(x.ndim), depth)
313
314 for i in range(x.ndim):
315 d = depth.get(i, 0)
316 if d == 0:
317 continue
318
319 this_kind = kind.get(i, "none")
320 if this_kind == "none":
321 continue
322 elif this_kind == "periodic":
323 x = periodic(x, i, d)
324 elif this_kind == "reflect":
325 x = reflect(x, i, d)
326 elif this_kind == "nearest":
327 x = nearest(x, i, d)
328 elif i in kind:
329 x = constant(x, i, d, kind[i])
330
331 return x
332
333
334def ensure_minimum_chunksize(size, chunks):

Callers 4

test_boundariesFunction · 0.90
test_constant_boundariesFunction · 0.90
test_none_boundariesFunction · 0.90
overlapFunction · 0.70

Calls 5

periodicFunction · 0.70
reflectFunction · 0.70
nearestFunction · 0.70
constantFunction · 0.70
getMethod · 0.45

Tested by 3

test_boundariesFunction · 0.72
test_constant_boundariesFunction · 0.72
test_none_boundariesFunction · 0.72