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

Home » Public Forums » archive » Need look-up-table routine
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: Need look-up-table routine [message #7648 is a reply to message #7510] Wed, 27 November 1996 00:00 Go to previous message
Thomas A. McGlynn is currently offline  Thomas A. McGlynn
Messages: 23
Registered: March 1996
Junior Member
Adam Ross wrote:
>
> Hello,
>
> I was about to try to write a routine which will, upon input of a
> value or array of values, give a corresponding output value or array
> of values according to a look-up table (also provided as input).
> I'm not sure yet whether I need to use interpolation methods, or
> just nearest-value, but in any case, I thought I should ask around
> here first, to see if such a routine already exists, either in IDL or
> somewhere else. Can anyone help?
>
> Thanks,
>
> Adam Ross
> CRI, Inc.
> cri@world.std.com


If I understand you want a function such that

results = lookup(grid_values, desired_indices)
where the grid_values = [13., 23., 19., 7.] and
desired_indices = [0.3, 2.1, 0.4, 1.1, 1.1, 3., 2.2]
giving (for nearest neighbor)
results = [13., 19., 13., 23., 23., 7., 19.]

For the nearest neighbor case you don't need a function:
you can just do

results = grid_values(desired_indices+.5)

assuming you don't want to do anything special for out of
range values.

For linear interpolation just use the interpolate function
results = interpolate(grid_values, desired_indices)

My apologies if I've misunderstood what you're asking for.

Yours,
Tom McGlynn
tam@silk.gsfc.nasa.gov
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Bug with printf in IDL 4.0.1 under Unix
Next Topic: Make money!

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

Current Time: Wed Oct 08 17:30:32 PDT 2025

Total time taken to generate the page: 0.00471 seconds