-
Notifications
You must be signed in to change notification settings - Fork 86
Add spectral transforms (PCA, MNF, Tasseled Cap, pan-sharpening) #1139
Description
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.linalgfor 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.