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

Home » Public Forums » archive » Interpolation of missing data
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
Interpolation of missing data [message #10751] Tue, 20 January 1998 00:00 Go to next message
rkj is currently offline  rkj
Messages: 66
Registered: February 1996
Member
I have a 2-D array with missing data. Is there an easy way to
interpolate the missing values?

I would like to replace a missing value with the average of
its neighbors.

Kyle J.
Re: interpolation of missing data [message #70019 is a reply to message #10751] Wed, 10 March 2010 06:42 Go to previous message
Kenneth P. Bowman is currently offline  Kenneth P. Bowman
Messages: 585
Registered: May 2000
Senior Member
In article
<dd2beff8-b525-486a-a89b-ed308d1e506b@v20g2000yqv.googlegroups.com>,
a <oxfordenergyservices@googlemail.com> wrote:

> Hi
>
> I have a quick question...
>
> I have some data
>
> a=[-99.9,-99.9,-99.9,1,-99.9,2,-99.9,-99.9,3,4,6,-99.9,2,-99 .9,-99.9,-99.9]
>
> for example. I want all the -99.9s to be replaced with an
> interpolation of the existent data surrounding them (linear interp or
> other) but not the -99.9s at each end.
>
> I could do myself in a way that will work but may not be elegant. But
> then I might not learn something new, interesting and efficient!
>
> Thanks
>
> Russ

I think the easy way to do this is something like this.

x = FINDGEN(N_ELEMENTS(a))
i = WHERE(a NE -99.9, count)
IF (count GT 0) THEN $
ainterp = INTERPOL(a[i], x[i], x)

Because I don't understand what you want to do with the endpoints,
that is left as an exercise to the reader. :-)

Ken Bowman
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: interpolation of missing data
Next Topic: re-create a widget

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

Current Time: Wed Oct 08 19:18:09 PDT 2025

Total time taken to generate the page: 0.00511 seconds