unit_vectors_from_cross_section#

metpy.calc.unit_vectors_from_cross_section(cross, index='index')[source]#

Calculate the unit tangent and unit normal vectors from a cross-section.

Given a path described parametrically by \(\vec{l}(i) = (x(i), y(i))\), we can find the unit tangent vector by the formula:

\[\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 \(\frac{\pi}{2}\) rotation.

Parameters:
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