def reduce(
        self,
        func: Callable,
        keep_attrs: bool | None = None,
        sliding_window_view_kwargs: Mapping[Any, Any] | None = None,
        **kwargs: Any,
    ) -> DataArray:
        """Reduce the items in this group by applying `func` along some
        dimension(s).

        Parameters
        ----------
        func : callable
            Function which can be called in the form
            `func(x, **kwargs)` to return the result of collapsing an
            np.ndarray over an the rolling dimension.
        keep_attrs : bool, default: None
            If True, the attributes (``attrs``) will be copied from the original
            object to the new one. If False, the new object will be returned
            without attributes. If None uses the global default.
        sliding_window_view_kwargs : Mapping
            Keyword arguments that should be passed to the underlying array type's
            ``sliding_window_view`` function.
        **kwargs : dict
            Additional keyword arguments passed on to `func`.

        Returns
        -------
        reduced : DataArray
            Array with summarized data.

        See Also
        --------
        numpy.lib.stride_tricks.sliding_window_view
        dask.array.lib.stride_tricks.sliding_window_view

        Notes
        -----
        With dask arrays, it's possible to pass the ``automatic_rechunk`` kwarg as
        ``sliding_window_view_kwargs={"automatic_rechunk": True}``. This controls
        whether dask should automatically rechunk the output to avoid
        exploding chunk sizes. Automatically rechunking is the default behaviour.
        Importantly, each chunk will be a view of the data so large chunk sizes are
        only safe if *no* copies are made later.
        """
        return self._dataset_implementation(
            functools.partial(DataArrayRolling.reduce, func=func),
            keep_attrs=keep_attrs,
            sliding_window_view_kwargs=sliding_window_view_kwargs,
            **kwargs,
        )
Reduce the items in this group by applying `func` along some
        dimension(s).

        Parameters
        ----------
        func : callable
            Function which can be called in the form
            `func(x, **kwargs)` to return the result of collapsing an
            np.ndarray over an the rolling dimension.
        keep_attrs : bool, default: None
            If True, the attributes (``attrs``) will be copied from the original
            object to the new one. If False, the new object will be returned
            without attributes. If None uses the global default.
        sliding_window_view_kwargs : Mapping
            Keyword arguments that should be passed to the underlying array type's
            ``sliding_window_view`` function.
        **kwargs : dict
            Additional keyword arguments passed on to `func`.

        Returns
        -------
        reduced : DataArray
            Array with summarized data.

        See Also
        --------
        numpy.lib.stride_tricks.sliding_window_view
        dask.array.lib.stride_tricks.sliding_window_view

        Notes
        -----
        With dask arrays, it's possible to pass the ``automatic_rechunk`` kwarg as
        ``sliding_window_view_kwargs={"automatic_rechunk": True}``. This controls
        whether dask should automatically rechunk the output to avoid
        exploding chunk sizes. Automatically rechunking is the default behaviour.
        Importantly, each chunk will be a view of the data so large chunk sizes are
        only safe if *no* copies are made later.
        
xarray/computation/rolling.py