Cloud free composite
In [1]:
Copied!
import ee
import geemap
import ee
import geemap
In [2]:
Copied!
Map = geemap.Map()
Map
Map = geemap.Map()
Map
Out[2]:
Make this Notebook Trusted to load map: File -> Trust Notebook
In [3]:
Copied!
states = ee.FeatureCollection('TIGER/2018/States')
TN = states.filter(ee.Filter.eq("NAME", "Tennessee"))
Map.addLayer(TN, {}, "Tennessee")
states = ee.FeatureCollection('TIGER/2018/States')
TN = states.filter(ee.Filter.eq("NAME", "Tennessee"))
Map.addLayer(TN, {}, "Tennessee")
In [4]:
Copied!
years = ee.List.sequence(2013, 2020)
years.getInfo()
years = ee.List.sequence(2013, 2020)
years.getInfo()
Out[4]:
[2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020]
In [5]:
Copied!
def yearly_image(year):
start_date = ee.Date.fromYMD(year, 1, 1)
end_date = start_date.advance(1, "year")
collection = (
ee.ImageCollection('LANDSAT/LC08/C01/T1')
.filterDate(start_date, end_date)
.filterBounds(TN)
)
image = ee.Algorithms.Landsat.simpleComposite(collection).clipToCollection(TN)
return image
def yearly_image(year):
start_date = ee.Date.fromYMD(year, 1, 1)
end_date = start_date.advance(1, "year")
collection = (
ee.ImageCollection('LANDSAT/LC08/C01/T1')
.filterDate(start_date, end_date)
.filterBounds(TN)
)
image = ee.Algorithms.Landsat.simpleComposite(collection).clipToCollection(TN)
return image
In [6]:
Copied!
images = years.map(yearly_image)
images = years.map(yearly_image)
In [7]:
Copied!
vis_params = {'bands': ['B5', 'B4', 'B3'], 'max': 128}
vis_params = {'bands': ['B5', 'B4', 'B3'], 'max': 128}
In [8]:
Copied!
for index in range(0, 8):
image = ee.Image(images.get(index))
layer_name = "Image " + str(index + 2013)
Map.addLayer(image, vis_params, layer_name)
for index in range(0, 8):
image = ee.Image(images.get(index))
layer_name = "Image " + str(index + 2013)
Map.addLayer(image, vis_params, layer_name)
Last update:
2022-03-25