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.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

speclib-1.0.1.tar.gz (44.9 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

speclib-1.0.1-py3-none-any.whl (34.0 kB view details)

Uploaded Python 3

File details

Details for the file speclib-1.0.1.tar.gz.

File metadata

  • Download URL: speclib-1.0.1.tar.gz
  • Upload date:
  • Size: 44.9 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for speclib-1.0.1.tar.gz
Algorithm Hash digest
SHA256 17228f6185c7b382845dc3b828ef4625801685db8d3cdf7f83066f4d7e018e18
MD5 aead4871241a2c5d5e42f6316cde0c55
BLAKE2b-256 dc5d493cb1e62a00755096614f730a7c67e963e8213a814ce1e137d992949c95

See more details on using hashes here.

Provenance

The following attestation bundles were made for speclib-1.0.1.tar.gz:

Publisher: publish.yml on chrislyonsKY/speclib

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file speclib-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: speclib-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 34.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for speclib-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 69817eed8076823be5065228251960eaa41e332ab13added279f24b99e50db73
MD5 a934c3aaa17e409e3e3710428375f418
BLAKE2b-256 e10cd353ac0568d66ea23d0337fad0891e73932ac9f1b1eb5b304f15f4bfb2c5

See more details on using hashes here.

Provenance

The following attestation bundles were made for speclib-1.0.1-py3-none-any.whl:

Publisher: publish.yml on chrislyonsKY/speclib

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 files

1.0.0

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page