@exporter.export
@preprocess_xarray
def resample_nn_1d(a, centers):
    'Return one-dimensional nearest-neighbor indexes based on user-specified centers.\n\n    Parameters\n    ----------\n    a : array-like\n        1-dimensional array of numeric values from which to\n        extract indexes of nearest-neighbors\n    centers : array-like\n        1-dimensional array of numeric values representing a subset of values to approximate\n\n    Returns\n    -------\n        An array of indexes representing values closest to given array values\n\n    '
    ix = []
    for center in centers:
        index = np.abs((a - center)).argmin()
        if (index not in ix):
            ix.append(index)
    return ix
Return one-dimensional nearest-neighbor indexes based on user-specified centers.

Parameters
----------
a : array-like
    1-dimensional array of numeric values from which to
    extract indexes of nearest-neighbors
centers : array-like
    1-dimensional array of numeric values representing a subset of values to approximate

Returns
-------
    An array of indexes representing values closest to given array values
@exporter.export
@preprocess_xarray
def resample_nn_1d(a, centers):
    'Return one-dimensional nearest-neighbor indexes based on user-specified centers.\n\n    Parameters\n    ----------\n    a : array-like\n        1-dimensional array of numeric values from which to\n        extract indexes of nearest-neighbors\n    centers : array-like\n        1-dimensional array of numeric values representing a subset of values to approximate\n\n    Returns\n    -------\n        An array of indexes representing values closest to given array values\n\n    '
    ix = []
    for center in centers:
        index = np.abs((a - center)).argmin()
        if (index not in ix):
            ix.append(index)
    return ix