code: def unit_vectors_from_cross_section(cross, index='index'):
      r
      x, y = distances_from_cross_section(cross)
      dx_di = first_derivative(x, axis=index).values
      dy_di = first_derivative(y, axis=index).values
      tangent_vector_mag = np.hypot(dx_di, dy_di)
      unit_tangent_vector = np.vstack([dx_di / tangent_vector_mag, dy_di / tangent_vector_mag])
      unit_normal_vector = np.vstack([-dy_di / tangent_vector_mag, dx_di / tangent_vector_mag])
      return unit_tangent_vector, unit_normal_vector
docs: r"""Calculate the unit tanget and unit normal vectors from a cross-section.
  
      Given a path described parametrically by :math:`\vec{l}(i) = (x(i), y(i))`, we can find
      the unit tangent vector by the formula
  
      .. math:: \vec{T}(i) =
          \frac{1}{\sqrt{\left( \frac{dx}{di} \right)^2 + \left( \frac{dy}{di} \right)^2}}
          \left( \frac{dx}{di}, \frac{dy}{di} \right)
  
      From this, because this is a two-dimensional path, the normal vector can be obtained by a
      simple :math:`\frac{\pi}{2}` rotation.
  
      Parameters
      ----------
      cross : `xarray.DataArray`
          The input DataArray of a cross-section from which to obtain latitudes.
      index : `str`, optional
          A string denoting the index coordinate of the cross section, defaults to 'index' as
          set by `metpy.interpolate.cross_section`.
  
      Returns
      -------
      unit_tangent_vector, unit_normal_vector : tuple of `numpy.ndarray`
          Arrays describing the unit tangent and unit normal vectors (in x,y) for all points
          along the cross section.