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

andrew.haywood at poyry.com andrew.haywood at poyry.com
Thu May 24 18:49:43 EDT 2007

Dear All,

i am having some issues with analysing  MOD09 modis data in grass.  I 
would like to mask out the cloud pixels using the below quality control 
when i import this band the unsigned 16bit integer is converted in decimal 
and I am unsure how to  use r.mapcalc to create a mask based on the 
different bits. 

I am unsure how I should go about this (see *** section below). I would 
like to try different selections to see which would make the best mask but 
i am unsure how to do this against a binary field 

eg. r.mapcalc MASK="if(sur_refl_qc_250 == **** clear state **** , 1, 

how do I select out the different bits to create the mask?

At this stage i am thinking of trying to convert the decimal back to 
binary (not sure how to do this ) and then subselect columns (bits) eg 0-1 
or 2-3 and the placing an if statement (eg. if column01 == "00" or if 
column23 = "00").

Any guidance would be much appreciated.

kind regards



00 -- corrected product produced at ideal quality -- all bands
01 -- corrected product produced, less than ideal quality -- some or all 
10 -- corrected product not produced due to cloud effects -- all bands
11 -- corrected product not produced for other reasons -- some or all 
bands, may be fill value
[Note that a value of (11) overrides a value of (01)]
cloud state;
00 -- clear
01 -- cloudy
10 -- mixed
11 -- not set, assumed clear
band 1 data quality, four bit range;
0000 -- highest quality
1000 -- dead detector; data has been copied from adjacent detector
1001 -- solar zenith >= 86 degrees
1010 -- solar zenith >= 85 and < 86 degrees
1011 -- missing input
1100 -- internal constant used in place of climatological data for at 
least one atmospheric constant
1101 -- correction out of bounds, pixel constrained to extreme allowable 
1110 -- L1B data faulty
1111 -- not processed due to deep ocean or clouds
band 2 data quality, four bit range;
(same values as above)
atmospheric correction performed;
0 -- no
1 -- yes
adjacency correction performed;
0 -- no
1 -- yes
different orbit from 500m;
0 -- no
1 -- yes
unused (spare)

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/20070525/fe64bad7/attachment.html

More information about the grass-user mailing list