code: def add_xy_coords_attrs(data_arr: xr.DataArray) -> xr.DataArray:
      """Add relevant attributes to x, y coordinates."""
      # If there are no coords, return dataarray
      if not data_arr.coords.keys() & {"x", "y", "crs"}:
          return data_arr
      # If projected area
      if _is_projected(data_arr):
          data_arr = _add_xy_projected_coords_attrs(data_arr)
      else:
          data_arr = _add_xy_geographic_coords_attrs(data_arr)
      if "crs" in data_arr.coords:
          data_arr = data_arr.drop_vars("crs")
      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 1 for calling a global function with example usage: add_xy_coords_attrs(data_arr) and returns: data_arr, data_arr