On Lab 6: Time series analysis from https://developers.google.com/earth-engine/edu, there is maskClouds:

var maskClouds = function(image) {
  var quality = image.select('BQA');
  var cloud01 = quality.eq(61440);
  var cloud02 = quality.eq(53248);
  var cloud03 = quality.eq(28672);
  var mask = cloud01.or(cloud02).or(cloud03).not();
  return image.updateMask(mask);

While in Lab 1: Intro to Remote Sensing and EE, clouds are filtered with a different approach:

// Sort the collection by a metadata property.

// Get the first image out of this collection.

When should I use each of these approaches?

2 Answers 2


The cloud masking you provided removes individual pixels that are considered to be clouds. You keep the whole image and just set cloud pixels to no data.

Filtering for clouds in this case is looking at the metadata properties associated with each image and removing whole images if it does not meet the criteria (or sorting based on the criteria).

The difference is that the masking operations are done on individual pixels and filtering/sorting operations are done on whole images.


Both labs are based on different Landsat input data collections. You should use the method that works with the bands/metadata of the collection you are planning to use:

Lab 1:

Search for 'landsat 8 raw' and import the 'USGS Landsat 8 Collection 1 Tier 1 Raw Scenes' ImageCollection

Lab 6:

Search for Landsat 8 TOA and import the "USGS Landsat 8 TOA Reflectance (Orthorectified)"

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.