Mosaic Same Day

Images inside an ImageCollection that where taken in the same day are fusioned into one image using a reducer (default: mean). The resulting images will have 2 properties only:

  • system:time_start
  • system:footprint (this will contain the fusioned geometries)

In [11]:
import ee
ee.Initialize()

In [12]:
from geetools import tools

In [13]:
import geedatasets

In [14]:
import ipygee as ui

In [15]:
Map = ui.Map()
Map.show()



In [16]:
sat = geedatasets.sentinel.Sentinel2SR()

In [17]:
vis = sat.visualization('NSR')

In [18]:
p = ee.Geometry.Point([-72, -42])

In [19]:
col = sat.collection().filterBounds(p).filterDate('2019-01-01', '2019-05-01')

In [20]:
ui.eprint(col.size())



In [21]:
# Get dates
def get_dates(col):
    dates = ee.List(col.toList(col.size()).map(lambda img: ee.Image(img).date().format()))
    return dates

ui.eprint(get_dates(col))



In [22]:
mosaics = tools.imagecollection.mosaicSameDay(col)

In [23]:
ui.eprint(mosaics.size())



In [24]:
ui.eprint(get_dates(mosaics))



In [25]:
Map.addImageCollection(col.limit(2), vis)

In [26]:
Map.addLayer(mosaics.first(), sat.visualization('NSR'), 'Day 1 mosaicked')

In [27]:
Map.addLayer(mosaics.first().geometry(), name='Footprint day 1 mosaicked')