Do you want to contribute?

Contributing to the list is pretty simple:

The easiest way

Open an issue with the following information:

  • short_name: Short name of the index (e.g. "NDWI").

  • long_name: Long name of the index (e.g. "Normalized Difference Water Index").

  • formula: Expression/formula of the index (e.g. "(N - G)/(N + G)").

  • reference: Link to the index reference/paper/doi (e.g. "https://doi.org/10.1080/01431169608948714").

  • type: Type/application of the index (e.g. "water").

  • date_of_addition: Date of addition to the list (e.g. "2021-04-07").

  • contributor: GitHub user link of the vcontributor (e.g. "https://github.com/davemlz").

For the formula attribute, the standard variables for spectral indices expressions must be followed:

Standard variables for bands and parameters.

Description

Standard

Aerosols

A

Blue

B

Green

G

Red

R

Red Edge 1

RE1

Red Edge 2

RE2

Red Edge 3

RE3

Red Edge 4

RE4

NIR

N

SWIR 1

S1

SWIR 2

S2

Thermal 1

T1

Thermal 2

T2

Gain Factor

g

Canopy Background Adjustment

L

Coefficient 1 for the aerosol resistance term

C1

Coefficient 2 for the aerosol resistance term

C2

Exponent used for OCVI.

cexp

Exponent used for GDVI.

nexp

Weighting coefficient used for WDRVI.

alpha

Weighting coefficient used for ARVI.

gamma

Weighting coefficient used for MBWI.

omega

Soil line slope.

sla

Soil line intercept.

slb

Photosynthetically Active Radiation.

PAR

Slope parameter by soil used for NIRvH2.

k

NIR wavelength used for NIRvH2 and NDGI.

lambdaN

Red wavelength used for NIRvH2 and NDGI.

lambdaR

Green wavelength used for NDGI.

lambdaG

k(A,B)

kAB

We’ll take the information to create a new index, test the index and add it to the list!

The not so hard way

  1. Install the required dependencies:

pydantic
typing
orjson
py_expression_eval
  1. Fork the repository and clone it to your local machine.

  2. Create a development branch:

git checkout -b name-of-dev-branch
  1. Open the src/indices.py file: The list of indices is stored in a DataClass called SpectralIndices. At the end of the file, add a new index (example shown below):

SeLI=SpectralIndex(
    short_name='SeLI',
    long_name='Sentinel-2 LAI Green Index',
    formula='(RE4 - RE1) / (RE4 + RE1)',
    reference='https://doi.org/10.3390/s19040904',
    type='vegetation',
    date_of_addition='2021-04-08',
    contributor="https://github.com/davemlz"
)
  • The SpectralIndex class is a validator created using pydantic. This validator validates the added data.

Important

The formula must follow the standard variables for each band or parameter.

  1. Test the new index (or indices):

python test/test_indices.py
  1. Commit your changes:

git add .
git commit -m "short-name-of-the-index ADDED"
git push origin name-of-dev-branch
  1. Submit a pull request with the tests.