24. Hyperspectral Data Visualization with HyperCoast#
24.1. Introduction#
24.2. Learning Objectives#
24.3. Environment Setup#
# %pip install hypercoast pygis
import hypercoast
hypercoast.nasa_earth_login()
24.4. Finding Hyperspectral Data#
24.4.1. Programmatic Search#
results, gdf = hypercoast.search_emit(
bbox=(-83, 25, -81, 28),
temporal=("2024-04-01", "2024-05-16"),
count=10, # use -1 to return all datasets
return_gdf=True,
)
gdf.explore()
hypercoast.download_emit(results[:1], out_dir="data")
24.4.2. Interactive Search#
m = hypercoast.Map(center=[30.0262, -90.1345], zoom=8)
m.search_emit()
m
if hasattr(m, "_NASA_DATA_GDF"):
display(m._NASA_DATA_GDF.head())
hypercoast.download_emit(results[:1], out_dir="data")
24.5. Downloading Hyperspectral Data#
url = "https://github.com/opengeos/datasets/releases/download/hypercoast/EMIT_L2A_RFL_001_20240404T161230_2409511_009.nc"
filepath = "data/EMIT_L2A_RFL_001_20240404T161230_2409511_009.nc"
hypercoast.download_file(url, filepath, quiet=True)
24.6. Reading Hyperspectral Data#
dataset = hypercoast.read_emit(filepath)
dataset
24.7. Visualizing Hyperspectral Data#
m = hypercoast.Map()
m.add_basemap("SATELLITE")
m.add_emit(dataset, wavelengths=[1000, 600, 500], vmin=0, vmax=0.3, layer_name="EMIT")
m.add("spectral")
m
24.8. Creating Image Cubes#
ds = dataset.sel(longitude=slice(-90.1482, -89.7321), latitude=slice(30.0225, 29.7451))
p = hypercoast.image_cube(
ds,
variable="reflectance",
cmap="jet",
clim=(0, 0.4),
rgb_wavelengths=[1000, 700, 500],
rgb_gamma=2,
title="EMIT Reflectance",
)
p.show()
24.9. Interactive Slicing#
ds = dataset.sel(longitude=slice(-90.05, -89.99), latitude=slice(30.00, 29.93))
p = hypercoast.image_cube(
ds,
variable="reflectance",
cmap="jet",
clim=(0, 0.5),
rgb_wavelengths=[1000, 700, 500],
rgb_gamma=2,
title="EMIT Reflectance",
widget="plane",
)
p.add_text("Band slicing", position="upper_right", font_size=14)
p.show()
24.10. Interactive Thresholding#
p = hypercoast.image_cube(
ds,
variable="reflectance",
cmap="jet",
clim=(0, 0.5),
rgb_wavelengths=[1000, 700, 500],
rgb_gamma=2,
title="EMIT Reflectance",
widget="threshold",
)
p.add_text("Thresholding", position="upper_right", font_size=14)
p.show()