FOSS4G 2022 academic track

spectral: Awesome Spectral Indices for the Google Earth Engine JavaScript API
2022-08-25, 15:15–15:45 (Europe/Rome), Academic online

Spectral Indices derived from Remote Sensing data are widely utilized for understanding Earth System dynamics. Accelerated climate and land change makes the monitoring of Earth surface processes a top priority. Vegetation Indices (VIs) are a set of indices developed to better understand biosphere processes, including potential photosynthetic activity, thereby providing key information for the terrestrial carbon cycle. Urban Indices (UIs) are designed to study anthropogenic footprint on the environment identifying artificial surfaces and their extent. Other types of indices such as Water Indices (WIs) and Burn/Fire Indices are also being constantly developed for understanding hydrological processes and the impact of extreme events on the biosphere, respectively. The increasing amount of spectral indices led to the creation of spectral indices catalogs, such as Awesome Spectral Indices, an open-source catalog with more than 100 spectral indices. Each spectral index in this catalog has numerous attributes, including the index name, formula, reference, and other additional metadata. This catalog is part of an ecosystem that allows users to query and compute spectral indices in a Python environment for different data types, including Google Earth Engine (GEE) classes. GEE is a cloud-based geospatial processing service for vector and raster data (Gorelick et al., 2021). It includes a multi-petabyte catalog of remote sensing data that users may explore online. The GEE Application Programming Interface (API) is exposed and accessible through JavaScript and Python client libraries. While the JavaScript API is more advantageous for rapid prototyping through the Code Editor, the GEE web-based Integrated Development Environment (IDE), it lacks Python's ability to integrate third-party packages. Multiple tools for computing spectral indices, including mathematical raster operations, normalized difference methods, and expressions evaluation methods in the case of more sophisticated indices have been developed in the source API. In the meanwhile, third-party Python packages have implemented methods for automatically computing spectral indices without hard-coding them in the GEE Python API (Montero, 2021). However, users still have to hard-code the desired spectral indices for the JavaScript API since there are no implementations that link spectral indices catalogs to the Code Editor for their easy calculation. Here we present spectral, a JavaScript module that links the Awesome Spectral Indices Catalog to GEE for querying and computing spectral indices inside the GEE Code Editor. The spectral module uses the Awesome Spectral Indices Catalog and implements several functions that leverage the access and computation of spectral indices for multiple remote sensing products in the GEE catalog. As a primary component of the module, all spectral indices, as well as their attributes from Awesome Spectral Indices, are available for querying by using a key-value model represented by a JSON object. As a secondary component, users can compute one or more spectral indices by using a single method and passing the required bands for the spectral indices computation as a dictionary of parameters. This method uses the expression of the index, contained as an attribute in the spectral indices catalog, for evaluating it as an image object in GEE. Furthermore, the module adds an additional method to compute kernel images for novel generalized kernel indices such as the kNDVI (Camps-Valls et al., 2021). Kernels such as the Polynomial Kernel as well as the Radial Basis Function (RBF) Kernel are included. As an additional feature for preprocessing raster datasets, the module also implements two methods for automatically scaling and offsetting all raster datasets included in the GEE catalog, thus, leveraging this mandatory manual step for several spectral indices that are not normalized. The spectral module demonstrates that spectral indices can be easily computed inside the GEE Code Editor by automatizing most of the hard-code scripting. Image objects, as well as image collection objects, can be used for the calculation of all spectral indices in the catalog if the specific raster dataset counts with the required bands. This principle applies to most raster datasets in GEE, including Landsat Series and most products of the Sentinel Series, as well as MODIS and VIIRS reflectance products. Furthermore, generalized kernel indices can be used in their pure form, allowing their spatio-temporal optimization by enabling the scale-length parameter as a free user choice in the RBF Kernel or the polynomial degree in the Polynomial Kernel. We anticipate that spectral will be used by most GEE users for Earth System research as well as for educational purposes in Remote Sensing. Analyses conducted by scientists, researchers and students will be sped up by avoiding hard-coding and Remote Sensing investigations using GEE will be boosted. Furthermore, novel indices will increase their visibility for different projects where they can be useful without taking out the visibility of standard and classical spectral indices. The module is open-source and it is hosted on GitHub ( with an MIT License, allowing contributions from the community. Prior experience in Remote Sensing can make it easier to get started using the module, however, it is not required and the module counts with several tutorials and a complete documentation oriented to beginners.

I'm a Research Assistant at the Remote Sensing Centre for Earth System Research (RSC4Earth) and a PhD Student at the University of Leipzig (Leipzig, Germany). I have a MSc in Data Science from the University of Cantabria (Santander, Spain) and a BEng in Topographic Engineering from the University of Valle (Cali, Colombia). My research interests include Remote Sensing of Vegetation, Machine Learning and Extreme Events. I'm the creator of eemont, spectral, spyndex and other open-source projects like Awesome Spectral Indices.