F42b Checkpoint
Import libraries¶
In [ ]:
Copied!
import ee
import geemap
import ee
import geemap
Create an interactive map¶
In [ ]:
Copied!
Map = geemap.Map(center=[40, -100], zoom=4)
Map = geemap.Map(center=[40, -100], zoom=4)
Add Earth Engine Python script¶
In [ ]:
Copied!
# Add Earth Engine dataset
image = ee.Image("USGS/SRTMGL1_003")
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Chapter: F4.2 Aggregating Images for Time Series
# Checkpoint: F42b
# Author: Ujaval Gandhi
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
chirps = ee.ImageCollection("UCSB-CHG/CHIRPS/PENTAD")
year = 2019
startDate = ee.Date.fromYMD(year, 1, 1)
endDate = startDate.advance(1, "year")
yearFiltered = chirps.filter(ee.Filter.date(startDate, endDate))
print(yearFiltered, "Date-filtered CHIRPS images")
print(startDate, "Start date")
print(endDate, "End date")
print("Start date as timestamp", startDate.millis())
print("End date as timestamp", endDate.millis())
# -----------------------------------------------------------------------
# CHECKPOINT
# -----------------------------------------------------------------------
# Add Earth Engine dataset
image = ee.Image("USGS/SRTMGL1_003")
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Chapter: F4.2 Aggregating Images for Time Series
# Checkpoint: F42b
# Author: Ujaval Gandhi
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
chirps = ee.ImageCollection("UCSB-CHG/CHIRPS/PENTAD")
year = 2019
startDate = ee.Date.fromYMD(year, 1, 1)
endDate = startDate.advance(1, "year")
yearFiltered = chirps.filter(ee.Filter.date(startDate, endDate))
print(yearFiltered, "Date-filtered CHIRPS images")
print(startDate, "Start date")
print(endDate, "End date")
print("Start date as timestamp", startDate.millis())
print("End date as timestamp", endDate.millis())
# -----------------------------------------------------------------------
# CHECKPOINT
# -----------------------------------------------------------------------
Display the interactive map¶
In [ ]:
Copied!
Map
Map