# dask.array.coarsen

dask.array.coarsen(reduction, x, axes, trim_excess=False, **kwargs)

  Coarsen array by applying reduction to fixed size neighborhoods

  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

  Examples

      >>> x = np.array([1, 2, 3, 4, 5, 6])
      >>> coarsen(np.sum, x, {0: 2})
      array([ 3,  7, 11])
      >>> coarsen(np.max, x, {0: 3})
      array([3, 6])

  Provide dictionary of scale per dimension

      >>> 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]])

      >>> coarsen(np.min, x, {0: 2, 1: 3})
      array([[ 0,  3],
             [12, 15]])

  You must avoid excess elements explicitly

      >>> x = np.array([1, 2, 3, 4, 5, 6, 7, 8])
      >>> coarsen(np.min, x, {0: 3}, trim_excess=True)
      array([1, 4])