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

Home » Public Forums » archive » Delete bad data and interplate the new 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
Delete bad data and interplate the new data [message #52950] Mon, 12 March 2007 02:23 Go to next message
duxiyu@gmail.com is currently offline  duxiyu@gmail.com
Messages: 88
Registered: March 2007
Member
I have a data array.
But there is some bad data in it.
I want to use the interpolative data to replace these bad points.

It is easy to make a procedure to do it, but I wonder whether there is
internal procedure in IDL.

Best regards,
Du Jian
Re: Delete bad data and interplate the new data [message #53022 is a reply to message #52950] Tue, 13 March 2007 10:26 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
JD Smith writes:

> Yes, INTERPOL:
>
> data=[1,2,3,42,5,6,7]
> badval=42
> bad=where(data eq badval,nbad,COMPLEMENT=good,NCOMPLEMENT=ngood)
> if nbad gt 0 && ngood gt 1 then data[bad]=interpol(data[good],good,bad)
>
> If you want to do 2D or higher-dimension interpolation, you'll need a
> bit more magic.

Yikes! If you showed us the 2D case we would have the makings
of a nice little article here. :-)

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: Delete bad data and interplate the new data [message #53023 is a reply to message #52950] Tue, 13 March 2007 09:18 Go to previous message
JD Smith is currently offline  JD Smith
Messages: 850
Registered: December 1999
Senior Member
On Mon, 12 Mar 2007 02:23:54 -0700, duxiyu@gmail.com wrote:

> I have a data array.
> But there is some bad data in it.
> I want to use the interpolative data to replace these bad points.
>
> It is easy to make a procedure to do it, but I wonder whether there is
> internal procedure in IDL.

Yes, INTERPOL:

data=[1,2,3,42,5,6,7]
badval=42
bad=where(data eq badval,nbad,COMPLEMENT=good,NCOMPLEMENT=ngood)
if nbad gt 0 && ngood gt 1 then data[bad]=interpol(data[good],good,bad)

If you want to do 2D or higher-dimension interpolation, you'll need a
bit more magic.

JD
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: randomn problem
Next Topic: Material properties for object graphics

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

Current Time: Wed Oct 08 17:11:21 PDT 2025

Total time taken to generate the page: 0.00562 seconds