Skip to main content

Spectral library build, preparation, and retrieval-based mapping toolkit.

Project description

Spectral Library

spectral-library is a Python package and CLI for:

  1. preparing row-aligned runtime artifacts from a SIAC spectral-library export,
  2. mapping source-sensor reflectance to target sensors,
  3. reconstructing VNIR, SWIR, or full hyperspectral outputs with retrieval-based spectral mapping.

The public names are:

  • distribution: spectral-library
  • import package: spectral_library
  • CLI: spectral-library
  • license: MIT for repository software and repository-authored docs

Start Here

Install

Install from this repository in a Python 3.9+ environment:

python3 -m pip install .

Supported Python versions in CI are 3.9, 3.10, 3.11, and 3.12.

The same documentation set is published to GitHub Pages from this repository.

For the retained internal normalization and QA commands, install the optional internal-build dependencies:

python3 -m pip install ".[internal-build]"

This extra is also required if you want to regenerate the bundled official sensor example assets with scripts/build_official_mapping_examples.py.

For the static documentation site and GitHub Pages build path, install:

python3 -m pip install ".[docs]"

The published docs site is built with MkDocs from mkdocs.yml.

For the optional SciPy cKDTree shortlist backend, install:

python3 -m pip install ".[knn]"

Additional optional ANN backends are available with:

python3 -m pip install ".[knn-faiss]"
python3 -m pip install ".[knn-pynndescent]"
python3 -m pip install ".[knn-scann]"

Minimal Example

Prepare a mapping runtime:

spectral-library prepare-mapping-library \
  --siac-root build/siac_library \
  --srf-root path/to/srfs \
  --source-sensor SENSOR_A \
  --knn-index-backend faiss \
  --output-root build/mapping_runtime

Validate it:

spectral-library validate-prepared-library \
  --prepared-root build/mapping_runtime

Map one reflectance sample:

spectral-library map-reflectance \
  --prepared-root build/mapping_runtime \
  --source-sensor SENSOR_A \
  --target-sensor SENSOR_B \
  --input path/to/query.csv \
  --output-mode target_sensor \
  --output path/to/mapped.csv

Map many samples from one CSV:

spectral-library map-reflectance-batch \
  --prepared-root build/mapping_runtime \
  --source-sensor SENSOR_A \
  --target-sensor SENSOR_B \
  --input path/to/query_batch.csv \
  --output-mode target_sensor \
  --output path/to/mapped_batch.csv

The detailed quickstart, supported CSV layouts, Python API examples, SRF JSON schema, and prepared-runtime contract are documented in docs/mapping_quickstart.md.

For larger prepared runtimes, the repository also ships scripts/run_full_library_benchmarks.py plus the scheduled/manual GitHub Actions workflow full-library-benchmarks.yml. Use --max-test-rows to keep held-out benchmark runs bounded on large prepared libraries.

For reproducible cross-sensor examples built from official MODIS, Sentinel-2A, Landsat 8, and Landsat 9 response functions, see docs/official_sensor_examples.md and the bundled example assets in examples/official_mapping. Those official examples expect the previously composed full SIAC library recorded in the example manifest, rather than a vendored mini runtime.

Project details


Download files

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

Source Distribution

spectral_library-0.2.0.tar.gz (129.7 kB view details)

Uploaded Source

Built Distribution

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

spectral_library-0.2.0-py3-none-any.whl (91.2 kB view details)

Uploaded Python 3

File details

Details for the file spectral_library-0.2.0.tar.gz.

File metadata

  • Download URL: spectral_library-0.2.0.tar.gz
  • Upload date:
  • Size: 129.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for spectral_library-0.2.0.tar.gz
Algorithm Hash digest
SHA256 00683f8d36b3aa85d07e3cd5fe871525f567749ccc75c8e2f99b5ca16f27472d
MD5 3208cd9db1d7aaf8b08ac98eb5cb634b
BLAKE2b-256 092b5b49baeb84ee40f94956112e3bccb60340f76caa17ee641e2e8145c33849

See more details on using hashes here.

Provenance

The following attestation bundles were made for spectral_library-0.2.0.tar.gz:

Publisher: release-package.yml on MarcYin/spectral_library

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

File details

Details for the file spectral_library-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for spectral_library-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 adc0c0944781bf7f51d6d61c9eaef62f7afd1a3e9a315516a795db9aca69a0c4
MD5 73c76c84e44fa6186617c1f31de892be
BLAKE2b-256 50fb5eba8026aee278a36de4458cbb43fc805dac73bc3f4982a333157e28e323

See more details on using hashes here.

Provenance

The following attestation bundles were made for spectral_library-0.2.0-py3-none-any.whl:

Publisher: release-package.yml on MarcYin/spectral_library

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

Supported by

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