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

Home » Public Forums » archive » Re: Reverse interpolation?
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: Reverse interpolation? [message #21292 is a reply to message #21278] Wed, 16 August 2000 00:00 Go to previous message
Martin Schultz is currently offline  Martin Schultz
Messages: 515
Registered: August 1997
Senior Member
Simon de Vet wrote:
>
> I have a little problem :)
>
> I have three sets of data - a list of altitudes (which are not evenly
> spaced, and are calculated with a long, confusing formula), an altitude
> I want to match, and a set of data that depends on altitude (ie: entry 1
> corresponds to altitude 1, entry 2 to altitude 2, etc...).
>
> Currently, I am calculating the differences between each entry in the
> altitude list and my known altitude, and using this to find the closest
> match, who's subscript I use in the data array. However, since there
> aren't very many values in my altitude list, the closest matches are
> often not very close at all, and the results become inaccurate.
>
> I want to get better results. Instead of finding that entry #5 is the
> closest match to my known altitude, and using #5 as the subscript in my
> data array, I'd like to find that, based on a linear interpolation,
> entry #5.32850 is an exact match, and using this value in an
> interpolation on my data array.
>
> I understand how to use a subscript to find an interpolated value. How
> would I go in the opposite direction, using a value to find a subscript?
>
> Thanks. I hope this isn't too confusing. I'm having a bad brane day.
>
> Simon


Hi Simon,

I have dealt with similar problems (vertical regridding, to
give the kid a name), and I tend to resort on the spline routine
in these instances. Please find attached a piece of code that I
used to vertically regrid OH concentration fields. Just be
careful about end effects. For this application I overwrote the
topmostfour levels of the target grid with the values from the
top level of the old grid.

Cheers,
Martin



FOR i=0,N_Elements(grid.lon)-1 DO BEGIN
FOR j=0,N_Elements(grid.lat)-1 DO BEGIN

oldx = reverse( reform( newoh[i,j,*,month-1] ) )
oldy = reverse( reform( data.p ) )
newy = reform( pgrid[i,j,*,month-1] )

;; Smooth spline interpolation onto new grid
newxx = Spline( oldy, oldx, newy, 5. )

;; Enter new values in result field
resultoh[i,j,*,month-1] =
reform(newxx,1,1,N_Elements(newxx))
ENDFOR
ENDFOR
--
[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[ [[[[[[[
[[ Dr. Martin Schultz Max-Planck-Institut fuer Meteorologie
[[
[[ Bundesstr. 55, 20146 Hamburg
[[
[[ phone: +49 40 41173-308
[[
[[ fax: +49 40 41173-298
[[
[[ martin.schultz@dkrz.de
[[
[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[ [[[[[[[
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: Coastal boundaries over sat data
Next Topic: Re: VIRUS ALERT (was: Ghost object)

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

Current Time: Sat Oct 11 05:49:37 PDT 2025

Total time taken to generate the page: 0.79907 seconds