In [ ]:
Copied!
# %pip install "hypercoast[extra]"
# %pip install "hypercoast[extra]"
In [ ]:
Copied!
import hypercoast
import hypercoast
NEON AOP¶
Download a sample NEON AOP hyperspectral dataset.
In [ ]:
Copied!
url = "https://github.com/opengeos/datasets/releases/download/hypercoast/NEON_D02_SERC_DP3_368000_4306000_reflectance.h5"
filepath = "data/neon.h5"
hypercoast.download_file(url, filepath)
url = "https://github.com/opengeos/datasets/releases/download/hypercoast/NEON_D02_SERC_DP3_368000_4306000_reflectance.h5"
filepath = "data/neon.h5"
hypercoast.download_file(url, filepath)
Load the dataset as a xarray.Dataset
object.
In [ ]:
Copied!
dataset = hypercoast.read_neon(filepath)
dataset
dataset = hypercoast.read_neon(filepath)
dataset
Extract a small subset of the dataset for demonstration purposes.
In [ ]:
Copied!
ds = dataset.isel(x=slice(100, 200), y=slice(100, 200))
ds
ds = dataset.isel(x=slice(100, 200), y=slice(100, 200))
ds
Interactive slicing along the z-axis (band)
In [ ]:
Copied!
p = hypercoast.image_cube(
ds,
variable="reflectance",
cmap="jet",
clim=(0, 0.5),
rgb_wavelengths=[1000, 700, 500],
rgb_gamma=2,
widget="slice",
)
p.add_text("Band slicing ", position="upper_right", font_size=14)
p.show()
p = hypercoast.image_cube(
ds,
variable="reflectance",
cmap="jet",
clim=(0, 0.5),
rgb_wavelengths=[1000, 700, 500],
rgb_gamma=2,
widget="slice",
)
p.add_text("Band slicing ", position="upper_right", font_size=14)
p.show()
Interactive slicing along the x-axis (longitude).
In [ ]:
Copied!
p = hypercoast.image_cube(
ds,
variable="reflectance",
cmap="jet",
clim=(0, 0.5),
rgb_wavelengths=[1000, 700, 500],
rgb_gamma=2,
widget="slice",
normal="x",
)
p.add_text("X-axis slicing ", position="upper_right", font_size=14)
p.show()
p = hypercoast.image_cube(
ds,
variable="reflectance",
cmap="jet",
clim=(0, 0.5),
rgb_wavelengths=[1000, 700, 500],
rgb_gamma=2,
widget="slice",
normal="x",
)
p.add_text("X-axis slicing ", position="upper_right", font_size=14)
p.show()
Orthogonal slicing.
In [ ]:
Copied!
p = hypercoast.image_cube(
ds,
variable="reflectance",
cmap="jet",
clim=(0, 0.5),
rgb_wavelengths=[1000, 700, 500],
rgb_gamma=2,
widget="orthogonal",
)
p.add_text("Orthogonal slicing", position="upper_right", font_size=14)
p.show()
p = hypercoast.image_cube(
ds,
variable="reflectance",
cmap="jet",
clim=(0, 0.5),
rgb_wavelengths=[1000, 700, 500],
rgb_gamma=2,
widget="orthogonal",
)
p.add_text("Orthogonal slicing", position="upper_right", font_size=14)
p.show()
Clip the image cube with a plane (band slicing).
In [ ]:
Copied!
p = hypercoast.image_cube(
ds,
variable="reflectance",
cmap="jet",
clim=(0, 0.5),
rgb_wavelengths=[1000, 700, 500],
rgb_gamma=2,
widget="plane",
)
p.add_text("Band slicing", position="upper_right", font_size=14)
p.show()
p = hypercoast.image_cube(
ds,
variable="reflectance",
cmap="jet",
clim=(0, 0.5),
rgb_wavelengths=[1000, 700, 500],
rgb_gamma=2,
widget="plane",
)
p.add_text("Band slicing", position="upper_right", font_size=14)
p.show()
Interactive thresholding.
In [ ]:
Copied!
p = hypercoast.image_cube(
ds,
variable="reflectance",
cmap="jet",
clim=(0, 0.5),
rgb_wavelengths=[1000, 700, 500],
rgb_gamma=2,
widget="threshold",
)
p.add_text("Thresholding", position="upper_right", font_size=14)
p.show()
p = hypercoast.image_cube(
ds,
variable="reflectance",
cmap="jet",
clim=(0, 0.5),
rgb_wavelengths=[1000, 700, 500],
rgb_gamma=2,
widget="threshold",
)
p.add_text("Thresholding", position="upper_right", font_size=14)
p.show()
In [ ]:
Copied!
url = "https://github.com/opengeos/datasets/releases/download/netcdf/EMIT_L2A_RFL_001_20240404T161230_2409511_009.nc"
filepath = "data/EMIT_L2A_RFL_001_20240404T161230_2409511_009.nc"
hypercoast.download_file(url, filepath)
url = "https://github.com/opengeos/datasets/releases/download/netcdf/EMIT_L2A_RFL_001_20240404T161230_2409511_009.nc"
filepath = "data/EMIT_L2A_RFL_001_20240404T161230_2409511_009.nc"
hypercoast.download_file(url, filepath)
Load the dataset as a xarray.Dataset
object.
In [ ]:
Copied!
dataset = hypercoast.read_emit(filepath)
dataset
dataset = hypercoast.read_emit(filepath)
dataset
Select a subset of the data for demonstration purposes.
In [ ]:
Copied!
ds = dataset.sel(longitude=slice(-90.05, -89.99), latitude=slice(30.00, 29.93))
ds
ds = dataset.sel(longitude=slice(-90.05, -89.99), latitude=slice(30.00, 29.93))
ds
Interactive slicing along the z-axis (band).
In [ ]:
Copied!
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()
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()
Interactive thresholding.
In [ ]:
Copied!
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()
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()