Add spectral transforms (PCA, MNF, Tasseled Cap, pan-sharpening)

Open
#1,139 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
30/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Quiet
Tech stack
python
Domain
data

Research direction

No files, tests, or entry points are named. Start by reviewing the existing xarray-spatial raster APIs and the dask and numba patterns relevant to stacked DataArrays. Done requires defining and implementing the requested transforms, including built-in Tasseled Cap coefficients, while preserving the stated input and output format.

Written by the indexing model from the issue text.

Description

after-1.0.0-release enhancement

Multi-band and hyperspectral analysis needs dimensionality reduction and spectral transforms. xarray-spatial doesn't have any of these right now.

Scope

PCA on multi-band rasters. Standard principal component analysis across the band dimension. Useful for reducing dimensionality, identifying variance structure, and creating decorrelated bands for visualization or classification.

Minimum Noise Fraction (MNF) transform. Two-step PCA that first whitens the noise, then extracts signal components. The go-to for hyperspectral noise reduction and data exploration.

Tasseled Cap transformation. Fixed linear combinations that produce Brightness, Greenness, and Wetness bands. Should ship with built-in coefficients for at least Landsat 8/9 and Sentinel-2. Users should also be able to supply custom coefficient matrices.

Linear spectral unmixing. Given user-supplied endmember spectra, solve for per-pixel fractional abundances. Returns one fraction image per endmember.

Pan-sharpening. Fuse a high-resolution panchromatic band with lower-resolution multispectral bands. At minimum the Brovey transform (simple, fast). Gram-Schmidt would be a good addition for better spectral fidelity.

Design considerations

  • All functions should accept stacked DataArrays with a band dimension and return stacked DataArrays in the same format.
  • PCA and MNF are the hardest to distribute via dask because they need global covariance matrices. Two options: use dask's own da.linalg for the covariance/eigen decomposition, or use a sample-based approximation that avoids a full pass over the data.
  • Tasseled Cap and Brovey are per-pixel linear operations, so they parallelize trivially with map_blocks.
  • Spectral unmixing is per-pixel too (constrained least-squares per pixel), but the solve step is heavier. GPU acceleration with cupy would help.
Dominant language
Python
Stars
972
Forks
92
Avg merge
2d 12h
Merged PRs (30d)
7

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from xarray-contrib/xarray-spatial

All issues in xarray-contrib/xarray-spatial

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.