Example1: temporal animation on Sentinel2 image collection
map = Map(center=[45.81, 8.628], zoom=14)
map
coll = inter.ImageCollection("S2")
coll = coll.filterOnGeoName("Ispra")
coll = coll.filterOnDate(2016,1,1, 2017,6,16)
coll = coll.filterOn("cloudcover", "<=", 5)
coll = coll.filterOn("jrc_filepath", "<>", "")
def getprocessing(collection):
return collection.process().bands("B04","B03","B02",0.8).opacity(255)
inter.exportTemporalGIF(coll,map,getprocessing,"IspraAnimation.gif")
Example2: temporal animation on NDVI image collection with custom color palette
map = Map(center=[45.81, 8.628], zoom=6)
map
coll = inter.ImageCollection("NDVI")
coll = coll.filterOnDate(2000,1,1,2000,12,31)
def getprocessing(collection):
p = collection.process()
colors = ["Red", "Orange", "Yellow", "Green", "#005500"]
p.colorCustom(colors)
return p
inter.exportTemporalGIF(coll,map,getprocessing,"NDVI.gif",1000)
Example3: custom animation with moving window
map = Map(center=[45.81, 8.628], zoom=14)
map
coll = inter.ImageCollection("S2")
coll = coll.filterOnGeoName("Ispra")
coll = coll.filterOnDate(2016,1,1, 2017,6,16)
coll = coll.filterOn("cloudcover", "<=", 5)
coll = coll.filterOn("jrc_filepath", "<>", "")
coll.sort("cloudcover")
coll.limit(4)
p = coll.process().bands("B04","B03","B02",0.8)
import sys
def exportMovingGIF(coll,map,process,frames,filename,delay=1000):
(latmin,lonmin),(latmax,lonmax) = map.getExtent()
zoom = map.zoom
dx = (lonmax - lonmin)/frames
for frame in range(1,frames+1):
print "writing frame " + str(frame)
sys.stdout.flush()
if frame == 1:
coll.exportAnimationStart(process,lonmin,latmin,lonmax,latmax,zoom,filename,delay)
else:
coll.exportAnimationAdd(process,lonmin,latmin,lonmax,latmax,zoom)
lonmin += dx
lonmax += dx
coll.exportAnimationClose()
return True
exportMovingGIF(coll,map,p,50,"moving.gif",500)
Example4: big dimension animation over Maussane area with Sentinel-2a and Sentinel-2B data
from ipywidgets import Layout
from IPython.core.display import display, HTML
display(HTML("<style>.container { width:100% !important; }</style>"))
map = Map(layout=Layout(height='1200px'))
map.zoomToExtent(inter.search("Maussane"))
map
coll = inter.ImageCollection("S2")
coll = coll.filterOnDate(2017,3,1, 2017,12,31) # S2B launch date: 7/3/17
coll = coll.filterOn("cloudcover", "<=", 20)
coll = coll.filterOn("jrc_filepath", "<>", "")
coll = coll.filterOnGeoName("Maussane", 0, "FR")
coll.limit(100)
coll.sort("cloudcover",True)
p = coll.process().bands("B04","B03","B02",2.0).opacity(255).optimizeStats(True)
pDEM = inter.ImageCollection("DEM").process()
pDEM.parameter("mode","hillshade")
pDEM.parameter("azimuth","45.0")
pDEM.parameter("elevation","45.0")
pDEM.parameter("lighting","1.5")
pDEM.parameter("zfactor","1.0")
pDEM.range(0,325,1,255)
def getprocessingPlain(collection):
return collection.process().bands("B04","B03","B02",2.0)
def getprocessingBlend(collection):
return collection.process().bands("B04","B03","B02",2.0).blend(pDEM,100)
print "Generating plain S2 animation GIF"
inter.exportTemporalGIF(coll,map,getprocessingPlain,"MaussanePlain.gif",1000)
print "Generating S2 blended with DEM animation GIF"
inter.exportTemporalGIF(coll,map,getprocessingBlend,"MaussaneBlend.gif",1000)