我正在尝试计算完整 Landsat 集合的 ndvi。首先,我移除了云层,然后我尝试按如下方式计算 ndvi 指数。不幸的是我没有得到任何结果,有没有人知道为什么代码不起作用?
谢谢
代码:
// 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);