dateRange#

geetools.ee_filter.FilterAccessor.dateRange(range)#

Filter by daterange.

Parameters:

range (ee.DateRange) – The date range to filter by.

Returns:

The filter to apply to a collection.

Return type:

ee.Filter

Examples

import ee, geetools
from geetools.utils import initialize_documentation

initialize_documentation()

# Create a collection and filter it by a date range
collection = ee.ImageCollection("LANDSAT/LC08/C02/T1_L2")

# filter by date range
range = ee.DateRange("2018-01-01", "2019-01-01")
filteredCollection = collection.filter(ee.Filter.geetools.dateRange(range))

# print the total size of the collections
print(f"landsat full collection: {collection.size().getInfo()}")
print(f"landsat filtered collection: {filteredCollection.size().getInfo()}")
landsat full collection: 1796986
landsat filtered collection: 155924