dask 2021.10.0

ParametersBackRef
coarsen(reduction, x, axes, trim_excess=False, **kwargs)

Parameters

reduction: function :

Function like np.sum, np.mean, etc...

x: np.ndarray :

Array to be coarsened

axes: dict :

Mapping of axis to coarsening factor

Coarsen array by applying reduction to fixed size neighborhoods

Examples

This example is valid syntax, but we were not able to check execution
>>> x = np.array([1, 2, 3, 4, 5, 6])
... coarsen(np.sum, x, {0: 2}) array([ 3, 7, 11])
This example is valid syntax, but we were not able to check execution
>>> coarsen(np.max, x, {0: 3})
array([3, 6])

Provide dictionary of scale per dimension

This example is valid syntax, but we were not able to check execution
>>> x = np.arange(24).reshape((4, 6))
... x array([[ 0, 1, 2, 3, 4, 5], [ 6, 7, 8, 9, 10, 11], [12, 13, 14, 15, 16, 17], [18, 19, 20, 21, 22, 23]])
This example is valid syntax, but we were not able to check execution
>>> coarsen(np.min, x, {0: 2, 1: 3})
array([[ 0,  3],
       [12, 15]])

You must avoid excess elements explicitly

This example is valid syntax, but we were not able to check execution
>>> x = np.array([1, 2, 3, 4, 5, 6, 7, 8])
... coarsen(np.min, x, {0: 3}, trim_excess=True) array([1, 4])
See :

Back References

The following pages refer to to this document either explicitly or contain code examples using this.

dask.array.chunk.coarsen

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


File: /dask/array/chunk.py#88
type: <class 'function'>
Commit: