81 goes timelapse
Uncomment the following line to install geemap if needed.
This notebook is adapted from Justin Braaten's JavaScript example. Credits to Justin Braaten. See also his Medium post - GOES in Earth Engine.
In [ ]:
Copied!
import os
import ee
import geemap
import os
import ee
import geemap
In [ ]:
Copied!
# geemap.update_package()
# geemap.update_package()
In [ ]:
Copied!
m = geemap.ee_initialize()
m = geemap.ee_initialize()
In [ ]:
Copied!
region = ee.Geometry.Polygon(
[
[
[-159.5954379282731, 60.40883060191719],
[-159.5954379282731, 24.517881970830725],
[-114.2438754282731, 24.517881970830725],
[-114.2438754282731, 60.40883060191719],
]
],
None,
False,
)
region = ee.Geometry.Polygon(
[
[
[-159.5954379282731, 60.40883060191719],
[-159.5954379282731, 24.517881970830725],
[-114.2438754282731, 24.517881970830725],
[-114.2438754282731, 60.40883060191719],
]
],
None,
False,
)
In [ ]:
Copied!
start_date = "2021-10-24T14:00:00"
end_date = "2021-10-25T01:00:00"
data = "GOES-17"
scan = "full_disk"
start_date = "2021-10-24T14:00:00"
end_date = "2021-10-25T01:00:00"
data = "GOES-17"
scan = "full_disk"
In [ ]:
Copied!
col = geemap.goes_timeseries(start_date, end_date, data, scan, region)
col = geemap.goes_timeseries(start_date, end_date, data, scan, region)
In [ ]:
Copied!
visParams = {
"bands": ["CMI_C02", "CMI_GREEN", "CMI_C01"],
"min": 0,
"max": 0.8,
"dimensions": 700,
"framesPerSecond": 9,
"region": region,
"crs": col.first().projection(),
}
visParams = {
"bands": ["CMI_C02", "CMI_GREEN", "CMI_C01"],
"min": 0,
"max": 0.8,
"dimensions": 700,
"framesPerSecond": 9,
"region": region,
"crs": col.first().projection(),
}
In [ ]:
Copied!
out_dir = os.path.expanduser("~/Downloads")
out_gif = os.path.join(out_dir, "goes_timelapse.gif")
if not os.path.exists(out_dir):
os.makedirs(out_dir)
out_dir = os.path.expanduser("~/Downloads")
out_gif = os.path.join(out_dir, "goes_timelapse.gif")
if not os.path.exists(out_dir):
os.makedirs(out_dir)
In [ ]:
Copied!
geemap.download_ee_video(col, visParams, out_gif)
geemap.download_ee_video(col, visParams, out_gif)
In [ ]:
Copied!
timestamps = geemap.image_dates(col, date_format="YYYY-MM-dd HH:mm").getInfo()
timestamps = geemap.image_dates(col, date_format="YYYY-MM-dd HH:mm").getInfo()
In [ ]:
Copied!
geemap.add_text_to_gif(
out_gif,
out_gif,
xy=("3%", "3%"),
text_sequence=timestamps,
font_size=20,
font_color="#ffffff",
)
geemap.add_text_to_gif(
out_gif,
out_gif,
xy=("3%", "3%"),
text_sequence=timestamps,
font_size=20,
font_color="#ffffff",
)
All the above steps can be reduced to just one line of code using the goes_timelapse()
function.
In [ ]:
Copied!
timelapse = geemap.goes_timelapse(
region, out_gif, start_date, end_date, data, scan, framesPerSecond=10
)
geemap.show_image(timelapse)
timelapse = geemap.goes_timelapse(
region, out_gif, start_date, end_date, data, scan, framesPerSecond=10
)
geemap.show_image(timelapse)