[Numpy-discussion] Extract groups of/individual bit values from UInt16 array [SEC=UNCLASSIFIED]

Pinner, Luke Luke.Pinner@environment.gov...
Tue Oct 12 23:14:28 CDT 2010

I'm working with some MODIS satellite imagery. MODIS data includes a
quality flag mask. For the particular dataset I'm working with, this is
a two dimensional unsigned 16 bit integer array. The quality flags are
stored as one or more bits in each integer value:

Bits are numbered from 0 (least significant bit)
	Bit	Long name	Key
				00=VI produced, good quality
				01=VI produced, but check other QA
				10=Pixel produced, but most probably
				11=Pixel not produced due to other
				   than clouds
	2-5	VI usefulness
				0000=Highest quality
				0001=Lower quality
				0010=Decreasing quality
				0100=Decreasing quality
				1000=Decreasing quality
				1001=Decreasing quality
				1010=Decreasing quality
				1100=Lowest quality
				1101=Quality so low that it is not
				1110=L1B data faulty
				1111=Not useful for any other reason/not
	15	Possible shadow

Some typical values are:
61,2185,37013,36885,2185,4109,4233], dtype=numpy.uint16)

How would I extract groups of/individual bit values from such an array?

Luke Pinner

If you have received this transmission in error please notify us immediately by return e-mail and delete all copies. If this e-mail or any attachments have been sent to you in error, that error does not constitute waiver of any confidentiality, privilege or copyright in respect of information in the e-mail or attachments. 

Please consider the environment before printing this email.


More information about the NumPy-Discussion mailing list