0

I'm aware that there are a lot of questions already on this topic, however, I could not find an answer to my problem.

For a project, I need to use a script with a cloud masking procedure written by someone else. I am using Landsat 8 Surface Reflectance Tier 1 Level 2 data, which is subsequently masked using the QA_PIXEL-band of the image collection. According to the documentation, the QA_PIXEL-band stores the 'pixel quality attributes generated from the CFMASK algorithm', which is a well-documented algorithm to mask clouds.

To my knowledge, the CFMASK algorithm classifies every pixel in quality categories which are encoded in bits in this attribute. The meaning of the numbers in this attribute can be decoded using for instance this table from this document:

pixel quality table

Now, if I compare the numbers in the remap() operation below with the table, I can only conclude that they don't match. How can I interpret what is exactly masked with the numbers in the remap() operation below?

var MySubset = ee.FeatureCollection([ee.Feature(ee.Geometry.Polygon(
    [[-119.49464510322251,36.787477097017394],
    [-119.4946158918971,36.78657647827033],
    [-119.49349620848386,36.78660000585703],
    [-119.49352542003598,36.78750055592591],
    [-119.49464510322251,36.787477097017394]]), {sample_id : 1376505}),
    ee.Feature(ee.Geometry.Polygon(
      [[-120.0301812906031,36.732399470516334],
      [-120.03021603353382,36.73149918912018],
      [-120.02909755358219,36.73147126125997],
      [-120.02906281036383,36.73237154904714],
      [-120.0301812906031,36.732399470516334]]), {sample_id : 1376091})
    ]);

var dataset = ee.ImageCollection("LANDSAT/LC08/C02/T1_L2")
    .filterDate('2020-03-18','2021-08-15').filterBounds(MySubset)
    .sort("system:time_start");

var cloudfree = dataset.map(function(image) {
    var initial = image.select('SR_B3').toInt16().mask(image.select('QA_PIXEL')
      .remap([5440,21824,21888,21952,22080,22144,30048,54596,54852],[1,1,1,1,1,1,1,1,1],0));
    return initial.copyProperties(initial,ee.List(['system:time_start']));
  });

1 Answer 1

1

The numbers in your function appear to be for the Level 1 product, not the level 2 (surface reflectance) product.

enter image description here See: https://www.usgs.gov/media/images/landsat-8-quality-assessment-band-attributes-and-possible-values

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.