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

Home » Public Forums » archive » Interpolation routines
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: Interpolation routines [message #92654 is a reply to message #92650] Tue, 02 February 2016 09:34 Go to previous messageGo to previous message
Craig Markwardt is currently offline  Craig Markwardt
Messages: 1869
Registered: November 1996
Senior Member
On Monday, February 1, 2016 at 7:47:21 PM UTC-5, laura...@gmail.com wrote:
> I was wondering whether anyone could recommend an IDL routine (or extra keywords) that would allow me to interpolate my data correctly. Here are the constraints:
>
> - input data and output data are on irregular 1D grids
> - NaN is used as the indicator or bad or missing values
> - the input abcissa values always span a broader range than the output values, HOWEVER, sometimes not all of the input locations have ordinate values associated with them. This generally occurs at the top or bottom of the column. In other words, a number of the levels at the top or bottom may be filled with NaNs.
>
> What I'm looking for is a higher order (not linear) interpolation routine that deals gracefully with NaNs and won't interpolate beyond the range of known values.
>
> I tried interpol with /spline. If I use the /NaN option, the program seems to run fine but fails when there are fewer than 4 good values in a row. If I take out the /NaN, it does not fail in this case. However, it turns out that it interpolates beyond where there are any valid input values (i.e., out into the NaN area). If I replace the NaNs with zeros, it does the same thing (which surprised me).
>
> I tried the spline command instead. It failed when I substituted 0s for the NaNs and returned all NaNs when I left them in.


I found most of the built-in IDL interpolation routines to be kind of a joke. The one I use often is SPL_INIT and SPL_INTERP, which are based on the Numerical Recipes interpolation routines. You will have to screen out your NANs manually with WHERE(), but that should not be a big deal.

The IDL Astronomy library has some other nice routines like QUADTERP. I have developed some specialized interpolators for IDL (example: Chebyshev). If you have known explicit derivatives at each sample point, then my CUBETERP or QINTERP might be of use.

Craig
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: fitting histogram distribution with double gaussian
Next Topic: 4D Interpolation

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

Current Time: Wed Oct 08 13:58:22 PDT 2025

Total time taken to generate the page: 0.00402 seconds