Using the standard Earth Engine Quality Mosaic function I have successfully compiled Greenest Pixel mosaic for multiple years using Landsat 8 and Landsat 5. However recently I encountered an issue with Landsat 5 images prior to 2003 when the task is run (no errors in the console). In the Run output I get the error:
"Error: Image.select: Pattern 'NDVI' did not match any bands"
The source script has worked perfectly for other years (including Landsat 8 TOA). Is there an issue with using the Greenest Pixel quality mosaic for pre-2003 Landsat 5 images?
Map.addLayer(fc);
Map.addLayer(bounding);
var start = ee.Date('2002-07-01');
var finish = ee.Date('2003-06-30');
var L8_Mackay_2002_2003_Greenest = ee.ImageCollection('LANDSAT/LT05/C01/T1_TOA')
.filterBounds(fc)
.filterDate(start,finish);
var count = L8_Mackay_2002_2003_Greenest.size();
var cloudlessNDVI = L8_Mackay_2002_2003_Greenest.map(function(image) {
// Get a cloud score in [0, 100].
var cloud = ee.Algorithms.Landsat.simpleCloudScore(image).select('cloud');
// Create a mask of cloudy pixels from an arbitrary threshold.
var mask = cloud.lte(20);
// Compute NDVI.
var ndvi = image.normalizedDifference(['B4', 'B3']).rename('NDVI');
// Return the masked image with an NDVI band.
return image.addBands(ndvi).updateMask(mask);
});
var greenest_Mackay_2002_2003 = cloudlessNDVI.qualityMosaic('NDVI');
var greenest_Mackay_2002_2003_image = ee.Image(greenest_Mackay_2002_2003)
.select (['NDVI']);
// Export the image, specifying scale and region.
Export.image.toDrive({
image: greenest_Mackay_2002_2003_image,
description: 'greenest_Mackay_2002_2003_image',
scale: 30,
region: bounding
});