code: def encode_dataset_coordinates(dataset):
      
      non_dim_coord_names = set(dataset.coords) - set(dataset.dims)
      return _encode_coordinates(dataset._variables, dataset.attrs,
                                 non_dim_coord_names=non_dim_coord_names)
docs: Encode coordinates on the given dataset object into variable specific
      and global attributes.
  
      When possible, this is done according to CF conventions.
  
      Parameters
      ----------
      dataset : Dataset
          Object to encode.
  
      Returns
      -------
      variables : dict
      attrs : dict