code: def set_cf_time_info(
      data_arr: xr.DataArray, epoch: str | None
  ) -> xr.DataArray:
      """Set CF time attributes and encoding.
  
      It expand the DataArray with a time dimension if does not yet exists.
  
      The function assumes
  
          - that x and y dimensions have at least shape > 1
          - the time coordinate has size 1
  
      """
      if epoch is None:
          epoch = EPOCH
  
      data_arr["time"].encoding["units"] = epoch
      data_arr["time"].attrs["standard_name"] = "time"
      data_arr["time"].attrs.pop("bounds", None)
  
      if (
          "time" not in data_arr.dims
          and data_arr["time"].size not in data_arr.shape
      ):
          data_arr = data_arr.expand_dims("time")
  
      return data_arr
  
imports: from __future__ import annotations
  import logging
  import warnings
  from collections import defaultdict
  from contextlib import suppress
  import numpy
  import xarray
  from dask.base import tokenize
  from pyproj import CRS
  from pyresample.geometry import AreaDefinition, SwathDefinition
label_desc: Use image node_id 9 for calling a global function with example usage: set_cf_time_info(data_arr, epoch) and returns: data_arr