reduceInterval#

geetools.ee_image_collection.ImageCollectionAccessor.reduceInterval(reducer='mean', unit='month', duration=1)#

Reduce the images included in the same duration interval using the provided reducer.

For example using unit as “month” and duration as 1, the ee.ImageCollection will be reduced into a new ee.ImageCollection with each image containing the reduced values for each month. Make sure the collection is filtered beforehand to reduce the number of images that needs to be processed.

Parameters:
  • reducer (str | ee.Reducer) – The name of the reducer to use or a Reducer object. Default is "mean".

  • unit (str) – The unit of time to split the collection. Available units: year, month, week, day, hour, minute or second.

  • duration (int) – The duration of each split.

Returns:

A new ee.ImageCollection with the reduced images.

Return type:

ee.ImageCollection

Examples

import ee, geetools

ee.Initialize()

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

reduced = collection.geetools.reduceInterval("mean", "month", 1)
print(reduced.getInfo())