code: def collect_cf_datasets(
      list_dataarrays,
      header_attrs=None,
      exclude_attrs=None,
      flatten_attrs=False,
      pretty=True,
      include_lonlats=True,
      epoch=None,
      include_orig_name=True,
      numeric_name_prefix="CHANNEL_",
      groups=None,
  ):
      """Process a list of xr.DataArray and return a dictionary with CF-compliant xr.Datasets.
  
      If the xr.DataArrays does not share the same dimensions, it creates a collection
      of xr.Datasets sharing the same dimensions.
  
      Args:
          list_dataarrays (list): List of DataArrays to make CF compliant and merge into groups of xr.Datasets.
          header_attrs (dict): Global attributes of the output 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 retrieved 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.
          groups (dict, optional): Group datasets according to the given assignment:
              `{'<group_name>': ['dataset_name1', 'dataset_name2', ...]}`.
              Used to create grouped netCDFs using the CF_Writer. If None, no groups will be created.
  
      Returns:
          tuple: A tuple containing:
              - grouped_datasets (dict): A dictionary of CF-compliant xr.Dataset: {group_name: xr.Dataset}.
              - header_attrs (dict): Global attributes to be attached to the xr.Dataset / netCDF4.
      """
      from satpy.cf.attrs import preprocess_header_attrs
      from satpy.cf.coords import add_time_bounds_dimension
  
      if not list_dataarrays:
          raise RuntimeError(
              "None of the requested datasets have been "
              "generated or could not be loaded. Requested "
              "composite inputs may need to have matching "
              "dimensions (eg. through resampling)."
          )
  
      header_attrs = preprocess_header_attrs(
          header_attrs=header_attrs, flatten_attrs=flatten_attrs
      )
  
      # Retrieve groups
      # - If groups is None: {None: list_dataarrays}
      # - if groups not None: {group_name: [xr.DataArray, xr.DataArray ,..], ...}
      # Note: if all dataset names are wrong, behave like groups = None !
      grouped_dataarrays = _get_groups(groups, list_dataarrays)
      is_grouped = len(grouped_dataarrays) >= 2
  
      # If not grouped, add CF conventions.
      # - If 'Conventions' key already present, do not overwrite !
      if "Conventions" not in header_attrs and not is_grouped:
          header_attrs["Conventions"] = CF_VERSION
  
      # Create dictionary of group xr.Datasets
      # --> If no groups (groups=None) --> group_name=None
      grouped_datasets = {}
      for group_name, group_dataarrays in grouped_dataarrays.items():
          ds = _collect_cf_dataset(
              list_dataarrays=group_dataarrays,
              epoch=epoch,
              flatten_attrs=flatten_attrs,
              exclude_attrs=exclude_attrs,
              include_lonlats=include_lonlats,
              pretty=pretty,
              include_orig_name=include_orig_name,
              numeric_name_prefix=numeric_name_prefix,
          )
  
          if not is_grouped:
              ds.attrs = header_attrs
  
          if "time" in ds:
              ds = add_time_bounds_dimension(ds, time="time")
  
          grouped_datasets[group_name] = ds
      return grouped_datasets, header_attrs
  
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 5 for calling a global function with example usage: collect_cf_datasets(list_dataarrays, header_attrs, exclude_attrs, flatten_attrs, pretty, include_lonlats, epoch, include_orig_name, numeric_name_prefix, groups) and returns: grouped_datasets,  header_attrs