def geographic2plunge_bearing(lon, lat):
    """
    Converts longitude and latitude in stereonet coordinates into a
    plunge/bearing.

    Parameters
    ----------
    lon, lat : numbers or sequences of numbers
        Longitudes and latitudes in radians as measured from a
        lower-hemisphere stereonet

    Returns
    -------
    plunge : array
        The plunge of the vector in degrees downward from horizontal.
    bearing : array
        The bearing of the vector in degrees clockwise from north.
    """
    lon, lat = np.atleast_1d(lon, lat)
    x, y, z = sph2cart(lon, lat)

    # Bearing will be in the y-z plane...
    bearing = np.arctan2(z, y)

    # Plunge is the angle between the line and the y-z plane
    r = np.sqrt(x*x + y*y + z*z)
    r[r == 0] = 1e-15
    plunge = np.arcsin(x / r)

    # Convert back to azimuths in degrees..
    plunge, bearing = np.degrees(plunge), np.degrees(bearing)
    bearing = 90 - bearing
    bearing[bearing < 0] += 360

    # If the plunge angle is upwards, get the opposite end of the line
    upwards = plunge < 0
    plunge[upwards] *= -1
    bearing[upwards] -= 180
    bearing[upwards & (bearing < 0)] += 360

    return plunge, bearing
Converts longitude and latitude in stereonet coordinates into a
    plunge/bearing.

    Parameters
    ----------
    lon, lat : numbers or sequences of numbers
        Longitudes and latitudes in radians as measured from a
        lower-hemisphere stereonet

    Returns
    -------
    plunge : array
        The plunge of the vector in degrees downward from horizontal.
    bearing : array
        The bearing of the vector in degrees clockwise from north.