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

Home » Public Forums » archive » Re: do SMOOTH not on all 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
Re: do SMOOTH not on all data [message #32685] Wed, 30 October 2002 17:16
air_jlin is currently offline  air_jlin
Messages: 22
Registered: July 2001
Junior Member
hi Dave,

how about setting the values of -9999 to NaN and then use the /Nan
keyword in SMOOTH? this would mean you'd convert your data to
floating, but i'm assuming that's ok with you since you're smoothing
it:

novalid=WHERE(array eq -9999)
array=FLOAT(array)
array[novalid] = !VALUES.F_NAN
result=SMOOTH(array,5,/Nan)

hope this helps!

best,
-Johnny


-------------------------------------------
Johnny Lin
CIRES, University of Colorado
Work Phone: (303) 735-1636
Web: http://cires.colorado.edu/~johnny/
-------------------------------------------


David Oesch <oesch@giub.unibe.ch> wrote in message news:<3DC00163.2010308@giub.uninovalid=WHERE(array NE -9999)be.ch>...
> Hi outthere,
>
> I just want to use SMOOTH on a 2D array. But some data are bad (-9999)
> and should not be considered in the smoothing process. Well trying to
> assign those bad data like this
> novalid=WHERE(array NE -9999)
> result=SMOOTH(array(novalid),5)
>
> DOES not work.
>
> I think the solution is using 'NaN' option, but how to I assign -9999 as
> NaN as the !VALUES.F_NAN is write protected?
>
> Cheers
>
> Dave
Re: do SMOOTH not on all data [message #32690 is a reply to message #32685] Wed, 30 October 2002 08:10 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
David Oesch (oesch@giub.unibe.ch) writes:

> I just want to use SMOOTH on a 2D array. But some data are bad (-9999)
> and should not be considered in the smoothing process. Well trying to
> assign those bad data like this
> novalid=WHERE(array NE -9999)
> result=SMOOTH(array(novalid),5)
>
> DOES not work.
>
> I think the solution is using 'NaN' option, but how to I assign -9999 as
> NaN as the !VALUES.F_NAN is write protected?

You want something like this:

arrayCopy = array
bad = Where(arrayCopy EQ -9999, count)
IF count GT 0 THEN arrayCopy[bad] = !Values.F_NAN
smoothedArray = Smooth(arrayCopy, /NAN, 5)

Cheers,

David
--
David W. Fanning, Ph.D.
Fanning Software Consulting, Inc.
Phone: 970-221-0438, E-mail: david@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
Re: do SMOOTH not on all data [message #32691 is a reply to message #32690] Wed, 30 October 2002 08:05 Go to previous message
mchinand is currently offline  mchinand
Messages: 66
Registered: September 1996
Member
In article <3DC00163.2010308@giub.unibe.ch>,
David Oesch <oesch@giub.unibe.ch> wrote:
> Hi outthere,
>
> I just want to use SMOOTH on a 2D array. But some data are bad (-9999)
> and should not be considered in the smoothing process. Well trying to
> assign those bad data like this
> novalid=WHERE(array NE -9999)
> result=SMOOTH(array(novalid),5)
>
> DOES not work.
>
> I think the solution is using 'NaN' option, but how to I assign -9999 as
> NaN as the !VALUES.F_NAN is write protected?
>
> Cheers
>
> Dave
>

Try:

array(where(array eq -9999))= !VALUES.F_NAN

result=SMOOTH(array,5,/NAN)

--Mike
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: IDL 5.6 Where?
Next Topic: How to transfer variables between files

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

Current Time: Wed Oct 08 14:00:46 PDT 2025

Total time taken to generate the page: 0.00444 seconds