Visualizing PACE data interactively with HyperCoast¶
This notebook demonstrates how to visualize Plankton, Aerosol, Cloud, ocean Ecosystem (PACE) data interactively with HyperCoast.
In [ ]:
Copied!
# %pip install "hypercoast[extra]"
# %pip install "hypercoast[extra]"
In [ ]:
Copied!
import hypercoast
import hypercoast
Download a sample PACE data file from here.
In [ ]:
Copied!
url = "https://github.com/opengeos/datasets/releases/download/hypercoast/PACE_OCI.20240730T181157.L2.OC_AOP.V2_0.NRT.nc"
url = "https://github.com/opengeos/datasets/releases/download/hypercoast/PACE_OCI.20240730T181157.L2.OC_AOP.V2_0.NRT.nc"
In [ ]:
Copied!
filepath = "data/PACE_OCI.20240730T181157.L2.OC_AOP.V2_0.NRT.nc"
hypercoast.download_file(url, filepath)
filepath = "data/PACE_OCI.20240730T181157.L2.OC_AOP.V2_0.NRT.nc"
hypercoast.download_file(url, filepath)
Let's make a scatter plot of the pixel locations so we can see the irregular spacing.
In [ ]:
Copied!
plot = hypercoast.view_pace_pixel_locations(filepath, step=20)
plot = hypercoast.view_pace_pixel_locations(filepath, step=20)
Load the dataset as a xarray.Dataset
object.
In [ ]:
Copied!
dataset = hypercoast.read_pace(filepath)
dataset = hypercoast.read_pace(filepath)
Visualize selected bands of the dataset.
In [ ]:
Copied!
hypercoast.viz_pace(dataset, wavelengths=[500, 510, 520, 530], ncols=2)
hypercoast.viz_pace(dataset, wavelengths=[500, 510, 520, 530], ncols=2)
Add projection.
In [ ]:
Copied!
hypercoast.viz_pace(dataset, wavelengths=[500, 510, 520, 530], ncols=2, crs="default")
hypercoast.viz_pace(dataset, wavelengths=[500, 510, 520, 530], ncols=2, crs="default")
Plot a spectral signature.
In [ ]:
Copied!
latitude = 29.9307
longitude = -87.9106
hypercoast.extract_pace(dataset, latitude, longitude, return_plot=True)
latitude = 29.9307
longitude = -87.9106
hypercoast.extract_pace(dataset, latitude, longitude, return_plot=True)
Plot multiple spectral signatures.
In [ ]:
Copied!
latitude = (29.49, 29.50)
longitude = (-88.10, -88.00)
hypercoast.filter_pace(dataset, latitude, longitude, return_plot=True)
latitude = (29.49, 29.50)
longitude = (-88.10, -88.00)
hypercoast.filter_pace(dataset, latitude, longitude, return_plot=True)
Single-band visualization.
In [ ]:
Copied!
m = hypercoast.Map()
m.add_basemap("Hybrid")
wavelengths = [450]
m.add_pace(dataset, wavelengths, colormap="jet", vmin=0, vmax=0.02, layer_name="PACE")
m.add_colormap(cmap="jet", vmin=0, vmax=0.02, label="Reflectance")
m.add("spectral")
m
m = hypercoast.Map()
m.add_basemap("Hybrid")
wavelengths = [450]
m.add_pace(dataset, wavelengths, colormap="jet", vmin=0, vmax=0.02, layer_name="PACE")
m.add_colormap(cmap="jet", vmin=0, vmax=0.02, label="Reflectance")
m.add("spectral")
m
Multiple-band visualization.
In [ ]:
Copied!
m = hypercoast.Map()
m.add_basemap("Hybrid")
wavelengths = [450, 550, 650]
m.add_pace(
dataset, wavelengths, indexes=[3, 2, 1], vmin=0, vmax=0.02, layer_name="PACE"
)
m.add("spectral")
m
m = hypercoast.Map()
m.add_basemap("Hybrid")
wavelengths = [450, 550, 650]
m.add_pace(
dataset, wavelengths, indexes=[3, 2, 1], vmin=0, vmax=0.02, layer_name="PACE"
)
m.add("spectral")
m