I am trying to to calculate the ndvi for the full Landsat collection. At first I remove the clouds and then I try to calculate the ndvi index as follow. Unfortunately I do not get any results, does anyone has any ideas why the code does not work?
Thank you
Code:
// Function to cloud mask Landsat 8.
var maskL8SR = function(image) {
// Bits 3 and 5 are cloud shadow and cloud, respectively.
var cloudShadowBitMask = ee.Number(2).pow(3).int();
var cloudsBitMask = ee.Number(2).pow(5).int();
// Get the QA band.
var qa = image.select('pixel_qa');
// Both flags should be set to zero, indicating clear conditions.
var mask = qa.bitwiseAnd(cloudShadowBitMask).eq(0).and(
qa.bitwiseAnd(cloudsBitMask).eq(0));
return image
// Scale the data to reflectance and temperature.
.select(['B4', 'B5'], ['Red', 'NIR']).multiply(0.0001)
.updateMask(mask);
};
var lst8 = ee.ImageCollection('LANDSAT/LC08/C01/T1_SR')
.filterDate('2013-04-07', '2018-05-01')
.filterBounds(geometry)
.map(maskL8SR)
.map(addNDVI_l8).select('NDVI');
lst8 = lst8.map(addNDVI_l8);
lst8 = lst8.filterBounds(geometry);