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

Home » Public Forums » archive » Re: MISSING_VALUE
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: MISSING_VALUE [message #43249] Tue, 29 March 2005 23:26 Go to next message
Benjamin Luethi is currently offline  Benjamin Luethi
Messages: 22
Registered: December 2004
Junior Member
Hi,

Maybe you're copying floats into an integer array? (there is no NaN for
integers) But then you would see a warning like:

% Program caused arithmetic error: Floating illegal operand

Ben


On Wed, 30 Mar 2005 09:10:12 +0200, Matthias Demuzere
<Matthias.demuzere@geo.kuleuven.ac.be> wrote:

> Hi,
>
> Now the problem has moved. When the dataset is initially read in with
> read_ascii, I get the value NaN where it should....
>
> BUT....I declare empty arrays (with zero's) in which I put a part of the
> original array. So where there is the value NaN, my new array now shows
> 0....Any solutions?
> Hope I made myself clear!
> Greetz,
> Matthias
>
>
> "David Fanning" <davidf@dfanning.com> wrote in message
> news:MPG.1cb3231e1d37767198999f@news.frii.com...
>> Matthias Demuzere writes:
>>
>>> At a certain point i the proces, he's giving me the values 'NaN' where
>>> there
>>> are no values, so this is OK. But when i'm trying to plot the data, no
>>> he's
>>> giving a '0' value in my graph, so that isn't correct, there shouldn't
>>> be
>>> any value at all...
>>> Any helps??
>>
>> Well, that's not what happens *here*. :-)
>>
>> What kind of machine? What version of IDL? Are you
>> *certain* this isn't pilot error?
>>
>> Cheers,
>>
>> David
>>
>> --
>> David Fanning, Ph.D.
>> Fanning Software Consulting, Inc.
>> Coyote's Guide to IDL Programming: http://www.dfanning.com/
>
>



--
Using Opera's revolutionary e-mail client: http://www.opera.com/m2/
Re: MISSING_VALUE [message #43250 is a reply to message #43249] Tue, 29 March 2005 23:10 Go to previous messageGo to next message
Matthias Demuzere is currently offline  Matthias Demuzere
Messages: 9
Registered: April 2004
Junior Member
Hi,

Now the problem has moved. When the dataset is initially read in with
read_ascii, I get the value NaN where it should....

BUT....I declare empty arrays (with zero's) in which I put a part of the
original array. So where there is the value NaN, my new array now shows
0....Any solutions?
Hope I made myself clear!
Greetz,
Matthias


"David Fanning" <davidf@dfanning.com> wrote in message
news:MPG.1cb3231e1d37767198999f@news.frii.com...
> Matthias Demuzere writes:
>
>> At a certain point i the proces, he's giving me the values 'NaN' where
>> there
>> are no values, so this is OK. But when i'm trying to plot the data, no
>> he's
>> giving a '0' value in my graph, so that isn't correct, there shouldn't be
>> any value at all...
>> Any helps??
>
> Well, that's not what happens *here*. :-)
>
> What kind of machine? What version of IDL? Are you
> *certain* this isn't pilot error?
>
> Cheers,
>
> David
>
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming: http://www.dfanning.com/
Re: MISSING_VALUE [message #43258 is a reply to message #43250] Tue, 29 March 2005 07:34 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Matthias Demuzere writes:

> At a certain point i the proces, he's giving me the values 'NaN' where there
> are no values, so this is OK. But when i'm trying to plot the data, no he's
> giving a '0' value in my graph, so that isn't correct, there shouldn't be
> any value at all...
> Any helps??

Does this code give you a 0 or a gap?

IDL> a=findgen(11)
IDL> a[5] = !values.f_nan
IDL> plot,a

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Re: MISSING_VALUE [message #43259 is a reply to message #43258] Tue, 29 March 2005 07:33 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Matthias Demuzere writes:

> At a certain point i the proces, he's giving me the values 'NaN' where there
> are no values, so this is OK. But when i'm trying to plot the data, no he's
> giving a '0' value in my graph, so that isn't correct, there shouldn't be
> any value at all...
> Any helps??

Well, that's not what happens *here*. :-)

What kind of machine? What version of IDL? Are you
*certain* this isn't pilot error?

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Re: MISSING_VALUE [message #43260 is a reply to message #43259] Tue, 29 March 2005 07:24 Go to previous messageGo to next message
Matthias Demuzere is currently offline  Matthias Demuzere
Messages: 9
Registered: April 2004
Junior Member
Thanks, but I still have a problem now...

"David Fanning" <davidf@dfanning.com> wrote in message
news:MPG.1cb31cad9915836098999e@news.frii.com...
> Matthias Demuzere writes:
>
>> I'm reading an ascii file with the following command:
>> res = read_ascii(input+fnam+'.txt', delimiter=' ', MISSING_VALUE=99999)
>>
>> When I print "res", he's also printing 99999, but I want that value to be
>> reproduced as NaN.
>> Can anyone help me with this little problem?
>
> How about:
>
> res = read_ascii(input+fnam+'.txt', delimiter=' ', $
> MISSING_VALUE=!VALUES.F_NAN)

At a certain point i the proces, he's giving me the values 'NaN' where there
are no values, so this is OK. But when i'm trying to plot the data, no he's
giving a '0' value in my graph, so that isn't correct, there shouldn't be
any value at all...
Any helps??

Greetz,
Matthias


> Cheers,
>
> David
>
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming: http://www.dfanning.com/
Re: MISSING_VALUE [message #43261 is a reply to message #43260] Tue, 29 March 2005 07:05 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Matthias Demuzere writes:

> I'm reading an ascii file with the following command:
> res = read_ascii(input+fnam+'.txt', delimiter=' ', MISSING_VALUE=99999)
>
> When I print "res", he's also printing 99999, but I want that value to be
> reproduced as NaN.
> Can anyone help me with this little problem?

How about:

res = read_ascii(input+fnam+'.txt', delimiter=' ', $
MISSING_VALUE=!VALUES.F_NAN)

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Re: MISSING_VALUE [message #43333 is a reply to message #43250] Thu, 31 March 2005 06:27 Go to previous message
edward.s.meinel@aero. is currently offline  edward.s.meinel@aero.
Messages: 52
Registered: February 2005
Member
Create the "empty" array and fill it with NaN's.

Ed

P.S. David forgot his P.S.
;-)

Matthias Demuzere wrote:
> Hi,
>
> Now the problem has moved. When the dataset is initially read in with

> read_ascii, I get the value NaN where it should....
>
> BUT....I declare empty arrays (with zero's) in which I put a part of
the
> original array. So where there is the value NaN, my new array now
shows
> 0....Any solutions?
> Hope I made myself clear!
> Greetz,
> Matthias
>
>
> "David Fanning" <davidf@dfanning.com> wrote in message
> news:MPG.1cb3231e1d37767198999f@news.frii.com...
>> Matthias Demuzere writes:
>>
>>> At a certain point i the proces, he's giving me the values 'NaN'
where
>>> there
>>> are no values, so this is OK. But when i'm trying to plot the
data, no
>>> he's
>>> giving a '0' value in my graph, so that isn't correct, there
shouldn't be
>>> any value at all...
>>> Any helps??
>>
>> Well, that's not what happens *here*. :-)
>>
>> What kind of machine? What version of IDL? Are you
>> *certain* this isn't pilot error?
>>
>> Cheers,
>>
>> David
>>
>> --
>> David Fanning, Ph.D.
>> Fanning Software Consulting, Inc.
>> Coyote's Guide to IDL Programming: http://www.dfanning.com/
Re: MISSING_VALUE [message #43344 is a reply to message #43250] Wed, 30 March 2005 05:52 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Matthias Demuzere writes:

> Now the problem has moved. When the dataset is initially read in with
> read_ascii, I get the value NaN where it should....
>
> BUT....I declare empty arrays (with zero's) in which I put a part of the
> original array. So where there is the value NaN, my new array now shows
> 0....Any solutions?
> Hope I made myself clear!

In general, setting missing values to NaN should probably be done
in the last stage of data preparation, if possible, since it is
typically MUCH easier to work with numbers than with, well, not
numbers. I would probably set the missing values from READ_ASCII
to something easily recognizable as not a valid value (e.g.
-99999.9) and do all your array manipulation with these
numbers. Then, at the end, find all the -99999.9s and turn
them into NaNs.

The only other solution you have is to find the NaNs in your
original array and set the corresponding values in your new
array to NaN. But that is harder to do:

http://www.dfanning.com/tips.check_nan.html

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: C Alignment/IDL structures
Next Topic: IDLWAVE EMACS QUESTION

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

Current Time: Wed Oct 08 15:39:40 PDT 2025

Total time taken to generate the page: 0.00684 seconds