Cres Module

———————————————————————————————————————-
Date : August 2018
Copyright : © 2018 - 2020 by Ann Crabbé (KU Leuven)
Acknowledgements : Translated from VIPER Tools 2.0 (UC Santa Barbara, VIPER Lab).
Dar Roberts, Kerry Halligan, Philip Dennison, Kenneth Dudley, Ben Somers, Ann Crabbé

This file is part of the Spectral Libraries QGIS plugin and python package.

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public
License as published by the Free Software Foundation, either version 3 of the License, or any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License (COPYING.txt). If not see www.gnu.org/licenses.
———————————————————————————————————————-
class spectral_libraries.core.cres.Cres[source]

Bases: object

Constrained Reference Endmember Selection. Unmix a given signal with all models in a library. Then create an index to see which models are a close match to estimated fractions.

Citations:

Roberts, D.A., Smith, M.O., Adams, J.B., 1993, Green vegetation, non-photosynthetic vegetation and soils in AVIRIS data, Remote Sensing of Environment, 44, p. 255-270.

Roberts, D.A., Batista, G., Pereira, J., Waller, E., and Nelson, B., 1999, Change Identification using Multitemporal Spectral Mixture Analysis: Applications in Eastern Amazonia, Remote Sensing Change Detection: Environmental Monitoring Methods and Applications, Edited by Elvidge, C. and Lunetta R., Chapter 9, p. 137-161.

execute(signal: numpy.array, library: numpy.array, classes: list, spectrum_names: list, rmse_constraint: float = 0.025, shade: numpy.array = array([], dtype=float64))[source]

Unmix a given signal with a library and create fractions and RMSE values for each endmember in that library.

Parameters:
  • signal – The signal to unmix, without bad bands and scaled to reflectance values.
  • library – The library used for unmixing, without bad bands and scaled to reflectance values.
  • classes – The class of each spectrum in the library (e.g. GV, SOIL, …) [list-of-str]
  • spectrum_names – The name of each spectrum in the library [list-of-str]
  • rmse_constraint – Only keep models that fulfill this constraint.
  • shade – Shade-spectrum in case of non-photometric shade.
get_fractions() → list[source]

Get the calculated fractions (and RMSE) as a list of dictionaries, specifically designed for a QTableModel. In the list, each dictionary represents one endmember combination from the library (=one model). Assuming we have n classes in the library, each model’s dictionary has n key-value pairs with the spectra names, n key-value pairs with the fractions, one key-value pair with the shade fraction and one key-value pair with the RMSE.

The dictionary keys match the table header names.

Example for gv-soil mixture:

{gv_name: tree1, soil_name: clay4, gv_fraction: 0.25, soil_fraction: 0.55, shade_fraction: 0.20, rmse: 0.01}
Returns:A list of dictionaries, one per model, containing the spectra names, fractions and RMSE.
get_header() → list[source]

Get the header for the QTableModel. It has header names for the spectra names, fractions and RMSE. The header names match the keys in the table dictionaries.

Example for gv-soil mixture:

['gv_name', 'soil_name', 'gv_fraction', 'soil_fraction', 'shade_fraction', 'RMSE']
Returns:The header for the GUI QTableModel.
index(target_fractions: list, weight_per_target: list, weight_rmse: int) → dict[source]

Calculate the CRES indices based on input from the user.

Example for GV-SOIL-NPV mixture:

GV index = rmse weight * rmse
+ |GV calculated - estimated fraction| * GV weight
+ |SOIL calculated - estimated fraction|
+ |NPV calculated - estimated fraction|
+ |Shade calculated - estimated fraction|
Parameters:
  • target_fractions – The estimated fractions of the spectrum that is being unmixed (list-of-floats).
  • weight_per_target – The weights per class for calculating the indices (list-of-ints between 1 and 10).
  • weight_rmse – The weight attached to the RMSE for calculating the indices (int between 1 and 10).
Returns:

Indices for each endmember and each class. The unique classes from the library metadata are the keys.