62 time slider
In [1]:
Copied!
import ee
import geemap
import ee
import geemap
In [2]:
Copied!
# geemap.update_package()
# geemap.update_package()
Visualizing weather data¶
In [3]:
Copied!
Map = geemap.Map()
collection = (
ee.ImageCollection('NOAA/GFS0P25')
.filterDate('2018-12-22', '2018-12-23')
.limit(24)
.select('temperature_2m_above_ground')
)
vis_params = {
'min': -40.0,
'max': 35.0,
'palette': ['blue', 'purple', 'cyan', 'green', 'yellow', 'red'],
}
first_image = collection.first()
Map.addLayer(first_image, vis_params, "First image", False)
Map.setCenter(-0.3490, 25.7900, 2)
Map
Map = geemap.Map()
collection = (
ee.ImageCollection('NOAA/GFS0P25')
.filterDate('2018-12-22', '2018-12-23')
.limit(24)
.select('temperature_2m_above_ground')
)
vis_params = {
'min': -40.0,
'max': 35.0,
'palette': ['blue', 'purple', 'cyan', 'green', 'yellow', 'red'],
}
first_image = collection.first()
Map.addLayer(first_image, vis_params, "First image", False)
Map.setCenter(-0.3490, 25.7900, 2)
Map
Out[3]:
Make this Notebook Trusted to load map: File -> Trust Notebook
In [4]:
Copied!
labels = [str(n).zfill(2) + ":00" for n in range(0, 24)]
print(labels)
labels = [str(n).zfill(2) + ":00" for n in range(0, 24)]
print(labels)
['00:00', '01:00', '02:00', '03:00', '04:00', '05:00', '06:00', '07:00', '08:00', '09:00', '10:00', '11:00', '12:00', '13:00', '14:00', '15:00', '16:00', '17:00', '18:00', '19:00', '20:00', '21:00', '22:00', '23:00']
In [5]:
Copied!
Map.add_time_slider(collection, vis_params, labels=labels, time_interval=1, opacity=0.8)
Map.add_time_slider(collection, vis_params, labels=labels, time_interval=1, opacity=0.8)
--------------------------------------------------------------------------- AttributeError Traceback (most recent call last) Input In [5], in <cell line: 1>() ----> 1 Map.add_time_slider(collection, vis_params, labels=labels, time_interval=1, opacity=0.8) AttributeError: 'Map' object has no attribute 'add_time_slider'
Visualizing vegetation data¶
In [6]:
Copied!
Map = geemap.Map()
collection = (
ee.ImageCollection('MODIS/MCD43A4_006_NDVI')
.filter(ee.Filter.date('2018-04-01', '2018-05-01'))
.select("NDVI")
)
vis_params = {
'min': 0.0,
'max': 1.0,
'palette': [
'FFFFFF',
'CE7E45',
'DF923D',
'F1B555',
'FCD163',
'99B718',
'74A901',
'66A000',
'529400',
'3E8601',
'207401',
'056201',
'004C00',
'023B01',
'012E01',
'011D01',
'011301',
],
}
first_image = collection.first()
Map.addLayer(first_image, vis_params, "First image", False)
Map.setCenter(-7.03125, 31.0529339857, 2)
Map
Map = geemap.Map()
collection = (
ee.ImageCollection('MODIS/MCD43A4_006_NDVI')
.filter(ee.Filter.date('2018-04-01', '2018-05-01'))
.select("NDVI")
)
vis_params = {
'min': 0.0,
'max': 1.0,
'palette': [
'FFFFFF',
'CE7E45',
'DF923D',
'F1B555',
'FCD163',
'99B718',
'74A901',
'66A000',
'529400',
'3E8601',
'207401',
'056201',
'004C00',
'023B01',
'012E01',
'011D01',
'011301',
],
}
first_image = collection.first()
Map.addLayer(first_image, vis_params, "First image", False)
Map.setCenter(-7.03125, 31.0529339857, 2)
Map
Out[6]:
Make this Notebook Trusted to load map: File -> Trust Notebook
In [7]:
Copied!
Map.add_time_slider(collection, vis_params, time_interval=1)
Map.add_time_slider(collection, vis_params, time_interval=1)
--------------------------------------------------------------------------- AttributeError Traceback (most recent call last) Input In [7], in <cell line: 1>() ----> 1 Map.add_time_slider(collection, vis_params, time_interval=1) AttributeError: 'Map' object has no attribute 'add_time_slider'
Visualizing Landsat imagery¶
In [8]:
Copied!
Map = geemap.Map()
bands = ['B1', 'B2', 'B3', 'B4', 'B5', 'B7']
image = ee.Image('LE7_TOA_5YEAR/1999_2003').select(bands)
vis_params = {'min': 20, 'max': 200, 'gamma': 2.0}
Map.add_time_slider(image, vis_params, time_interval=1)
Map
Map = geemap.Map()
bands = ['B1', 'B2', 'B3', 'B4', 'B5', 'B7']
image = ee.Image('LE7_TOA_5YEAR/1999_2003').select(bands)
vis_params = {'min': 20, 'max': 200, 'gamma': 2.0}
Map.add_time_slider(image, vis_params, time_interval=1)
Map
--------------------------------------------------------------------------- AttributeError Traceback (most recent call last) Input In [8], in <cell line: 7>() 4 image = ee.Image('LE7_TOA_5YEAR/1999_2003').select(bands) 5 vis_params = {'min': 20, 'max': 200, 'gamma': 2.0} ----> 7 Map.add_time_slider(image, vis_params, time_interval=1) 8 Map AttributeError: 'Map' object has no attribute 'add_time_slider'
Visualizing Sentinel-2 imagery¶
In [9]:
Copied!
Map = geemap.Map(center=[37.75, -122.45], zoom=12)
S2 = (
ee.ImageCollection('COPERNICUS/S2_SR')
.filterBounds(ee.Geometry.Point([-122.45, 37.75]))
.filterMetadata('CLOUDY_PIXEL_PERCENTAGE', 'less_than', 10)
)
vis_params = {"min": 0, "max": 4000, "bands": ["B8", "B4", "B3"]}
Map.addLayer(S2, {}, "Sentinel-2", False)
Map.add_time_slider(S2, vis_params)
Map
Map = geemap.Map(center=[37.75, -122.45], zoom=12)
S2 = (
ee.ImageCollection('COPERNICUS/S2_SR')
.filterBounds(ee.Geometry.Point([-122.45, 37.75]))
.filterMetadata('CLOUDY_PIXEL_PERCENTAGE', 'less_than', 10)
)
vis_params = {"min": 0, "max": 4000, "bands": ["B8", "B4", "B3"]}
Map.addLayer(S2, {}, "Sentinel-2", False)
Map.add_time_slider(S2, vis_params)
Map
--------------------------------------------------------------------------- AttributeError Traceback (most recent call last) Input In [9], in <cell line: 12>() 9 vis_params = {"min": 0, "max": 4000, "bands": ["B8", "B4", "B3"]} 11 Map.addLayer(S2, {}, "Sentinel-2", False) ---> 12 Map.add_time_slider(S2, vis_params) 13 Map AttributeError: 'Map' object has no attribute 'add_time_slider'
Last update:
2022-03-14