import json with open("output/spectral-indices-dict.json", "r") as f: data = json.load(f) previousText = """

Awesome Spectral Indices

A ready-to-use curated list of Spectral Indices for Remote Sensing applications.

Awesome Awesome Spectral Indices Streamlit Tests Documentation DOI GitHub Sponsors Buy me a coffee Ko-fi Twitter Black

--- **GitHub**: github.com/awesome-spectral-indices/awesome-spectral-indices **Documentation**: awesome-ee-spectral-indices.readthedocs.io **Python Package**: github.com/awesome-spectral-indices/spyndex **Paper**: doi.org/10.1038/s41597-023-02096-0 **Streamlit App**: github.com/awesome-spectral-indices/espectro **Google Earth Engine**: github.com/davemlz/eemont (Python), github.com/awesome-spectral-indices/spectral (JavaScript) and github.com/r-earthengine/rgeeExtra (R) **Julia Package**: github.com/awesome-spectral-indices/SpectralIndices.jl --- # Spectral Indices Spectral Indices are widely used in the Remote Sensing community. This repository keeps track of classical as well as novel spectral indices for different Remote Sensing applications. All spectral indices in the repository are curated and can be used in different environments and programming languages. You can check the [curated list of spectral indices here](https://github.com/awesome-spectral-indices/awesome-spectral-indices/blob/main/output/spectral-indices-table.csv), and if you want to use it in your environment, it is available in [CSV](https://raw.githubusercontent.com/awesome-spectral-indices/awesome-spectral-indices/main/output/spectral-indices-table.csv) and [JSON](https://raw.githubusercontent.com/awesome-spectral-indices/awesome-spectral-indices/main/output/spectral-indices-dict.json). ## Citation If you use this work, please consider citing the following paper: ```bibtex @article{montero2023standardized, title={A standardized catalogue of spectral indices to advance the use of remote sensing in Earth system research}, author={Montero, David and Aybar, C{\'e}sar and Mahecha, Miguel D and Martinuzzi, Francesco and S{\"o}chting, Maximilian and Wieneke, Sebastian}, journal={Scientific Data}, volume={10}, number={1}, pages={197}, year={2023}, publisher={Nature Publishing Group UK London} } ``` ## Attributes All spectral indices follow a standard. Each item of the list has the following attributes: - `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. `"(G - N)/(G + N)"`). - `bands`: List of required bands/parameters for the index computation (e.g. `["N","G"]`). - `platforms`: List of platforms with the required bands for the index computation (e.g. `["MODIS", "Landsat-457", "Landsat-89", "Sentinel-2"]`). - `reference`: Link to the index reference/paper/doi (e.g. `"https://doi.org/10.1080/01431169608948714"`). - `application_domain`: Application domain 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 contributor (e.g. `"https://github.com/davemlz"`). ## Expressions The formula of the index is presented as a string/expression (e.g. `"(N - R)/(N + R)"`) that can be easily evaluated. The parameters used in the expression for each index follow this standard:
Description Standard Spectral Range (nm) Sentinel-2 Landsat-89 Landsat-457 MODIS
Aerosols A 400 - 455 B1 B1
Blue B 450 - 530 B2 B2 B1 B3
Green 1 G1 510 - 550 B11
Green G 510 - 600 B3 B3 B2 B4
Yellow Y 585 - 625
Red R 620 - 690 B4 B4 B3 B1
Red Edge 1 RE1 695 - 715 B5
Red Edge 2 RE2 730 - 750 B6
Red Edge 3 RE3 765 - 795 B7
NIR N 760 - 900 B8 B5 B4 B2
NIR 2 N2 850 - 880 B8A
Water Vapour WV 930 - 960 B9
SWIR 1 S1 1550 - 1750 B11 B6 B5 B6
SWIR 2 S2 2080 - 2350 B12 B7 B7 B7
Thermal T 10400 - 12500 B6
Thermal 1 T1 10600 - 11190 B10
Thermal 2 T2 11500 - 12510 B11
In the case of RADAR Indices, the bands follow this standard:
Description Standard Sentinel-1
Backscattering Coefficient HV HV HV
Backscattering Coefficient VH VH VH
Backscattering Coefficient HH HH HH
Backscattering Coefficient VV VV VV
Additional index parameters also follow a standard: - `g`: Gain factor (e.g. Used for EVI). - `L`: Canopy background adjustment (e.g. Used for SAVI and EVI). - `C1`: Coefficient 1 for the aerosol resistance term (e.g. Used for EVI). - `C2`: Coefficient 2 for the aerosol resistance term (e.g. Used for EVI). - `cexp`: Exponent used for OCVI. - `nexp`: Exponent used for GDVI. - `alpha`: Weighting coefficient used for WDRVI, BWDRVI and NDPI. - `beta`: Calibration parameter used for NDSIns. - `gamma`: Weighting coefficient used for ARVI. - `omega`: Weighting coefficient used for MBWI. - `sla`: Soil line slope. - `slb`: Soil line intercept. - `PAR`: Photosynthetically Active Radiation. - `k`: Slope parameter by soil used for NIRvH2. - `lambdaN`: NIR wavelength used for NIRvH2 and NDGI. - `lambdaR`: Red wavelength used for NIRvH2 and NDGI. - `lambdaG`: Green wavelength used for NDGI. The kernel indices are constructed using a special type of parameters: - `kAB`: Kernel of bands/parameters `A` and `B` (e.g. `kNR` means `k(N,R)`, where `k` is the kernel function). - `p`: Kernel degree (used for the polynomial kernel). - `c`: Free parameter that trades off the influence of higher-order versus lower-order terms (used for the polynomial kernel). # Call for Indices! :rotating_light: Researchers that have published (or aim to publish) their novel spectral indices are encouraged to add them to this repository! The list of spectral indices is used as a source for different resources that allow spectral indices computation in different environments (such as Python and Google Earth Engine). To add an index, please follow the [Contribution Guidelines](https://awesome-ee-spectral-indices.readthedocs.io/en/latest/contributing.html). In the same line, if you know an spectral index that is not included in this repository, you are encouraged to add it! Please follow the [Contribution Guidelines](https://awesome-ee-spectral-indices.readthedocs.io/en/latest/contributing.html) in order to add it. And one more thing: If you see an error in one or several indices, please report it or update the index (indices) by following the [Contribution Guidelines](https://awesome-ee-spectral-indices.readthedocs.io/en/latest/contributing.html)! There is no deadline. The repository is continuously updated! # Used by ## JavaScript - [spectral](https://github.com/davemlz/spectral): Awesome Spectral Indices for the Google Earth Engine JavaScript API (Code Editor). ## Python - [eemont](https://github.com/davemlz/eemont): A Python package that extends Google Earth Engine. - [eeExtra](https://github.com/r-earthengine/ee_extra): A Python package that unifies the Google Earth Engine ecosystem. - [Espectro](https://github.com/davemlz/espectro): The Awesome Spectral Indices Streamlit App. - [spyndex](https://github.com/davemlz/spyndex): Awesome Spectral Indices in Python. ## Julia - [SpectralIndices.jl](https://github.com/awesome-spectral-indices/SpectralIndices.jl): Awesome Spectral Indices in Julia. ## R - [rgeeExtra](https://github.com/r-earthengine/rgeeExtra): High-level functions to process spatial and simple Earth Engine objects. # Spectral Indices by Application Domain """ nextText = """ # List Check the full list of spectral indices with their formulas [here](https://github.com/davemlz/awesome-ee-spectral-indices/blob/main/output/spectral-indices-table.csv). # Download Raw Files You can download or clone the repository: ``` git clone https://github.com/davemlz/awesome-ee-spectral-indices.git ``` Or you can download the single files here (right-click > Save link as...): - JSON: [Raw list](https://raw.githubusercontent.com/davemlz/awesome-ee-spectral-indices/main/output/spectral-indices-dict.json) - CSV: [Raw list](https://raw.githubusercontent.com/davemlz/awesome-ee-spectral-indices/main/output/spectral-indices-table.csv) # Credits - [César Aybar](https://github.com/csaybar): The formidable [pydantic](https://github.com/samuelcolvin/pydantic/) expert and creator of [rgee](https://github.com/r-spatial/rgee). """ platformBadges = { "MODIS": "![MODIS](https://img.shields.io/badge/-MODIS-green?style=flat-square)", "Landsat-457": "![Landsat-457](https://img.shields.io/badge/-Landsat%20457-blueviolet?style=flat-square)", "Landsat-89": "![Landsat-89](https://img.shields.io/badge/-Landsat%2089-blue?style=flat-square)", "Sentinel-1 (Dual Polarisation VV-VH)": "![Sentinel-1 (Dual Polarisation VV-VH)](https://img.shields.io/badge/-Sentinel%201%20(Dual%20VV%20VH)-lightgray?style=flat-square)", "Sentinel-1 (Dual Polarisation HH-HV)": "![Sentinel-1 (Dual Polarisation HH-HV)](https://img.shields.io/badge/-Sentinel%201%20(Dual%20HH%20HV)-gray?style=flat-square)", "Sentinel-2": "![Sentinel-2](https://img.shields.io/badge/-Sentinel%202-red?style=flat-square)", "Planet-Fusion": "![Planet-Fusion](https://img.shields.io/badge/-Planet%20Fusion-yellow?style=flat-square)", } platformBadgesHTML = { "MODIS": 'MODIS', "Landsat-TM": 'Landsat-TM', "Landsat-ETM+": 'Landsat-ETM+', "Landsat-OLI": 'Landsat-OLI', "Sentinel-1 (Dual Polarisation VV-VH)": '(Dual Polarisation VV-VH)', "Sentinel-1 (Dual Polarisation HH-HV)": '(Dual Polarisation HH-HV)', "Sentinel-2": 'Sentinel-2', "Planet-Fusion": 'Planet-Fusion', } letters = list(map(chr, range(65, 91))) def filterByAppDomain(): indices = [] for index, attributes in data["SpectralIndices"].items(): if attributes["application_domain"] == appDomain: indices.append(index) return indices # text = [] # for appDomain in ["vegetation","water","burn","snow","urban","kernel","radar"]: # text.append(f"## {appDomain.capitalize()}\n\n") # for letter in letters: # if any([x.upper().startswith(letter) for x in filterByAppDomain()]): # text.append(f"### {letter}\n") # for index, attributes in data["SpectralIndices"].items(): # if attributes['type'] == appDomain: # if index.startswith(letter) or index.startswith(letter.lower()): # line = f"- [{index}]({attributes['reference']}): {attributes['long_name']}." # text.append(line) # for platform, badge in platformBadges.items(): # if platform in attributes['platforms']: # text.append(f" {badge} ") # text.append("\n") text = [] for appDomain in [ "vegetation", "water", "burn", "snow", "urban", "soil", "kernel", "radar", ]: text.append(f"\n## {appDomain.capitalize()}\n\n") for letter in letters: if any([x.upper().startswith(letter) for x in filterByAppDomain()]): # text.append(f'\n### {letter}\n
') for index, attributes in data["SpectralIndices"].items(): if attributes["application_domain"] == appDomain: if index.startswith(letter) or index.startswith(letter.lower()): link = attributes["reference"] name = attributes["long_name"] line = f'\n") text.append("
{index}: {name}.' text.append(line) for platform, badge in platformBadgesHTML.items(): if platform in attributes["platforms"]: text.append(f" {badge} ") text.append("
\n") with open("README.md", "w") as f: f.write(previousText + "".join(text) + nextText)