F31b 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: F3.1 Advanced Pixel-Based Image Transformations
# Checkpoint: F31b
# Authors: Karen, Andrea, Nick, and David
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Examine the True-color Landsat 8 images for the 2013 Rim Fire.
burnImage = (
ee.ImageCollection("LANDSAT/LC08/C02/T1_TOA")
.filterBounds(ee.Geometry.Point(-120.083, 37.850))
.filterDate("2013-09-15", "2013-09-27")
.sort("CLOUD_COVER")
.first()
)
Map.centerObject(ee.Geometry.Point(-120.083, 37.850), 11)
rgbParams = {"bands": ["B4", "B3", "B2"], "min": 0, "max": 0.3}
Map.addLayer(burnImage, rgbParams, "True-Color Burn Image")
# Calculate BAI.
bai = burnImage.expression(
"1.0 / ((0.1 - RED)**2 + (0.06 - NIR)**2)",
{
"NIR": burnImage.select("B5"),
"RED": burnImage.select("B4"),
},
)
# Display the BAI image.
burnPalette = ["green", "blue", "yellow", "red"]
Map.addLayer(bai, {"min": 0, "max": 400, "palette": burnPalette}, "BAI")
# -----------------------------------------------------------------------
# CHECKPOINT
# -----------------------------------------------------------------------
# Add Earth Engine dataset
image = ee.Image("USGS/SRTMGL1_003")
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Chapter: F3.1 Advanced Pixel-Based Image Transformations
# Checkpoint: F31b
# Authors: Karen, Andrea, Nick, and David
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Examine the True-color Landsat 8 images for the 2013 Rim Fire.
burnImage = (
ee.ImageCollection("LANDSAT/LC08/C02/T1_TOA")
.filterBounds(ee.Geometry.Point(-120.083, 37.850))
.filterDate("2013-09-15", "2013-09-27")
.sort("CLOUD_COVER")
.first()
)
Map.centerObject(ee.Geometry.Point(-120.083, 37.850), 11)
rgbParams = {"bands": ["B4", "B3", "B2"], "min": 0, "max": 0.3}
Map.addLayer(burnImage, rgbParams, "True-Color Burn Image")
# Calculate BAI.
bai = burnImage.expression(
"1.0 / ((0.1 - RED)**2 + (0.06 - NIR)**2)",
{
"NIR": burnImage.select("B5"),
"RED": burnImage.select("B4"),
},
)
# Display the BAI image.
burnPalette = ["green", "blue", "yellow", "red"]
Map.addLayer(bai, {"min": 0, "max": 400, "palette": burnPalette}, "BAI")
# -----------------------------------------------------------------------
# CHECKPOINT
# -----------------------------------------------------------------------
Display the interactive map¶
In [ ]:
Copied!
Map
Map