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

Home » Public Forums » archive » Re: Bits & Bytes
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: Bits & Bytes [message #57894] Tue, 08 January 2008 05:37
jujo is currently offline  jujo
Messages: 8
Registered: May 2007
Junior Member
Thank you Ingo and Allard...
That is not really difficult to do now... I got to make the 1/0 mask.
Best!
Jurandir
Re: Bits & Bytes [message #57895 is a reply to message #57894] Tue, 08 January 2008 04:40 Go to previous message
wita is currently offline  wita
Messages: 43
Registered: January 2005
Member
On Jan 8, 12:46 pm, j...@argentina.com wrote:
> Hello there...
> I'm sorry if my question is too basic. I'm working with 8 bits Spot
> Vegetation images. I have two bands:
>
> 1-NDVI data
> 2-Status Map (information about clouds, water, snow...)
>
> I need to apply the status map on the NDVI data, because I need to
> flag cloud and snow pixels.
>
> Below I have some information about the status map.
>
> From MSB to LSB
>
> Bit NR 7 (MSB): radiometric quality for B0 coded as 0 if bad and 1 if
> good
> Bit NR 6: radiometric quality for B2 coded as 0 if bad and 1 if good
> Bit NR 5: radiometric quality for B3 coded as 0 if bad and 1 if good
> Bit NR 4: radiometric quality for MIR coded as 0 if bad and 1 if good
> quality
> Bit NR 7 - 4: coded as 0 for 'no data', missing lines, sea on VGT-S
> products, adjacent blind or defective MIR detectors, interpolated
> data, saturated data, negative data after atmospheric correction
> Bit NR 3: land (code 1) or water (code 0), computed from the "Digital
> Chart of the Worlds"
> Bit NR 2: ice/snow (code 1) , code 0 if there is no ice/snow, computed
> from thresholds from reflectances
> Bit NR1: 0 0 1 1
> Bit NR0: 0 1 0 1
>
> (LSB): clear shadow uncertain cloud
>
> My question is: how can I use the status map to flag cloud and snow
> pixels? I'm reading them into ENVI, but I can't understand the byte
> numbers.
>
> Any comments very welcome.
> Best!
> Jurandir

Dear Jurandir,

You can easily convert a particular bitposition into a 0/1 mask
showing whether that bit was switched on or off using the following
function (this assumes bit nr from left to right, so binary value
10000000 = 128):

FUNCTION map_bitwise_flag, statusmap, bitposition
return, BYTE((statusmap AND (2^bitposition))/(2^bitposition))
END

You can easily test this:
d = byte(dist(250))
tvscl, d
r = map_bitwise_flag(d, 3)
tvscl, r

The simples way to apply such a function in ENVI is through the
bandmath option. So you first compile the module in ENVI, then in the
box labeled as "Enter an expression", you enter 'map_bitwise_flag(b1,
7)' in order to create a binary mask for the radiometric quality
status of B0. You then assign the statusmap to variable b1.

with best regards,

Allard
Re: Bits & Bytes [message #57896 is a reply to message #57895] Tue, 08 January 2008 04:29 Go to previous message
Ingo von Borstel is currently offline  Ingo von Borstel
Messages: 54
Registered: September 2006
Member
Hi,
> I need to apply the status map on the NDVI data, because I need to
> flag cloud and snow pixels.

> From MSB to LSB

> Bit NR 7 (MSB): radiometric quality for B0 coded as 0 if bad and 1 if
> good
(...)

So, I assume you have a complete map where the single bytes contain
these data. In order to extract whether the n-th bit is set do something
along this line

icemap = (statusmap and 2^n) GE 1

The result will be a byte array which contains one, if the n-th bit is
set and 0 if it isn't set. I guess you want to use n=2

Regards,
Ingo

--
Ingo von Borstel <newsgroups@planetmaker.de>
Public Key: http://www.planetmaker.de/ingo.asc

If you need an urgent reply, replace newsgroups by vgap.
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Bits & Bytes
Next Topic: Re: Window IDLDE 7.0 text copy idiosyncrasy

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

Current Time: Wed Oct 08 17:11:00 PDT 2025

Total time taken to generate the page: 0.00741 seconds