I am a new Google Earth Engine
user and I am trying to understand basic procedures/functions. More specifically, I want to remove clouds, cloud shadows and snow pixels form a Landsat 8 collection and then, calculate the NDVI
. I have found the following sample code but I can not understand how to remove apart from the clouds, the cloud shadows and the snow. I think the Fmask
might be he way to do this but I can not understand this.
Example code from Google Earth Engine API:
// This function masks clouds in Landsat 8 imagery.
var maskClouds = function(image) {
var scored = ee.Algorithms.Landsat.simpleCloudScore(image);
return image.updateMask(scored.select(['cloud']).lt(20));
};
// This function masks clouds and adds quality bands to Landsat 8 images.
var addQualityBands = function(image) {
return maskClouds(image)
// NDVI
.addBands(image.normalizedDifference(['B5', 'B4']))
// time in days
.addBands(image.metadata('system:time_start'));
};
// Load a 2014 Landsat 8 ImageCollection.
// Map the cloud masking and quality band function over the collection.
var collection = ee.ImageCollection('LANDSAT/LC08/C01/T1_TOA')
.filterDate('2014-06-01', '2014-12-31')
.map(addQualityBands);
// Create a cloud-free, most recent value composite.
var recentValueComposite = collection.qualityMosaic('system:time_start');
// Create a greenest pixel composite.
var greenestPixelComposite = collection.qualityMosaic('nd');
// Display the results.
Map.setCenter(-122.374, 37.8239, 12); // San Francisco Bay
var vizParams = {bands: ['B5', 'B4', 'B3'], min: 0, max: 0.4};
Map.addLayer(recentValueComposite, vizParams, 'recent value composite');
Map.addLayer(greenestPixelComposite, vizParams, 'greenest pixel composite');