1

I have written a Bitmask for Landsat 8 scenes in Google Earth Engine, and while I believe it's correct I don't know how to check, and am not sure I understand Bitmasks well enough to be confident I'm right.

How do I evaluate this code and/or where is there a resource that could help?

My code is

var maskCloud =function(image){
  var qa = image.select('QA_PIXEL');
  var mask = qa.bitwiseAnd(1<<1).eq(0)
        .and(qa.bitwiseAnd(1<<2).eq(0)
        .and(qa.bitwiseAnd(1<<3).eq(0)
        .and(qa.bitwiseAnd(1<<4).eq(0))))
  return image.updateMask(mask)
};

With reference to:

QA_PIXEL Bitmask    

    Bit 0: Fill
    Bit 1: Dilated Cloud
    Bit 2: Cirrus (high confidence)
    Bit 3: Cloud
    Bit 4: Cloud Shadow
    Bit 5: Snow
    Bit 6: Clear
        0: Cloud or Dilated Cloud bits are set
        1: Cloud and Dilated Cloud bits are not set 
    Bit 7: Water
    Bits 8-9: Cloud Confidence
        0: None
        1: Low
        2: Medium
        3: High 
    Bits 10-11: Cloud Shadow Confidence
        0: None
        1: Low
        2: Medium
        3: High 
    Bits 12-13: Snow/Ice Confidence
        0: None
        1: Low
        2: Medium
        3: High 
    Bits 14-15: Cirrus Confidence
        0: None
        1: Low
        2: Medium
        3: High 
strangecharm
  • 186
  • 11

0 Answers0