1

I'm using the ee.Filter.eq function like this:

collection = ee.ImageCollection('LANDSAT/LC08/C02/T1_TOA')\
        .filterDate('2015-01-01', '2018-01-01')\
        .filter(ee.Filter.calendarRange(11, 2, 'month'))\
        .filterBounds(ee.Geometry.Point(25.8544, -18.08874))

print(collection.size().getInfo())
filtered = collection.filter(ee.Filter.eq('CLOUD_COVER', 0))
print(filtered.size().getInfo())   

I get collection size = 41 and filtered size = 2, which means I filter the ImageCollection by property 'CLOUD_COVER'. But when I use the 'propertyNames' function to look up the property:

print(collection.propertyNames().getInfo())

the output is:

['system:version', 'system:id']

There seems no 'CLOUD_COVER'. I want to get a property list containing 'CLOUD_COVER', then I can know which property I can use to filter the collection.

1 Answer 1

1

Remember that both, image collections and images have their own properties. Thus, the line collection.propertyNames() returns the image collection properties. However, to filter an image collection, you usually want to use the image properties to only return the images that match certain condition. Therefore, to show the properties of the images contained in an image collection you can use:

print(collection.first().propertyNames())

In this list you will see the 'CLOUD_COVER' property and additional ones, which you can use to construct custom filters. Finally, if you wish to consult the values of a particular property of the images contained in an image collection, you should use:

print(collection.aggregate_arrat('CLOUD_COVER'))

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.