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

Home » Public Forums » archive » Interpolate the NaN in 2D array.
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Interpolate the NaN in 2D array. [message #91507] Wed, 22 July 2015 10:14 Go to next message
anagetinga is currently offline  anagetinga
Messages: 1
Registered: July 2015
Junior Member
Hi everyone,

I have a question about 2D interpolation with NaN inside. My doubt is how I proceed to interpolate NaN inside the 2D array.

Best regards,
Cosme
Re: Interpolate the NaN in 2D array. [message #91508 is a reply to message #91507] Wed, 22 July 2015 11:04 Go to previous messageGo to next message
Paul Van Delst[1] is currently offline  Paul Van Delst[1]
Messages: 1157
Registered: April 2002
Senior Member
On 07/22/15 13:14, anagetinga@gmail.com wrote:
> Hi everyone,
>
> I have a question about 2D interpolation with NaN inside. My doubt is
> how I proceed to interpolate NaN inside the 2D array.

Filter them out?

INTERPOL has a /NAN keyword. But you can do it yourself too.

cheers,

paulv
Re: Interpolate the NaN in 2D array. [message #91511 is a reply to message #91508] Wed, 22 July 2015 12:11 Go to previous messageGo to next message
wlandsman is currently offline  wlandsman
Messages: 743
Registered: June 2000
Senior Member
On Wednesday, July 22, 2015 at 2:04:53 PM UTC-4, Paul van Delst wrote:
> On 07/22/15 13:14, a**@gmail.com wrote:
>> Hi everyone,
>>
>> I have a question about 2D interpolation with NaN inside. My doubt is
>> how I proceed to interpolate NaN inside the 2D array.
>
> Filter them out?
>
> INTERPOL has a /NAN keyword. But you can do it yourself too.

INTERPOL() is only for 1-d data I believe. But I would probably start by averaging the result of using INTERPOL() over a row, and INTERPOL() over a column. A more "correct' way would be to use the very powerful -- and very complicated -- GRIDDATA() function, but this is only for the ambitious.

For a similar problem I have used the maskinterp package by Joe Harrington ( https://physics.ucf.edu/~jh/ast/software.html ) but again it is not very user-friendly. However, in my case I had to make sure that I did not bias my results when interpolating over multiple NaN values, and this package is good for this.
Re: Interpolate the NaN in 2D array. [message #91516 is a reply to message #91507] Thu, 23 July 2015 04:58 Go to previous messageGo to next message
Haje Korth is currently offline  Haje Korth
Messages: 651
Registered: May 1997
Senior Member
On Wednesday, July 22, 2015 at 1:14:54 PM UTC-4, Cosme Alexandre wrote:
> Hi everyone,
>
> I have a question about 2D interpolation with NaN inside. My doubt is how I proceed to interpolate NaN inside the 2D array.
>
> Best regards,
> Cosme

INTERPOLATE (instead of INTERPOL) does 2D interpolation. It has a MISSING keyword. Try setting MISSING=!value.f_nan.
Re: Interpolate the NaN in 2D array. [message #91526 is a reply to message #91516] Thu, 23 July 2015 20:40 Go to previous message
wlandsman is currently offline  wlandsman
Messages: 743
Registered: June 2000
Senior Member
On Thursday, July 23, 2015 at 7:58:10 AM UTC-4, Haje Korth wrote:
>
> INTERPOLATE (instead of INTERPOL) does 2D interpolation. It has a MISSING keyword. Try setting MISSING=!value.f_nan.

I don't believe that INTERPOLATE() can deal with NaN values. The MISSING keyword is used to set an *output* value to elements outside of the range of the input array.

And INTERPOLATE() does not have any way to recognize NAN values as special. For example,

IDL> a = dist(5)
IDL> a[2,3] = !values.f_nan
IDL> print,interpolate(a,2,3)
NaN
IDL> print,interpolate(a,2.3,3.3)
NaN
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: compass search
Next Topic: !x/y.window & convert_coord giving unwanted offset to my image scale

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

Current Time: Wed Oct 08 11:48:15 PDT 2025

Total time taken to generate the page: 0.00427 seconds