def critical_angle(pressure, u, v, heights, stormu, stormv):
    r"""Calculate the critical angle.

    The critical angle is the angle between the 10m storm-relative inflow vector
    and the 10m-500m shear vector. A critical angle near 90 degrees indicates
    that a storm in this environment on the indicated storm motion vector
    is likely ingesting purely streamwise vorticity into its updraft, and [Esterheld2008]_
    showed that significantly tornadic supercells tend to occur in environments
    with critical angles near 90 degrees.

    Parameters
    ----------
    pressure : `pint.Quantity`
        Pressures from sounding.
    u : `pint.Quantity`
        U-component of sounding winds.
    v : `pint.Quantity`
        V-component of sounding winds.
    heights : `pint.Quantity`
        Heights from sounding.
    stormu : `pint.Quantity`
        U-component of storm motion.
    stormv : `pint.Quantity`
        V-component of storm motion.

    Returns
    -------
    `pint.Quantity`
        critical angle in degrees

    """
    # Convert everything to m/s
    u = u.to('m/s')
    v = v.to('m/s')
    stormu = stormu.to('m/s')
    stormv = stormv.to('m/s')

    sort_inds = np.argsort(pressure[::-1])
    pressure = pressure[sort_inds]
    heights = heights[sort_inds]
    u = u[sort_inds]
    v = v[sort_inds]

    # Calculate sfc-500m shear vector
    shr5 = bulk_shear(pressure, u, v, heights=heights, depth=500 * units('meter'))

    # Make everything relative to the sfc wind orientation
    umn = stormu - u[0]
    vmn = stormv - v[0]

    vshr = np.asarray([shr5[0].magnitude, shr5[1].magnitude])
    vsm = np.asarray([umn.magnitude, vmn.magnitude])
    angle_c = np.dot(vshr, vsm) / (np.linalg.norm(vshr) * np.linalg.norm(vsm))
    critical_angle = np.arccos(angle_c) * units('radian')

    return critical_angle.to('degrees')
r"""Calculate the critical angle.

    The critical angle is the angle between the 10m storm-relative inflow vector
    and the 10m-500m shear vector. A critical angle near 90 degrees indicates
    that a storm in this environment on the indicated storm motion vector
    is likely ingesting purely streamwise vorticity into its updraft, and [Esterheld2008]_
    showed that significantly tornadic supercells tend to occur in environments
    with critical angles near 90 degrees.

    Parameters
    ----------
    pressure : `pint.Quantity`
        Pressures from sounding.
    u : `pint.Quantity`
        U-component of sounding winds.
    v : `pint.Quantity`
        V-component of sounding winds.
    heights : `pint.Quantity`
        Heights from sounding.
    stormu : `pint.Quantity`
        U-component of storm motion.
    stormv : `pint.Quantity`
        V-component of storm motion.

    Returns
    -------
    `pint.Quantity`
        critical angle in degrees