davemlz / eemont

A python package that extends Google Earth Engine.
https://eemont.readthedocs.io/
MIT License
412 stars 69 forks source link

How does the spectralIndices function pick correct bands for an index? #85

Open holgervirro opened 2 weeks ago

holgervirro commented 2 weeks ago

I was looking at the documentation for the eemont package at https://eemont.readthedocs.io/en/latest/ and saw an example of calculating spectral indices for a Sentinel-2 image collection with the following method:

S2 = (ee.ImageCollection('COPERNICUS/S2_SR').filterBounds(point).closest('2020-10-15').maskClouds(prob = 70).scaleAndOffset().spectralIndices(['NDVI','NDWI','BAIS2']))

I had a question about the spectralIndices function applied in this example.

How does the function know which bands to use for calculating the indices? Does it somehow detect the data source (e.g. Sentinel-2) and then pick the suitable bands needed for a particular index?

Looking forward to your response!

davemlz commented 3 days ago

You are right!

We pre-select the bands from some popular platforms beforehand ;)

The bands are selected according to the Awesome Spectral Indices standard: https://github.com/awesome-spectral-indices/awesome-spectral-indices?tab=readme-ov-file#expressions

I hope this solves your question!

Cheers,

David