Fast hyperspectral data processing for remote sensing and ML pipelines
Project description
hyperspec
Fast hyperspectral data processing for remote sensing and ML pipelines. Rust core with Python bindings.
Built by Hyperstate — foundation models for Earth intelligence.
Why hyperspec?
Hyperspectral imagery produces hundreds of bands per pixel, orders of magnitude more than RGB or multispectral. Most existing tools are slow, have heavy system dependencies, and were not designed for modern ML training pipelines.
hyperspec provides:
- Fast Rust implementations of standard hyperspectral algorithms
- A
SpectralCubeabstraction that keeps data, wavelengths, and metadata together - Zarr V3 storage with chunking optimized for ML dataloaders
- Python bindings with zero-copy NumPy interop
Install
Python:
pip install hyperspec-py
# or
uv add hyperspec-py
Rust:
cargo add hyperspec
or
[dependencies]
hyperspec = "0.6"
Quickstart
import numpy as np
from hyperspec import (
SpectralCube, read_envi, write_zarr, read_zarr_window, zarr_cube_shape,
sam, continuum_removal, pca, mnf_denoise,
)
# --- I/O ---
# Read ENVI format (AVIRIS-NG, etc.)
cube = read_envi("scene.hdr")
# Process
cr_cube = continuum_removal(cube)
denoised = mnf_denoise(cube, n_components=20)
# Write to Zarr with ML-friendly chunks
write_zarr(cube, "chips.zarr", chunk_shape=(cube.bands(), 256, 256))
# Read a single training tile without loading the full cube
tile = read_zarr_window(
"chips.zarr",
bands=(0, cube.bands()),
rows=(0, 256),
cols=(0, 256),
)
# Query shape without loading data
bands, lines, samples = zarr_cube_shape("chips.zarr")
# --- Spectral analysis ---
# Compare every pixel to a reference spectrum
reference = cube.spectrum(50, 50)
angles = sam(cube, reference)
# Dimensionality reduction
pca_result = pca(cube, n_components=10)
SpectralCube
| Category | Methods |
|---|---|
| Dimensions | bands, height, width, shape |
| Data access | data(), wavelengths(), fwhm(), nodata |
| Pixel access | spectrum(row, col) |
| Band access | band(index), band_at(nm), band_nearest(nm) |
| Wavelength lookup | wavelength(index), wavelength_index(nm), nearest_band_index(nm) |
| Statistics | mean_spectrum() |
| Subsetting | sel_bands([i, j]), sel_wavelengths(min, max) |
I/O
Read
| Format | Function |
|---|---|
| ENVI | read_envi(path) |
| Zarr V3 | read_zarr(path) |
| Zarr V3 | read_zarr_with_options(path, ...) |
| Zarr V3 | read_zarr_window(path, bands, rows, cols) |
Write
| Format | Function |
|---|---|
| ENVI | write_envi(cube, path) |
| Zarr V3 | write_zarr(cube, path) |
Utilities
| Format | Function |
|---|---|
| Zarr V3 | zarr_cube_shape(path) |
Algorithms
Spectral similarity
| Operation | Function |
|---|---|
| Spectral Angle Mapper | sam(cube, reference) |
Spectral preprocessing
| Operation | Function |
|---|---|
| Continuum removal | continuum_removal(cube) |
Spectral indices
| Operation | Function |
|---|---|
| Normalized difference | normalized_difference(cube, a, b) |
| Band ratio | band_ratio(cube, a, b) |
| NDVI | ndvi(cube, nir, red) |
Dimensionality reduction
| Operation | Function |
|---|---|
| PCA | pca(cube, n_components) |
| MNF | mnf(cube, n_components) |
| MNF denoise | mnf_denoise(cube, n_components) |
Spectral utilities
| Operation | Function |
|---|---|
| Resample | resample(cube, target_wl, method) |
Architecture
crates/hyperspec/ # Pure Rust library → crates.io
└── src/
├── cube.rs # SpectralCube type
├── error.rs # HyperspecError
├── io/
│ ├── envi.rs # ENVI read/write (BSQ, BIL, BIP)
│ └── zarr.rs # Zarr V3 read/write/window
└── algorithms/
├── sam.rs
├── continuum.rs
├── indices.rs
├── pca.rs
├── mnf.rs
└── resample.rs
pyo3-hyperspec/ # PyO3 bindings → PyPI: hyperspec-py
├── src/lib.rs
└── python/hyperspec/
└── __init__.py
- Rust 2024 edition, using
ndarray,rayon,zarrs,thiserror - Minimal system dependencies — no LAPACK or GDAL
- Python 3.12+, NumPy bindings via PyO3
Roadmap
- Cloud-native Zarr stores (Azure, GCS, S3)
- More algorithms and utilities
Development
uv venv && source .venv/bin/activate
uv pip install maturin pytest
cargo test
maturin develop
pytest
License
Apache-2.0
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file hyperspec_py-0.6.1.tar.gz.
File metadata
- Download URL: hyperspec_py-0.6.1.tar.gz
- Upload date:
- Size: 57.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2b0683871308395d804a98ed814af993395f0a5ea316468e4f099bd8a08f30d5
|
|
| MD5 |
250d232bf6359607c92384155e2a102a
|
|
| BLAKE2b-256 |
36d46f83b7be199b2b86aaa0338d4733a0d92081ebd2ee0c53c48251880da14a
|
Provenance
The following attestation bundles were made for hyperspec_py-0.6.1.tar.gz:
Publisher:
publish.yml on hyperstateco/hyperspec
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
hyperspec_py-0.6.1.tar.gz -
Subject digest:
2b0683871308395d804a98ed814af993395f0a5ea316468e4f099bd8a08f30d5 - Sigstore transparency entry: 1059861281
- Sigstore integration time:
-
Permalink:
hyperstateco/hyperspec@2b4c5ec08226eccbaaee7caa39de77ba2823720d -
Branch / Tag:
refs/tags/v0.6.1 - Owner: https://github.com/hyperstateco
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@2b4c5ec08226eccbaaee7caa39de77ba2823720d -
Trigger Event:
release
-
Statement type:
File details
Details for the file hyperspec_py-0.6.1-cp313-cp313-win_amd64.whl.
File metadata
- Download URL: hyperspec_py-0.6.1-cp313-cp313-win_amd64.whl
- Upload date:
- Size: 2.2 MB
- Tags: CPython 3.13, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3927e709b0f13c6aae416a5feea9c8655d6c7e9487c9f92ed7aaae7fd5e3d91f
|
|
| MD5 |
adbc479c9a0614afc05fbd6749690cfe
|
|
| BLAKE2b-256 |
c4d9d0594556b21c1d3d56d2f4338c07285fa3e9b72c1ac653b6c9733dde557f
|
Provenance
The following attestation bundles were made for hyperspec_py-0.6.1-cp313-cp313-win_amd64.whl:
Publisher:
publish.yml on hyperstateco/hyperspec
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
hyperspec_py-0.6.1-cp313-cp313-win_amd64.whl -
Subject digest:
3927e709b0f13c6aae416a5feea9c8655d6c7e9487c9f92ed7aaae7fd5e3d91f - Sigstore transparency entry: 1059861287
- Sigstore integration time:
-
Permalink:
hyperstateco/hyperspec@2b4c5ec08226eccbaaee7caa39de77ba2823720d -
Branch / Tag:
refs/tags/v0.6.1 - Owner: https://github.com/hyperstateco
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@2b4c5ec08226eccbaaee7caa39de77ba2823720d -
Trigger Event:
release
-
Statement type:
File details
Details for the file hyperspec_py-0.6.1-cp313-cp313-manylinux_2_34_x86_64.whl.
File metadata
- Download URL: hyperspec_py-0.6.1-cp313-cp313-manylinux_2_34_x86_64.whl
- Upload date:
- Size: 2.8 MB
- Tags: CPython 3.13, manylinux: glibc 2.34+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
63893d3ff597d72c4c3e4ca764a4d106c0f118f472ba8f435098e5b967662fa4
|
|
| MD5 |
049285bdb3dc7071f6f86b2205fc6cf9
|
|
| BLAKE2b-256 |
91f323d5f02351fcb659040d6e1dbe83aa5b405ec5d7599c6327a04db2dd1408
|
Provenance
The following attestation bundles were made for hyperspec_py-0.6.1-cp313-cp313-manylinux_2_34_x86_64.whl:
Publisher:
publish.yml on hyperstateco/hyperspec
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
hyperspec_py-0.6.1-cp313-cp313-manylinux_2_34_x86_64.whl -
Subject digest:
63893d3ff597d72c4c3e4ca764a4d106c0f118f472ba8f435098e5b967662fa4 - Sigstore transparency entry: 1059861284
- Sigstore integration time:
-
Permalink:
hyperstateco/hyperspec@2b4c5ec08226eccbaaee7caa39de77ba2823720d -
Branch / Tag:
refs/tags/v0.6.1 - Owner: https://github.com/hyperstateco
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@2b4c5ec08226eccbaaee7caa39de77ba2823720d -
Trigger Event:
release
-
Statement type:
File details
Details for the file hyperspec_py-0.6.1-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.
File metadata
- Download URL: hyperspec_py-0.6.1-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 2.2 MB
- Tags: CPython 3.13, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
80d58863e7aa00b0c186c86982546d6ad26d73fde3744fabfab8436fb053ae27
|
|
| MD5 |
6efe529193df77eae90faa93328d044a
|
|
| BLAKE2b-256 |
df8222e65cf91bd5809427d3281f9ddcc17f78817a4717fdf8539690fce2e335
|
Provenance
The following attestation bundles were made for hyperspec_py-0.6.1-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:
Publisher:
publish.yml on hyperstateco/hyperspec
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
hyperspec_py-0.6.1-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl -
Subject digest:
80d58863e7aa00b0c186c86982546d6ad26d73fde3744fabfab8436fb053ae27 - Sigstore transparency entry: 1059861286
- Sigstore integration time:
-
Permalink:
hyperstateco/hyperspec@2b4c5ec08226eccbaaee7caa39de77ba2823720d -
Branch / Tag:
refs/tags/v0.6.1 - Owner: https://github.com/hyperstateco
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@2b4c5ec08226eccbaaee7caa39de77ba2823720d -
Trigger Event:
release
-
Statement type:
File details
Details for the file hyperspec_py-0.6.1-cp313-cp313-macosx_11_0_arm64.whl.
File metadata
- Download URL: hyperspec_py-0.6.1-cp313-cp313-macosx_11_0_arm64.whl
- Upload date:
- Size: 2.5 MB
- Tags: CPython 3.13, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3cf4267fe6fcf99934f98323d78c188d244cbcd53855ae1c2f2a4f3e16256c1c
|
|
| MD5 |
50993b1dbf58d29fc5b671f5cea69b1d
|
|
| BLAKE2b-256 |
90199d451d2e3e4851f89bcfcd14aea380dc3ba96933dfa1c1e6045e2e8a6792
|
Provenance
The following attestation bundles were made for hyperspec_py-0.6.1-cp313-cp313-macosx_11_0_arm64.whl:
Publisher:
publish.yml on hyperstateco/hyperspec
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
hyperspec_py-0.6.1-cp313-cp313-macosx_11_0_arm64.whl -
Subject digest:
3cf4267fe6fcf99934f98323d78c188d244cbcd53855ae1c2f2a4f3e16256c1c - Sigstore transparency entry: 1059861290
- Sigstore integration time:
-
Permalink:
hyperstateco/hyperspec@2b4c5ec08226eccbaaee7caa39de77ba2823720d -
Branch / Tag:
refs/tags/v0.6.1 - Owner: https://github.com/hyperstateco
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@2b4c5ec08226eccbaaee7caa39de77ba2823720d -
Trigger Event:
release
-
Statement type:
File details
Details for the file hyperspec_py-0.6.1-cp313-cp313-macosx_10_12_x86_64.whl.
File metadata
- Download URL: hyperspec_py-0.6.1-cp313-cp313-macosx_10_12_x86_64.whl
- Upload date:
- Size: 2.6 MB
- Tags: CPython 3.13, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5fcda8754929c33c26dfcbf070f26b6b64dff805f88590a79fb51298b3bd8ab5
|
|
| MD5 |
9b9ac2b6807bcf8b9ab9b30900b9e3a2
|
|
| BLAKE2b-256 |
4eea2972af97f27d050a6f0d3b09392a6ac761b8521b63aa9a67904fa20fca54
|
Provenance
The following attestation bundles were made for hyperspec_py-0.6.1-cp313-cp313-macosx_10_12_x86_64.whl:
Publisher:
publish.yml on hyperstateco/hyperspec
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
hyperspec_py-0.6.1-cp313-cp313-macosx_10_12_x86_64.whl -
Subject digest:
5fcda8754929c33c26dfcbf070f26b6b64dff805f88590a79fb51298b3bd8ab5 - Sigstore transparency entry: 1059861282
- Sigstore integration time:
-
Permalink:
hyperstateco/hyperspec@2b4c5ec08226eccbaaee7caa39de77ba2823720d -
Branch / Tag:
refs/tags/v0.6.1 - Owner: https://github.com/hyperstateco
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@2b4c5ec08226eccbaaee7caa39de77ba2823720d -
Trigger Event:
release
-
Statement type: