1

Using the QA_PIXEL band in Landsat 8 to mask out clouds, cloud shadow, and land often masks out large areas of water. The QA_PIXEL band identifies these water areas as land and cloud shadow, when this is clearly not correct. An example of this is present in imagery generated by the following script, centered on Fishers Island, NY: https://code.earthengine.google.com/313daa73b1c41ea42342157a8911e5bd

The code used to generate the landmask:

var landtester = function(image){
      var landbit = 1 << 7 //Water cover is bit 7
      var qaband = image.select('QA_PIXEL');
      var landmask = qaband.bitwiseAnd(landbit).gt(0);
      return image.updateMask(landmask);
  };
var lsimg = ls8.filterBounds(roi)
                   .filter(ee.Filter.calendarRange(7,9,'month'))
                   .filter(ee.Filter.calendarRange(2013, 2013, 'year'))
                   //.filter(ee.Filter.eq('WRS_ROW',22))
                   .filter(ee.Filter.lt('CLOUD_COVER',50)).first().clip(roi);
var lsimg_lt = landtester(lsimg); Map.addLayer(lsimg_lt, "", "Landmask");

The code calls the proper bit and applies it as a mask. The issue is with the QA_PIXEL data: the incorrectly-masked water areas have a value of 23888, indicating land and high-confidence cloud shadow. There are no clouds nearby that could be casting shadow and the area is clearly water.

This effect usually occurs along the northwest edges of islands and capes. How do I mask land and cloud shadow while avoiding this apparent data quality issue?

2
  • To answer your edit comment, the Question was closed because the relevant code was not in the Question (the close reason states "When seeking help to debug/write/improve code always provide the desired behavior, a specific problem/error and the shortest code (as formatted text, not pictures) needed to reproduce it in the question body."). There is still not any code in the Question body, and is unlikely to be reopened without code.
    – Vince
    Commented Jul 1, 2022 at 14:38
  • The issue is data quality, not the code, but I have included some anyway.
    – Matt
    Commented Jul 1, 2022 at 14:51

0

Your Answer

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