def calculate_bearing(
    lat1: float | npt.NDArray[np.float64],
    lon1: float | npt.NDArray[np.float64],
    lat2: float | npt.NDArray[np.float64],
    lon2: float | npt.NDArray[np.float64],
) -> float | npt.NDArray[np.float64]:
    """
    Calculate the compass bearing(s) between pairs of lat-lon points.

    Vectorized function to calculate initial bearings between two points'
    coordinates or between arrays of points' coordinates. Expects coordinates
    in decimal degrees. The bearing represents the clockwise angle in degrees
    between north and the geodesic line from `(lat1, lon1)` to `(lat2, lon2)`.

    Parameters
    ----------
    lat1
        First point's latitude coordinate(s).
    lon1
        First point's longitude coordinate(s).
    lat2
        Second point's latitude coordinate(s).
    lon2
        Second point's longitude coordinate(s).

    Returns
    -------
    bearing
        The bearing(s) in decimal degrees.
    """
    # get the latitudes and the difference in longitudes, all in radians
    lat1 = np.deg2rad(lat1)
    lat2 = np.deg2rad(lat2)
    delta_lon = np.deg2rad(lon2 - lon1)

    # calculate initial bearing from -180 degrees to +180 degrees
    y = np.sin(delta_lon) * np.cos(lat2)
    x = np.cos(lat1) * np.sin(lat2) - np.sin(lat1) * np.cos(lat2) * np.cos(delta_lon)
    initial_bearing = np.rad2deg(np.arctan2(y, x))

    # normalize to 0-360 degrees to get compass bearing
    bearing: float | npt.NDArray[np.float64] = initial_bearing % 360
    return bearing

    Calculate the compass bearing(s) between pairs of lat-lon points.

    Vectorized function to calculate initial bearings between two points'
    coordinates or between arrays of points' coordinates. Expects coordinates
    in decimal degrees. The bearing represents the clockwise angle in degrees
    between north and the geodesic line from `(lat1, lon1)` to `(lat2, lon2)`.

    Parameters
    ----------
    lat1
        First point's latitude coordinate(s).
    lon1
        First point's longitude coordinate(s).
    lat2
        Second point's latitude coordinate(s).
    lon2
        Second point's longitude coordinate(s).

    Returns
    -------
    bearing
        The bearing(s) in decimal degrees.
    
osmnx/bearing.py