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 #57451] Sun, 09 December 2007 12:57 Go to previous message
teich is currently offline  teich
Messages: 33
Registered: May 2007
Member
On Dec 9, 3:46 pm, David Fanning <n...@dfanning.com> wrote:
> te...@atmsci.msrc.sunysb.edu writes:
>> 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?
>
> Ok, you have a value:
>
> IDL> val = 16413
> IDL> Print, Binary(val)
> 0 1 0 0 0 0 0 0 0 0 0 1 1 1 0 1
>
> You want to know the value of the first three bits:
>
> IDL> Print, val AND (2L^3-1)
> 5
>
> You want to know the value of bits 4 and 5:
>
> IDL> Print, ISHFT(val AND (2L^3 + 2L^4), -3)
> 3
>
> You want to know the value of bits 14-16:
>
> IDL> Print, ISHFT(val AND (2L^13 + 2L^14 + 2L^15), -13)
> 2
>
> 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.")- Hide quoted text -
>
> - Show quoted text -

Ah! Starting to make sense! 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: Sat Oct 11 06:01:51 PDT 2025

Total time taken to generate the page: 1.67918 seconds