Visualizing PACE data interactively with HyperCoast¶
This notebook demonstrates how to visualize Plankton, Aerosol, Cloud, ocean Ecosystem (PACE) data interactively with HyperCoast.
In [1]:
Copied!
# %pip install "hypercoast[extra]"
# %pip install "hypercoast[extra]"
In [2]:
Copied!
import hypercoast
import hypercoast
Download a sample PACE data file from here.
In [3]:
Copied!
url = "https://github.com/opengeos/datasets/releases/download/netcdf/PACE_OCI.20240423T184658.L2.OC_AOP.V1_0_0.NRT.nc"
url = "https://github.com/opengeos/datasets/releases/download/netcdf/PACE_OCI.20240423T184658.L2.OC_AOP.V1_0_0.NRT.nc"
In [4]:
Copied!
filepath = "data/PACE_OCI.20240423T184658.L2.OC_AOP.V1_0_0.NRT.nc"
hypercoast.download_file(url, filepath)
filepath = "data/PACE_OCI.20240423T184658.L2.OC_AOP.V1_0_0.NRT.nc"
hypercoast.download_file(url, filepath)
Out[4]:
'/home/runner/work/HyperCoast/HyperCoast/docs/examples/data/PACE_OCI.20240423T184658.L2.OC_AOP.V1_0_0.NRT.nc'
Let's make a scatter plot of the pixel locations so we can see the irregular spacing.
In [5]:
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 [6]:
Copied!
dataset = hypercoast.read_pace(filepath)
dataset = hypercoast.read_pace(filepath)
Visualize selected bands of the dataset.
In [7]:
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 [8]:
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 [9]:
Copied!
latitude = 25.493961
longitude = -91.25617
hypercoast.filter_pace(dataset, latitude, longitude, return_plot=True)
latitude = 25.493961
longitude = -91.25617
hypercoast.filter_pace(dataset, latitude, longitude, return_plot=True)
Plot multiple spectral signatures.
In [10]:
Copied!
latitude = (25.49, 25.50)
longitude = (-92, -91.055)
hypercoast.filter_pace(dataset, latitude, longitude, return_plot=True)
latitude = (25.49, 25.50)
longitude = (-92, -91.055)
hypercoast.filter_pace(dataset, latitude, longitude, return_plot=True)
Single-band visualization.
In [11]:
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
Out[11]:
Multiple-band visualization.
In [12]:
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
Out[12]: