On Tue, Dec 6, 2011 at 2:51 AM, Xavier Barthelemy <xabart@gmail.com> wrote:
ok let me be more preciseI have an Z array which is the elevationfrom this I extract a discrete array of Zero Crossing, and another discrete array of Crests.len(crest) is different than len(Xzeros). I have a threshold method to detect my "valid" crests, and sometimes there are 2 crests between two zero-crossing (grouping effect)Crest and Zeros are 2 different arrays, with positions. example: Zeros=[1,2,3,4] Arrays=[1.5,1.7,3.5]and yes arrays can be sorted. not a problm with this.XavierI may be oversimplifying this, but does searchsorted do what you want?
In [314]: xzeros=[1,2,3,4]; xcrests=[1.5,1.7,3.5]
In [315]: np.searchsorted(xzeros, xcrests)
Out[315]: array([1, 1, 3])
This returns the indexes of xzeros to the left of xcrests.
-Tony
_______________________________________________
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion