docs: def reduce(self, func, dim=None, axis=None, keep_attrs=None, **kwargs):
          """Reduce this array by applying `func` along some dimension(s).
  
          Parameters
          ----------
          func : function
              Function which can be called in the form
              `f(x, axis=axis, **kwargs)` to return the result of reducing an
              np.ndarray over an integer valued axis.
          dim : str or sequence of str, optional
              Dimension(s) over which to apply `func`.
          axis : int or sequence of int, optional
              Axis(es) over which to repeatedly apply `func`. Only one of the
              'dim' and 'axis' arguments can be supplied. If neither are
              supplied, then the reduction is calculated over the flattened array
              (by calling `f(x)` without an axis argument).
          keep_attrs : bool, optional
              If True, the variable's attributes (`attrs`) will be copied from
              the original object to the new one.  If False (default), the new
              object will be returned without attributes.
          **kwargs : dict
              Additional keyword arguments passed on to `func`.
  
          Returns
          -------
          reduced : DataArray
              DataArray with this object's array replaced with an array with
              summarized data and the indicated dimension(s) removed.
          """
  
          var = self.variable.reduce(func, dim, axis, keep_attrs, **kwargs)
          return self._replace_maybe_drop_dims(var)