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

Function boundaries

dask/array/overlap.py:287–317  ·  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

285
286
287def boundaries(x, depth=None, kind=None):
288 """Add boundary conditions to an array before overlapping
289
290 See Also
291 --------
292 periodic
293 constant
294 """
295 if not isinstance(kind, dict):
296 kind = dict.fromkeys(range(x.ndim), kind)
297 if not isinstance(depth, dict):
298 depth = dict.fromkeys(range(x.ndim), depth)
299
300 for i in range(x.ndim):
301 d = depth.get(i, 0)
302 if d == 0:
303 continue
304
305 this_kind = kind.get(i, "none")
306 if this_kind == "none":
307 continue
308 elif this_kind == "periodic":
309 x = periodic(x, i, d)
310 elif this_kind == "reflect":
311 x = reflect(x, i, d)
312 elif this_kind == "nearest":
313 x = nearest(x, i, d)
314 elif i in kind:
315 x = constant(x, i, d, kind[i])
316
317 return x
318
319
320def ensure_minimum_chunksize(size, chunks):

Callers 1

overlapFunction · 0.70

Calls 5

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

Tested by

no test coverage detected