comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Minimum between two arrays; no, not just Min(A-B)
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Minimum between two arrays; no, not just Min(A-B) [message #55851] Wed, 19 September 2007 03:55 Go to previous message
leatherback is currently offline  leatherback
Messages: 15
Registered: November 2005
Junior Member
Hi JD,

This worked like a charm! Didn't know the value_locate function.

thanks!

J.

> If they are in sorted order, you can use VALUE_LOCATE, which is happy
> to search for the location of many dates within many satellite
> timestamps, all at once. Then select which ever of the two is closer,
> like so:
>
> IDL> nv=100
> IDL> obs=randomu(sd,nv) & sat=randomu(sd,nv) & sat=sat[sort(sat)]
> IDL> v=value_locate(sat,obs)
> IDL> m=min(abs(sat[[1#v,1#v+1]]-rebin(1#obs,2,nv)),pos,DIMENSION= 1)
> IDL> v= nv-1 < (v + pos mod 2) > 0
> IDL> print,mean(abs(sat[v]-obs))
>
> JD
[Message index]
 
Read Message
Read Message
Previous Topic: Re: correlation and NaN
Next Topic: NIfTI read and write from IDL?

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 19:10:06 PDT 2025

Total time taken to generate the page: 0.00538 seconds