Initialize Earth Engine


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

Python Package Imports


In [2]:
from IPython.display import Image

Code


In [3]:
img = ee.Image('MOD09GA/MOD09GA_005_2012_03_09')
ndvi = img.normalizedDifference(['sur_refl_b02', 'sur_refl_b01'])

Display MODIS bands 1/4/3


In [4]:
point = ee.Geometry.Point(-120, 34.5)
region = point.buffer(100000).bounds().getInfo()['coordinates']

img143 = img.select(['sur_refl_b01', 'sur_refl_b04', 'sur_refl_b03'])
url = img143.getThumbUrl({
    'gain':'0.1, 0.1, 0.1',
    'region':region
  })
Image(url=url)


Out[4]:

Display NDVI


In [5]:
palette = ','.join(['FFFFFF', 'CE7E45', 'DF923D', 'F1B555', 'FCD163', '99B718',
               '74A901', '66A000', '529400', '3E8601', '207401', '056201',
               '004C00', '023B01', '012E01', '011D01', '011301'])
url = ndvi.getThumbUrl({
    'palette':palette,
    'min':0,
    'max':1,
    'region':region
  })
Image(url=url)


Out[5]:

In [ ]: