Visualizing Planet's Tanager Data in 3D¶
This notebook demonstrates how to visualize Planet's Tanager hyperspectral data in 3D with HyperCoast.
Tanager-1 (launched August 2024) carries a high-precision Dyson imaging spectrometer onboard Planet’s next-generation smallsat bus. Tanager provides high spectral resolution (~5 nm) across the full 380–2500 nm VSWIR spectral range. For more details, please refer to the Planet Tanager data release page.
Install packages¶
Uncomment the following line to install the packages.
# %pip install hypercoast
Import libraries¶
import hypercoast
Find Tanager data¶
Browse the Tanager data on the Planet STAC browser. Find the data you want to visualize.
For example, we want to visualize the data of the coastal water bodies in the San Francisco Bay area. Click on the "Copy URL" button to get the direct URL of the data.
Download Tanager data¶
Once you have the URL of the data, you can download the data using the following code:
url = "https://storage.googleapis.com/open-cogs/planet-stac/release1-basic-radiance/20250514_193937_64_4001_basic_radiance.h5"
file_path = hypercoast.download_file(url)
Read Tanager data¶
We can read the Tanager data using the read_tanager
function. It will return a xarray.Dataset
object. The toa_radiance
variable is the top of atmosphere radiance. It has 426 spectral bands. Note that the dataset is not gridded. We will need to interpolate the data to a regular grid for visualization on an interactive map.
dataset = hypercoast.read_tanager(file_path)
dataset
Visualize Tanager data in 2D¶
Let's visualize the Tanager data on an interactive map. Specify the bands to visualize. You can visualize the data in the spectral space or the RGB space.
m = hypercoast.Map()
m.add_tanager(dataset, bands=[100, 60, 50], vmin=0, vmax=120, layer_name="Tanager")
m.add("spectral")
m
Create a rectangular grid of Tanager data¶
gridded = hypercoast.grid_tanager(dataset, row_range=(200, 400), col_range=(200, 400))
gridded = (gridded / 100).clip(0, 1)
gridded
Create a 3D image cube¶
p = hypercoast.image_cube(
gridded,
variable="toa_radiance",
cmap="jet",
clim=(0, 1),
rgb_wavelengths=[1000, 600, 500],
title="Radiance * 100",
)
p.show()
Interactive slicing along the z-axis (band)¶
p = hypercoast.image_cube(
gridded,
variable="toa_radiance",
cmap="jet",
clim=(0, 1),
rgb_wavelengths=[1000, 700, 500],
title="Radiance * 100",
widget="slice",
)
p.add_text("Band slicing ", position="upper_right", font_size=14)
p.show()
Interactive slicing along the x-axis (longitude).¶
p = hypercoast.image_cube(
gridded,
variable="toa_radiance",
cmap="jet",
clim=(0, 1),
rgb_wavelengths=[1000, 700, 500],
widget="slice",
normal="x",
)
p.add_text("X-axis slicing ", position="upper_right", font_size=14)
p.show()
Orthogonal slicing¶
p = hypercoast.image_cube(
gridded,
variable="toa_radiance",
cmap="jet",
clim=(0, 1),
rgb_wavelengths=[1000, 700, 500],
title="Radiance * 100",
widget="orthogonal",
)
p.add_text("Orthogonal slicing", position="upper_right", font_size=14)
p.show()
Clip the image cube with a plane (band slicing)¶
p = hypercoast.image_cube(
gridded,
variable="toa_radiance",
cmap="jet",
clim=(0, 1),
rgb_wavelengths=[1000, 700, 500],
title="Radiance * 100",
widget="plane",
)
p.add_text("Band slicing", position="upper_right", font_size=14)
p.show()
Interactive thresholding¶
p = hypercoast.image_cube(
gridded,
variable="toa_radiance",
cmap="jet",
clim=(0, 1),
rgb_wavelengths=[1000, 700, 500],
title="Radiance * 100",
widget="threshold",
)
p.add_text("Thresholding", position="upper_right", font_size=14)
p.show()