@exporter.export
@preprocess_xarray
def nearest_intersection_idx(a, b):
    'Determine the index of the point just before two lines with common x values.\n\n    Parameters\n    ----------\n    a : array-like\n        1-dimensional array of y-values for line 1\n    b : array-like\n        1-dimensional array of y-values for line 2\n\n    Returns\n    -------\n        An array of indexes representing the index of the values\n        just before the intersection(s) of the two lines.\n\n    '
    difference = (a - b)
    (sign_change_idx,) = np.nonzero(np.diff(np.sign(difference)))
    return sign_change_idx
Determine the index of the point just before two lines with common x values.

Parameters
----------
a : array-like
    1-dimensional array of y-values for line 1
b : array-like
    1-dimensional array of y-values for line 2

Returns
-------
    An array of indexes representing the index of the values
    just before the intersection(s) of the two lines.
@exporter.export
@preprocess_xarray
def nearest_intersection_idx(a, b):
    'Determine the index of the point just before two lines with common x values.\n\n    Parameters\n    ----------\n    a : array-like\n        1-dimensional array of y-values for line 1\n    b : array-like\n        1-dimensional array of y-values for line 2\n\n    Returns\n    -------\n        An array of indexes representing the index of the values\n        just before the intersection(s) of the two lines.\n\n    '
    difference = (a - b)
    (sign_change_idx,) = np.nonzero(np.diff(np.sign(difference)))
    return sign_change_idx