containsBandNames#

geetools.ee_image_collection.ImageCollectionAccessor.containsBandNames(bandNames, filter, bandNamesProperty='system:band_names')#

Filter the ee.ImageCollection by band names using the provided filter.

Parameters:
  • bandNames (list[str] | ee.List) – List of band names to filter.

  • filter (str) – Type of filter to apply. To keep images that contains all the specified bands use "ALL". To get the images including at least one of the specified band use "ANY".

  • bandNamesProperty (str | ee.String) – the name of the property that contains the band names. Defaults to GEE native default: ‘system:band_name’.

Returns:

A filtered ee.ImageCollection

Return type:

ee.ImageCollection

Examples

import ee, geetools

collection = (
    ee.ImageCollection("LANDSAT/LC08/C01/T1_TOA")
    .filterBounds(ee.Geometry.Point(-122.262, 37.8719))
    .filterDate("2014-01-01", "2014-12-31")
)

filtered = collection.geetools.containsBandNames(["B1", "B2"], "ALL")
print(filtered.getInfo())