How the bits are ordered for BQA and QA

i would like to mask out the clouds for HLS and landsat-8-l1.
i referred to the following link:

but i does not provide any insight how the bits are ordered. For example,
for landsat-8-l1, the BQA has 16 bits,
1-how are they ordered?
2-which one comes first and so on?

i would like to know the answer of the latter questions 1 and 2 for HLS as it uses different band “QA”

Hi @burkhard.golla,

For Landsat-8-L1 , the BQA band in Collection 1 was a 16-bit integer, where each bit represented a different surface or atmospheric condition. However, in Collection 2 , the BQA band has been replaced with QA_PIXEL, which follows the same bit-packing logic but with improved geolocation and radiometric accuracy.

For Landsat-8-L1, the BQA (QA_PIXEL) band is a 16-bit mask. The bits are ordered from right to left , with bit 0 being the least significant. You can find the detailed structure in the USGS Landsat QA documentation .

HLS uses an 8-bit QA band, where the bits are ordered from most significant (bit 7) to least significant (bit 0) . The bit assignments are as follows:

Bits 7-6 : Aerosol level
Bit 5 : Water presence
Bit 4 : Snow/ice
Bit 3 : Cloud shadow
Bit 2 : Adjacent to cloud/shadow
Bit 1 : Cloud
Bit 0 : Cirrus (reserved, not used in HLS)

The highest-order bit (bit 7) is read first, representing aerosol levels, while the lowest-order bit (bit 0) is last. The presence of clouds, water, and shadow is determined based on their respective bit positions.

For further details, you can check the Sentinel Hub HLS documentation : HLS API Documentation and the HLS User Guide (Page 17) : HLS User Guide v2.0 (PDF).

1 Like

thank you.
for HLS, and referring to the bits order you posted there is no descripencies.

However, for landsat-8-l1, the bits order in the reference you posted are not clear because there are three tables and i do not know which one should i consider for reference.

but, i found this reference, please visit section 6.1.1, and let me know if the bits order mentioned in that section is correct:

Hi @burkhard.golla,

Thanks for your patience!

For Landsat-8-L1, I see how the multiple tables can be confusing. I checked Section 6.1.1 in the reference you provided, and the bit order in that section is correct.

Additionally, if you’re looking for the equivalent reference for Level-1 QA_PIXEL, Table 3.3 (Link) matches the same bit assignments and structure.

1 Like