ee.ImageCollection.filterMetadata

Shortcuts to filter a collection by metadata. This is equivalent to this.filter(ee.Filter.metadata(...)).

Returns the filtered collection.

UsageReturns
ImageCollection.filterMetadata(name, operator, value)Collection
ArgumentTypeDetails
this: collectionCollection

The Collection instance.

nameString

The name of a property to filter.

operatorString

The name of a comparison operator. Possible values are: "equals", "less_than", "greater_than",

"not_equals", "not_less_than", "not_greater_than", "starts_with",

"ends_with", "not_starts_with", "not_ends_with", "contains",

"not_contains".

valueObject

  - The value to compare against.

Examples

JavaScript

// Filtering an ImageCollection by metadata.

var dataset = ee.ImageCollection('COPERNICUS/S2_SR')
                  .filterDate('2020-01-01', '2020-01-02');
var filtered = dataset.filterMetadata(
    'CLOUDY_PIXEL_PERCENTAGE', 'less_than', 0.2);

print(dataset.size());   // 7156
print(filtered.size());  // 391

// ee.ImageCollection.filter is equiavalent.
var filtered2 = dataset.filter('CLOUDY_PIXEL_PERCENTAGE < 0.2');
print(filtered2.size());  // 391

Python

# Your example goes here!