//VERSION=3//Reference: https://earth.esa.int/web/sentinel/technical-guides/sentinel-2-msi/level-2a/algorithmletviz=newIdentity();functionsetup(){return{input:["B03","B11","B04","B02","dataMask"],output:[{id:"default",bands:4},{id:"index",bands:1,sampleType:"FLOAT32"}]};}functionevaluatePixel(samples){letval=index(samples.B03,samples.B11);letimgVals=null;// The library for tiffs works well only if there is only one channel returned.// So we encode the "no data" as NaN here and ignore NaNs on frontend.constindexVal=samples.dataMask===1?val:NaN;if(val>0.42)imgVals=[0,0.8,1,samples.dataMask];elseimgVals=[2.5*samples.B04,2.5*samples.B03,2.5*samples.B02,samples.dataMask];return{default:imgVals,index:[indexVal]};}
The Sentinel-2 normalised difference snow index can be used to differentiate between cloud and snow cover as snow absorbs in the short-wave infrared light, but reflects the visible light, whereas cloud is generally reflective in both wavelengths. Snow cover is represented in bright vivid blue.
Description of representative images
Visualized NDSI over New Zealand, acquired on 2019-09-19.