dask.array.lib.stride_tricks.sliding_window_view
- dask.array.lib.stride_tricks.sliding_window_view(x, window_shape, axis=None)[source]
Create a sliding window view into the array with the given window shape. Also known as rolling or moving window, the window slides across all dimensions of the array and extracts subsets of the array at all window positions.
This docstring was copied from dask.array.numpy_compat.sliding_window_view.
Some inconsistencies with the Dask version may exist.
New in version 1.20.0.
- xarray_like
Array to create the sliding window view from.
- window_shapeint or tuple of int
Size of window over each axis that takes part in the sliding window. If axis is not present, must have same length as the number of input array dimensions. Single integers i are treated as if they were the tuple (i,).
- axisint or tuple of int, optional
Axis or axes along which the sliding window is applied. By default, the sliding window is applied to all axes and window_shape[i] will refer to axis i of x. If axis is given as a tuple of int, window_shape[i] will refer to the axis axis[i] of x. Single integers i are treated as if they were the tuple (i,).
- subokbool, optional (Not supported in Dask)
If True, sub-classes will be passed-through, otherwise the returned array will be forced to be a base-class array (default).
- writeablebool, optional (Not supported in Dask)
When true, allow writing to the returned view. The default is false, as this should be used with caution: the returned view contains the same memory location multiple times, so writing to one location will cause others to change.
- viewndarray
Sliding window view of the array. The sliding window dimensions are inserted at the end, and the original dimensions are trimmed as required by the size of the sliding window. That is,
view.shape = x_shape_trimmed + window_shape
, wherex_shape_trimmed
isx.shape
with every entry reduced by one less than the corresponding window size.