The Normalized Difference Snow Index
The Normalized Difference Snow Index (NDSI) was designed to estimate the amount of a pixel covered in snow (Riggs et al. 1994):
NDSI = (green – SWIR) / (green + SWIR)
// User specified parameters
// setup Visualization
var viz = {min:-0.50, max:0.75, palette:['red', 'green', 'blue', 'white']};
// Data
// get landsat 8 image
var image = ee.Image("LANDSAT/LC08/C01/T1_RT_TOA/LC08_148035_20131103");
// Functions
// calculate ndsi
var ndsi = image.normalizedDifference(['B3', 'B6']);
// Add to map
Map.addLayer(ndsi,viz,"snow index K2");
Map.centerObject(ndsi,7);