value_locate.pro location in IDL library [message #50105] |
Wed, 13 September 2006 14:16  |
IDL_Newbie_2000
Messages: 5 Registered: June 2006
|
Junior Member |
|
|
I am trying to use GDL to do some of my work and noticed it was
reporting a missing function of value_locate(). I looked for this
procedure/function in IDL library but can't find it, which is really
strange to me, since a lot of functions seem to use it in IDL (e.g.
mean()). Would any one tell me where I can find this function in the
computer?
Thanks in advace.
|
|
|
Re: value_locate.pro location in IDL library [message #50169 is a reply to message #50105] |
Fri, 15 September 2006 07:26   |
btt
Messages: 345 Registered: December 2000
|
Senior Member |
|
|
Mark Hadfield wrote:
> ZMY wrote:
>> Thanks, Wayne and David. The information is very helpful. Craig's
>> value_locate.pro still doesn't work since spl_interp is not built into
>> GDL yet (as far as I can tell for version 0.9).
>
> Surely you could patch in an alternative interpolation routine. Linear
> interpolation would be adequate in many cases.
>
Hi,
This is from the online help...
"This function is useful for interpolation and table-lookup, and is an
adaptation of the locate() routine in Numerical Recipes. VALUE_LOCATE
uses the bisection method to locate the interval."
You can find the Numerical Recipes algorithm online. Seems like it
should should easy to implement in IDL. One interesting thing I have
recently bumped into is that IDL's built-in works with strings.
IDL> Arr = ['at','bat','cat','dat','eat','fat','gat','hat']
IDL> print, value_locate(arr, 'cup')
2
IDL> print, value_locate(arr, 'eet')
4
IDL> print, value_locate(arr, 'Bat')
-1
IDL> print, value_locate(reverse(arr), 'cup')
4
Nifty!
Ben
|
|
|
Re: value_locate.pro location in IDL library [message #50230 is a reply to message #50169] |
Sat, 16 September 2006 06:05  |
Joel Gales
Messages: 6 Registered: December 2001
|
Junior Member |
|
|
Ben Tupper wrote:
> Mark Hadfield wrote:
>
>> ZMY wrote:
>>
>>> Thanks, Wayne and David. The information is very helpful. Craig's
>>> value_locate.pro still doesn't work since spl_interp is not built into
>>> GDL yet (as far as I can tell for version 0.9).
>>
>>
>> Surely you could patch in an alternative interpolation routine. Linear
>> interpolation would be adequate in many cases.
>>
> Hi,
>
> This is from the online help...
>
> "This function is useful for interpolation and table-lookup, and is an
> adaptation of the locate() routine in Numerical Recipes. VALUE_LOCATE
> uses the bisection method to locate the interval."
>
> You can find the Numerical Recipes algorithm online. Seems like it
> should should easy to implement in IDL. One interesting thing I have
> recently bumped into is that IDL's built-in works with strings.
>
> IDL> Arr = ['at','bat','cat','dat','eat','fat','gat','hat']
> IDL> print, value_locate(arr, 'cup')
> 2
> IDL> print, value_locate(arr, 'eet')
> 4
> IDL> print, value_locate(arr, 'Bat')
> -1
> IDL> print, value_locate(reverse(arr), 'cup')
> 4
>
> Nifty!
> Ben
There is a VALUE_LOCATE procedure in the CVS repository in src/pro.
Joel
|
|
|