Return a wrapped function for injecting numpy methods.
        see ops.inject_coarsen_methods

def _reduce_method(cls, func):
        """
        Return a wrapped function for injecting numpy methods.
        see ops.inject_coarsen_methods
        """
        def wrapped_func(self, **kwargs):
            from .dataset import Dataset

            reduced = OrderedDict()
            for key, da in self.obj.data_vars.items():
                reduced[key] = da.variable.coarsen(
                    self.windows, func, self.boundary, self.side)

            coords = {}
            for c, v in self.obj.coords.items():
                if any(d in self.windows for d in v.dims):
                    coords[c] = v.variable.coarsen(
                        self.windows, self.coord_func[c],
                        self.boundary, self.side)
                else:
                    coords[c] = v.variable
            return Dataset(reduced, coords=coords)

        return wrapped_func