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

Home » Public Forums » archive » Re: help with reading unsigned 16-bit integers
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: help with reading unsigned 16-bit integers [message #57453 is a reply to message #57452] Sun, 09 December 2007 12:12 Go to previous messageGo to previous message
teich is currently offline  teich
Messages: 33
Registered: May 2007
Member
On Dec 9, 9:59 am, David Fanning <n...@dfanning.com> wrote:
> dcl...@gmail.com writes:
>> Try using ISHFT to create a mask that you will use to determine (by
>> using a bitwise AND) if/where given bits are set:
>> Taking your example for the 2-'cloud' bit:
>>> cloudmask = ISHFT(1,2)
>>> cloudy = FEATURE_CLASSIFICATION_FLAGS AND cloudmask
>> The resulting "CLOUDY" variable will be nonzero where the 2-'cloud'
>> bit is set.
>> combine with other bits as needed.
>
> Here is an article that might give you some help with
> how to use ISHFT:
>
> http://www.dfanning.com/code_tips/convert24to8.html
>
> This is essentially what you want to do with your
> value.
>
> 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.")

Hmmm,

Still not sure what's going on.

If I pick a value:

> myval= FEATURE_CLASSIFICATION_FLAGS(10,20)
> print,binary(fix(myval))
0 1 0 0 0 0 0 0 0 0 0 1 1 1 0 1

Then is it safe to say that bits 1 to 3 represent 1*2^0 + 0*2^1 +
1*2^2 = 3. So then I know it's not cloud since cloud is '2'? Bits
1-3 can take on any values '0' to '7', '2' being cloud. Documentation
also says that bits 4 through 5 take on values '0' to '3'. So in the
above, I would do 1*2^0 + 1*2^1 = 3? Bits 6 to 7 can also take on
values from '0' to '3', ... bits 14 to 16 can take on values from '0'
to '5' so in the above, bits 14 to 16 give a value of 2?

For bits 14 to 16, if I do

print,ishft((fix(myval)),-13) I also get a value of 2 so I think this
is what your saying to do here?

Thanks,

Howard
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: how to increase dpi of an IPLOT?
Next Topic: Re: Subversion in IDL Workbench

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

Current Time: Sun Oct 12 05:58:10 PDT 2025

Total time taken to generate the page: 0.16231 seconds