Skip to main content

speclib

License Python Status CI DOI codecov Codacy Badge NumPy HDF5 Parquet D3.js

Federated spectral signature library with Kentucky-focused collections

Overview

speclib aggregates reflectance spectra from major public spectral libraries into a unified, searchable platform. It provides a Python package for researchers, a static web viewer for discovery, and an optional self-hosted API for power users.

The library federates spectra from USGS Spectral Library v7, ECOSTRESS, ASTER/JPL, and EMIT L2B, with a dedicated Kentucky chapter seeded with invasive species spectral data from Lyons et al. (2024).

Features

  • Federated ingestion from USGS splib07, ECOSTRESS, ASTER/JPL, and EMIT L2B
  • Dual storage — HDF5 archival backend + Parquet query layer
  • Export to .esl (Esri), .sli (ENVI), SPECPR binary, ASCII, JSON
  • Spectral resampling to Landsat, Sentinel-2, AVIRIS, EMIT, and custom sensors
  • Static web viewer on GitHub Pages with D3.js interactive spectral plots
  • Optional FastAPI server with REST API and Jinja templates
  • Kentucky chapter with invasive species, mineral, and reclamation spectra

Getting Started

Prerequisites

  • Python 3.11+
  • pip

Installation

pip install speclib

With optional dependencies:

pip install speclib[server]    # FastAPI server
pip install speclib[emit]      # EMIT L2B support (netCDF4)
pip install speclib[all]       # Everything including dev tools

Quick Start

from speclib import SpectralLibrary

# Load the library from an HDF5 archive
lib = SpectralLibrary.from_hdf5("speclib_archive.h5")

# Search for quartz spectra
results = lib.search("quartz", category="MINERAL")

# Plot a spectrum
results[0].plot()

# Export to Esri Spectral Library format
results[0].export("quartz.esl", format="esl")

# Resample to Landsat 8 OLI bands
resampled = results[0].resample("L8_OLI")

CLI

speclib ingest usgs --config data/upstream/usgs_splib07.yaml
speclib search "honeysuckle" --category KY_INVASIVE
speclib export usgs_mineral_quartz_a1b2c3d4 --format sli --output quartz.sli
speclib build
speclib serve

Web Viewer

Browse the spectral library at: https://chrislyonsKY.github.io/speclib/

Data Sources

Source License Description
USGS Spectral Library v7 US Public Domain Minerals, rocks, soils, vegetation, manmade materials
ECOSTRESS Spectral Library CC0 / Public Domain Minerals, vegetation, soils, water, manmade
ASTER/JPL Spectral Library NASA Open Data Minerals, rocks, soils
EMIT L2B NASA Open Data Spaceborne mineral identification spectra
Kentucky Field Data CC-BY-4.0 Invasive species spectra (Lyons et al. 2024)

Citation

@software{lyons2026speclib,
  author = {Lyons, Chris},
  title = {speclib: Federated Spectral Signature Library},
  year = {2026},
  url = {https://github.com/chrislyonsKY/speclib},
  doi = {10.5281/zenodo.19390679},
  license = {GPL-3.0}
}

Contributing

See CONTRIBUTING.md.

Security

See SECURITY.md for reporting vulnerabilities.

License

GPL-3.0-only — see LICENSE for details.

Metadata

Release files for speclib 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for speclib 1.0.1
File Size Uploaded
speclib-1.0.1.tar.gz 44.9 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for speclib 1.0.1
File Interpreter ABI Platform
speclib-1.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 44.9 MB

Release files / speclib-1.0.1.tar.gz

Download URL speclib-1.0.1.tar.gz
Size 44.9 MB
Tags Source
SHA-256 checksum
How to use checksums
17228f6185c7b382845dc3b828ef4625801685db8d3cdf7f83066f4d7e018e18
BLAKE2b-256 checksum
How to use checksums
dc5d493cb1e62a00755096614f730a7c67e963e8213a814ce1e137d992949c95
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 2, 2026.

Transparency log

Release files / speclib-1.0.1-py3-none-any.whl

Download URL speclib-1.0.1-py3-none-any.whl
Size 34.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
69817eed8076823be5065228251960eaa41e332ab13added279f24b99e50db73
BLAKE2b-256 checksum
How to use checksums
e10cd353ac0568d66ea23d0337fad0891e73932ac9f1b1eb5b304f15f4bfb2c5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 2, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page