code: def four_element_average_dask(d):
          
          try:
              offset = d.attrs['area'].crop_offset
          except (KeyError, AttributeError):
              offset = (0, 0)
  
          res = d.data.map_blocks(_mean4, offset=offset, dtype=d.dtype)
          return xr.DataArray(res, attrs=d.attrs, dims=d.dims, coords=d.coords)
docs: Average every 4 elements (2x2) in a 2D array