3

I am currently trying to obtain images that have less than 70% cloud cover (for example) and I have come across multiple variations of the same. Could you tell me what is the difference between these three approaches and which approach might be most suitable for obtaining a set of least cloudy images?

Approach 1:

var collection = ee.ImageCollection("COPERNICUS/S2")
  .filterBounds(geometry)
  .filterMetadata('CLOUDY_PIXEL_PERCENTAGE', 'less_than', 70);

Approach 2:

var collection = ee.ImageCollection("COPERNICUS/S2")
  .filterBounds(geometry)
  .sort('CLOUDY_PIXEL_PERCENTAGE', false);

Approach 3:

var collection = ee.ImageCollection("COPERNICUS/S2")
  .filterBounds(geometry)
  .filter(ee.Filter.lte('CLOUDY_PIXEL_PERCENTAGE', 70);
4

Approach 1: all images in the collection within bounds that have less than 70%

Approach 2: keeps all the images within the bounds, but sorts them by descending order (most cloudy first)

Approach 3: all images in the collection within bounds that have less than or equal to 70%

However, between filterMetadata() (A1) and filter(ee.Filter()) (A3) the result is the same. The docs to this.filterMetadata() shows that it is equivalent to ee.Filter()

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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