[GRASS-user] help to use r.mapcalc with decimal/binary (modisdata)

andrew.haywood at poyry.com andrew.haywood at poyry.com
Sun May 27 21:01:13 EDT 2007


Okay - unfortunately i am now totally confused. I have tried to read up on 
binary data (to little or no avail!!!). My understanding is the MODIS 
suf_refl_qc data that i have import is a unsigned 16 bit integer number. I 
would like to select out pixels using this raster  to create a cloud mask 
based on some of the bit codes.

for example identify " band 1 quality = missing input" would have the 
following 

 * * * * 1 0 1 1 * * * * * * * * * - where * represents placeholder

If i try and follow Glynn's logic he is saying divide the number by 16 and 
then take the modulus 16 and then equate it to "11" to get the subset. 

I am unsure how I choose the "11" and how do i change the syntax to pull 
out the different masks i may be interested in.

0 0 * * * * * * * * * * * * * *   ideal quality all bands
0 1 * * * * * * * * * * * * * * less than ideal quality
* * 0 0 * * * * * * * * * * * * clear
* * 0 1 * * * * * * * * * * * * cloudy
* * 1 0 * * * * * * * * * * * * mixed
* * * * 0 0 0 0* * * * * * * * highest quality band 1
* * * * * * * * * 0 0 0 0* * * highest quality band 2
etc...

Any help would be greatly appreciated. At this stage im plugging in the 
decimal numbers into binary calculator and using r.reclass to create a 
MASK.

best regards

Andrew








Glynn Clements <glynn at gclements.plus.com> 
Sent by: grassuser-bounces at grass.itc.it
05/28/2007 09:14 AM

To
Hamish <hamish_nospam at yahoo.com>
cc
grassuser at grass.itc.it
Subject
Re: [GRASS-user] help to use r.mapcalc with decimal/binary (modis data)







Hamish wrote:

> > Oops; I could have sworn that r.mapcalc understood hex. Sorry; you'll
> > need to use decimal values, e.g.
> > 
> > r.mapcalc MASK="if(sur_refl_qc_250 & 240 == 176 , 1, null())"
> 
> so r.mapcalc can do bitwise & |? (nothing about that in the help pages)

Damn, no, that neither.

Third attempt:

                 r.mapcalc MASK="if((sur_refl_qc_250 / 16) % 16 == 11 , 1, 
null())"

I'll look at adding the missing functionality to r.mapcalc.

-- 
Glynn Clements <glynn at gclements.plus.com>

_______________________________________________
grassuser mailing list
grassuser at grass.itc.it
http://grass.itc.it/mailman/listinfo/grassuser



This email and any files transmitted with it are confidential, may be legally privileged and are intended solely for the use of the individual or entity to whom they are addressed. If you are not the intended recipient, you are hereby notified that any use, distribution, or reproduction of the contents of this email is strictly prohibited and may be unlawful. If you are not the intended recipient, please notify the sender by return email and destroy all copies of the original message including any attachments thereto. 
Thank you.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/grass-user/attachments/20070528/79569319/attachment.html


More information about the grass-user mailing list