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

Home » Public Forums » archive » Re: BYTSCL and NAN keyword
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: BYTSCL and NAN keyword [message #38280 is a reply to message #38279] Tue, 02 March 2004 09:18 Go to previous messageGo to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Kenneth Bowman writes:

> Has anyone else noticed this problem with BYTSCL and the NAN keyword?
>
> The BYTSCL function scales integers and floats into bytes between 0 and
> 255 (or the value set by the TOP keyword). If the NAN keyword is set,
> NANs in the input array are set to 0 in the output array. But 0 falls
> into the valid range for good values (0 to TOP)!
>
> Because it is not possible to set NANs to a value outside the valid
> range (greater than TOP), it is not possible to distinguish missing from
> valid data.
>
> As best I can tell, the only solution is to not use the NAN keyword and
> scale the valid data only by using WHERE to find all the valid values.
> Am I missing something obvious? (Quite possible, I admit.)

Well, NANs are definitely floats (that is, they have a float-type
bit pattern). So it seems reasonable to me that if you are
trying to stuff it into a byte (which can only have values between
0 and 255, that 0 is a good choice. (The only possible other
choice is 255, but that just turns your problem on its head.)

I think what I would do is locate the NANs and save their
indices. Then scale my data into 255 colors (0 to 254), leaving
color index 255 for the NAN color (whatever that is). This will
take a couple of steps, but that's what IDL programs are for. :-)

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting
Coyote's Guide to IDL Programming: http://www.dfanning.com/
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: 2D-fit
Next Topic: FastDL: An MPI interface for IDL

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

Current Time: Sat Nov 29 15:07:37 PST 2025

Total time taken to generate the page: 0.00271 seconds