spyndex.axioms.SpectralIndex

class spyndex.axioms.SpectralIndex(index: dict)[source]

Spectral Index object.

This object allows interaction with specific Spectral Indices in the Awesome Spectral Indices list. Attributes of the Spectral Index can be accessed and the index itself can be computed.

See also

SpectralIndices

Spectral Indices object.

Examples

>>> import spyndex
>>> spyndex.indices.NIRv
SpectralIndex(NIRv: Near-Infrared Reflectance of Vegetation)
    * Application Domain: vegetation
    * Bands/Parameters: ('N', 'R')
    * Formula: ((N-R)/(N+R))*N
    * Reference: https://doi.org/10.1126/sciadv.1602244
>>> spyndex.indices.NIRv.contributor
'https://github.com/davemlz'
>>> spyndex.indices.NIRv.compute(N = 0.67,R = 0.12)
0.4664556962025317

Attributes

short_name

Short name of the Spectral Index.

long_name

Long name of the Spectral Index.

bands

Required bands and parameters for the Spectral Index computation.

reference

URL to the reference/DOI of the Spectral Index.

formula

Formula (as expression) of the Spectral Index.

date_of_addition

Date of addition of the Spectral Index to Awesome Spectral Indices.

contributor

Contributor of the Spectral Index to Awesome Spectral Indices.

Methods

compute([params])

Computes a Spectral Index.

compute(params=None, **kwargs)[source]

Computes a Spectral Index.

Parameters:
  • params (dict) – Parameters used as inputs for the computation. The input data must be compatible with Overloaded Operators. Some inputs’ types supported are pandas series, numpy arrays, xarray objects and numeric objects. Earth Engine objects are also compatible when using eemont.

  • kwargs – Parameters used as inputs for the computation as keyword pairs. Ignored when params is defined.

Returns:

Computed Spectral Index.

Return type:

Any

Examples

Compute a Spectral Index by passing the required params dictionary:

>>> import spyndex
>>> spyndex.indices.NDVI.compute(
...     params = {
...         "N": 0.643,
...         "R": 0.175
...     }
... )
0.5721271393643031

Compute a Spectral Index by passing the required params as keyword pairs:

>>> spyndex.indices.NDVI.compute(N = 0.643, R = 0.175, L = 0.5)
0.5721271393643031