code: def _reduce_method(cls, func):
          
          def wrapped_func(self, **kwargs):
              from .dataarray import DataArray
  
              reduced = self.obj.variable.coarsen(
                  self.windows, func, self.boundary, self.side)
              coords = {}
              for c, v in self.obj.coords.items():
                  if c == self.obj.name:
                      coords[c] = reduced
                  else:
                      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
              return DataArray(reduced, dims=self.obj.dims, coords=coords)
  
          return wrapped_func
docs: Return a wrapped function for injecting numpy methods.
          see ops.inject_coarsen_methods