code: def da2cf(dataarray, epoch=EPOCH):
          
          new_data = dataarray.copy()
  
          # Remove the area
          new_data.attrs.pop('area', None)
  
          anc = [ds.attrs['name']
                 for ds in new_data.attrs.get('ancillary_variables', [])]
          if anc:
              new_data.attrs['ancillary_variables'] = ' '.join(anc)
          # TODO: make this a grid mapping or lon/lats
          # new_data.attrs['area'] = str(new_data.attrs.get('area'))
          for key, val in new_data.attrs.copy().items():
              if val is None:
                  new_data.attrs.pop(key)
          new_data.attrs.pop('_last_resampler', None)
  
          if 'time' in new_data.coords:
              new_data['time'].encoding['units'] = epoch
              new_data['time'].attrs['standard_name'] = 'time'
              new_data['time'].attrs.pop('bounds', None)
              if 'time' not in new_data.dims:
                  new_data = new_data.expand_dims('time')
  
          if 'x' in new_data.coords:
              new_data['x'].attrs['standard_name'] = 'projection_x_coordinate'
              new_data['x'].attrs['units'] = 'm'
  
          if 'y' in new_data.coords:
              new_data['y'].attrs['standard_name'] = 'projection_y_coordinate'
              new_data['y'].attrs['units'] = 'm'
  
          new_data.attrs.setdefault('long_name', new_data.attrs.pop('name'))
          if 'prerequisites' in new_data.attrs:
              new_data.attrs['prerequisites'] = [np.string_(str(prereq)) for prereq in new_data.attrs['prerequisites']]
          return new_data
docs: Convert the dataarray to something cf-compatible.