code and model data below are based on this dataset:
Mapping Canopy Foliar Chemical and Morphological Traits Using Imaging Spectroscopy
-
01_Normalize.py: Takes AVIRIS spectra, applies the normalization routine to each row and produces an output CSV file.
-
02_ApplyModels.py: Takes the normalized spectra, applies the PLSR coefficients to get predictions on a spectrum-wise basis.
-
Bands.csv: Contains 'bad-band' specifications for AVIRIS data to simulate water absorption features that might need to be excluded.
-
ExampleSpectra.csv: Raw AVIRIS apparent surface reflectance spectra contaminated with water absorption features.
-
PLSR_coefficients_Raw_Aggregated_Nitrogen.csv: CSV file containing PLSR coefficients from Singh et al. (2015), these are coefficients aggregated from 500 randomized model runs.
-
PLSR_coefficients_Raw_Full_Nitrogen.csv: CSV file containing PLSR coefficients from Singh et al. (2015), these are coefficients from all 500 randomized model runs.
01_Normalize.py uses Bands.csv and ExampleSpectra.csv to produce vector-normalized spectra which are saved in ExampleSpectra_Normalized.csv
02_ApplyModels.py: uses ExampleSpectra_Normalized.csv and the PLSR_coefficients files to obtain predictions (%N in this example.)
I have included obtaining uncertainties for the sake of completeness, single predictions can be obtained by commenting out relevant lines of code in 02_ApplyModels.py.