code: def _collect_cf_dataset(
      list_dataarrays,
      epoch=None,
      flatten_attrs=False,
      exclude_attrs=None,
      include_lonlats=True,
      pretty=False,
      include_orig_name=True,
      numeric_name_prefix="CHANNEL_",
  ):
      """Process a list of xr.DataArray and return a dictionary with CF-compliant xr.Dataset.
  
      Args:
          list_dataarrays (list): List of DataArrays to make CF compliant and merge into an xr.Dataset.
          epoch (str, optional): Reference time for encoding the time coordinates.
              Example format: "seconds since 1970-01-01 00:00:00".
              If None, the default reference time is defined using `from satpy.cf.coords import EPOCH`.
          flatten_attrs (bool, optional): If True, flatten dict-type attributes.
          exclude_attrs (list, optional): List of xr.DataArray attribute names to be excluded.
          include_lonlats (bool, optional): If True, includes 'latitude' and 'longitude' coordinates also for a
              satpy.Scene defined on an AreaDefinition.
              If the 'area' attribute is a SwathDefinition, it always includes latitude and longitude coordinates.
          pretty (bool, optional): Don't modify coordinate names, if possible.
              Makes the file prettier, but possibly less consistent.
          include_orig_name (bool, optional): Include the original dataset name as a variable attribute in the xr.Dataset.
          numeric_name_prefix (str, optional): Prefix to add to each variable with a name starting with a digit.
              Use '' or None to leave this out.
  
      Returns:
          xr.Dataset: A partially CF-compliant xr.Dataset.
      """
      from satpy.cf.area import area2cf
      from satpy.cf.coords import (
          add_coordinates_attrs_coords,
          check_unique_projection_coords,
          ensure_unique_nondimensional_coords,
          has_projection_coords,
      )
      from satpy.cf.data_array import make_cf_data_array
  
      # Create dictionary of input datarrays
      # --> Since keys=None, it doesn't never retrieve ancillary variables !!!
      dict_dataarrays = {}
      for dataarray in list_dataarrays:
          dict_dataarrays.update(_get_extra_ds(dataarray))
  
      # Check if one DataArray in the collection has 'longitude' or 'latitude'
      got_lonlats = has_projection_coords(dict_dataarrays)
  
      # Sort dictionary by keys name
      dict_dataarrays = dict(sorted(dict_dataarrays.items()))
  
      dict_cf_dataarrays = {}
      for dataarray in dict_dataarrays.values():
          dataarray_type = dataarray.dtype
          if dataarray_type not in CF_DTYPES:
              warnings.warn(
                  f"dtype {dataarray_type} not compatible with {CF_VERSION}.",
                  stacklevel=3,
              )
          # Deep copy the datarray since adding/modifying attributes and coordinates
          dataarray = dataarray.copy(deep=True)
  
          # Add CF-compliant area information from the pyresample area
          # - If include_lonlats=True, add latitude and longitude coordinates
          # - Add grid_mapping attribute to the DataArray
          # - Return the CRS DataArray as first list element
          # - Return the CF-compliant input DataArray as second list element
          try:
              list_new_dataarrays = area2cf(
                  dataarray,
                  include_lonlats=include_lonlats,
                  got_lonlats=got_lonlats,
              )
          except KeyError:
              list_new_dataarrays = [dataarray]
  
          # Ensure each DataArray is CF-compliant
          # --> NOTE: Here the CRS DataArray is repeatedly overwrited
          # --> NOTE: If the input list_dataarrays have different pyresample areas with the same name
          #           area information can be lost here !!!
          for new_dataarray in list_new_dataarrays:
              new_dataarray = make_cf_data_array(
                  new_dataarray,
                  epoch=epoch,
                  flatten_attrs=flatten_attrs,
                  exclude_attrs=exclude_attrs,
                  include_orig_name=include_orig_name,
                  numeric_name_prefix=numeric_name_prefix,
              )
              dict_cf_dataarrays[new_dataarray.name] = new_dataarray
  
      # Check all DataArrays have same projection coordinates
      check_unique_projection_coords(dict_cf_dataarrays)
  
      # Add to DataArrays the coordinates specified in the 'coordinates' attribute
      # - Deal with the 'coordinates' attributes indicating lat/lon coords
      # - The 'coordinates' attribute is dropped from each DataArray
      dict_cf_dataarrays = add_coordinates_attrs_coords(
          dict_cf_dataarrays
      )
  
      # Ensure non-dimensional coordinates to be unique across DataArrays
      # --> If not unique, prepend the DataArray name to the coordinate
      # --> If unique, does not prepend the DataArray name only if pretty=True
      # --> 'longitude' and 'latitude' coordinates are not prepended
      dict_cf_dataarrays = ensure_unique_nondimensional_coords(
          dict_cf_dataarrays, pretty=pretty
      )
  
      # Create a xr.Dataset
      ds = xr.Dataset(dict_cf_dataarrays)
      return ds
  
file_path: satpy/satpy/cf/datasets.py
imports: import logging
  import warnings
  import xarray
  from satpy.writers.cf_writer import CF_DTYPES, CF_VERSION
label_desc: Use image node_id 4 for calling a global function with example usage: _collect_cf_dataset(list_dataarrays, epoch, flatten_attrs, exclude_attrs, include_lonlats, pretty, include_orig_name, numeric_name_prefix) and returns: ds