ee_extra.ImageCollection.core.closest#
- ee_extra.ImageCollection.core.closest(x, date, tolerance=1, unit='month')[source]#
Gets the closest image (or set of images if the collection intersects a region that requires multiple scenes) to the specified date.
- Parameters:
x (
ImageCollection
) – Image Collection from which to get the closest image to the specified date.date (
Union
[Date
,str
]) – Date of interest. The method will look for images closest to this date.tolerance (
Union
[float
,int
]) – Filter the collection to [date - tolerance, date + tolerance) before searching the closest image. This speeds up the searching process for collections with a high temporal resolution.unit (
str
) – Units for tolerance. Available units: ‘year’, ‘month’, ‘week’, ‘day’, ‘hour’, ‘minute’ or ‘second’.
- Return type:
ImageCollection
- Returns:
Closest images to the specified date.
Examples
>>> import ee >>> from ee_extra.ImageCollection.core import closest >>> ee.Initialize() >>> S2 = ee.ImageCollection('COPERNICUS/S2_SR') >>> closest(S2,'2018-01-23')