1

I downloaded a composite using code given below, but all values are not looking like surface reflectance values (0..1), but range from 200 to 700, for example (like raw data digital numbers). Or am I wrong with such justification?

// Define AOI
var region = ee.Geometry.Polygon(
  [[[29.78, 51.42],
    [29.78, 51.13],
    [30.61, 51.13],
    [30.61, 51.42]]], null, false);

/**
 * Function to mask clouds based on the pixel_qa band of Landsat 8 SR data.
 * @param {ee.Image} image input Landsat 8 SR image
 * @return {ee.Image} cloudmasked Landsat 8 image
 */
function maskL8sr(image) {
  // Bits 3 and 5 are cloud shadow and cloud, respectively.
  var cloudShadowBitMask = (1 << 3);
  var cloudsBitMask = (1 << 5);
  // Get the pixel QA band.
  var qa = image.select('pixel_qa');
  // Both flags should be set to zero, indicating clear conditions.
  var mask = qa.bitwiseAnd(cloudShadowBitMask).eq(0)
    .and(qa.bitwiseAnd(cloudsBitMask).eq(0));
  return image.updateMask(mask);
}

var collection_2017 = ee.ImageCollection('LANDSAT/LC08/C01/T1_SR')
  .filterBounds(region)
  .filterDate('2017-05-20', '2017-09-20')
  .map(maskL8sr);

Export.image.toDrive({
  image: collection_2017.mean().clip(region),
  description: 'Landsat_Chernobyl_2017',
  region:region,
  scale: 30,
  crs: 'EPSG:32636'});

And how to specify cloud masking threshold? I have a function in this code but I am not sure how it masks clouds.

1 Answer 1

1

Please see the Landsat 8 surface reflectance product guide from USGS, which can answer your questions in detail. The following is a summary.

  • Data values: the reflectance fraction is scaled by 10,000 so that the data can be distributed as Int16 type to reduce file size. To unscale these data: image.divide(10000)

  • Cloud masking: the surface reflectance product includes the pixel_qa band, which is a classified layer produced by the CFmask algorithm that identifies pixel condition as: clear, cloud, cloud shadow, snow, or water. Note that the classification is bit coded. The above code will mask out cloud and cloud shadow pixels.

3
  • Justin, thank you! Meanwhile, I have got the same answer from a colleague. Jan 9, 2020 at 10:35
  • That's great, Maksym. Could you kindly accept the answer then to clear this question from the list of unanswered questions - thanks. Jan 9, 2020 at 15:03
  • Done. Thank you again. Could you check this my question? gis.stackexchange.com/questions/339212/… I guess you could have some suggestions (if having some free time). Jan 9, 2020 at 23:22

Your Answer

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

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