I believe you can use np.searchsorted for this:
In [15]: np.searchsorted(a,[1.5,],side='right')[0] Out[15]: 3
Assuming a is in ascending order.
This method will also not work for multidimensional arrays, but I'm not sure exactly how this use case will work in terms of the expected result. If you could give an example of what you imagine, I could adapt this for this purpose.
Note: for this purpose you can also use np.digitize , although it performs a linear rather than binary search, so for a specific input dimensions, it can be much slower than searchsorted and requires a be monotonous:
In [25]: np.digitize([1.5,], a, right=True)[0] Out[25]: 3
source share