code: def tangential_component(data_x, data_y, index='index'):
      r
      # Get the unit vectors
      unit_tang, _ = unit_vectors_from_cross_section(data_x, index=index)
  
      # Take the dot products
      component_tang = data_x * unit_tang[0] + data_y * unit_tang[1]
  
      # Reattach only reliable attributes after operation
      for attr in ('units', 'grid_mapping'):
          if attr in data_x.attrs:
              component_tang.attrs[attr] = data_x.attrs[attr]
  
      return component_tang
docs: r"""Obtain the tangential component of a cross-section of a vector field.
  
      Parameters
      ----------
      data_x : `xarray.DataArray`
          The input DataArray of the x-component (in terms of data projection) of the vector
          field.
      data_y : `xarray.DataArray`
          The input DataArray of the y-component (in terms of data projection) of the vector
          field.
  
      Returns
      -------
      component_tangential: `xarray.DataArray`
          The component of the vector field in the tangential directions.
  
      See Also
      --------
      cross_section_components, normal_component
  
      Notes
      -----
      The coordinates of `data_x` and `data_y` must match.