def min_geodetic_distance(a, b):
    """
    Compute the minimum distance between first mesh and each point
    of the second mesh when both are defined on the earth surface.

    :param a: a pair of (lons, lats) or an array of cartesian coordinates
    :param b: a pair of (lons, lats) or an array of cartesian coordinates
    """
    if isinstance(a, tuple):
        a = spherical_to_cartesian(a[0].flatten(), a[1].flatten())
    if isinstance(b, tuple):
        b = spherical_to_cartesian(b[0].flatten(), b[1].flatten())
    return cdist(a, b).min(axis=0)
Compute the minimum distance between first mesh and each point
    of the second mesh when both are defined on the earth surface.

    :param a: a pair of (lons, lats) or an array of cartesian coordinates
    :param b: a pair of (lons, lats) or an array of cartesian coordinates