code: def add_coordinates_attrs_coords(
      data_arrays: dict[str, xr.DataArray]
  ) -> dict[str, xr.DataArray]:
      """Add to DataArrays the coordinates specified in the 'coordinates' attribute.
  
      It deal with the 'coordinates' attributes indicating lat/lon coords
      The 'coordinates' attribute is dropped from each DataArray
  
      If the `coordinates` attribute of a data array links to other dataarrays in the scene, for example
      `coordinates='lon lat'`, add them as coordinates to the data array and drop that attribute.
  
      In the final call to `xr.Dataset.to_netcdf()` all coordinate relations will be resolved
      and the `coordinates` attributes be set automatically.
      """
      for dataarray_name in data_arrays.keys():
          data_arrays = _add_declared_coordinates(
              data_arrays, dataarray_name=dataarray_name
          )
          # Drop 'coordinates' attribute in any case to avoid conflicts in xr.Dataset.to_netcdf()
          data_arrays[dataarray_name].attrs.pop("coordinates", None)
      return data_arrays
  
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 17 for calling a global function with example usage: add_coordinates_attrs_coords(data_arrays) and returns: data_arrays