1

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"

Error screen grab

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
});

Greenest Pixel Mosaic Earth Engine Code

1 Answer 1

2

There are no images in the area of Mackay in those years, therefore the band name 'NDVI' does not exist. You should check with the data provider (NASA) why this is the case).

You can easily check anywhere on the world if there are (and how many) images in certain years using this chart:

var L5 = ee.ImageCollection('LANDSAT/LT05/C01/T1_TOA')
          .filterBounds(geometry);

var years = ee.List.sequence(1980,2020);
var counts = years.map(function(year){
  var count = L5.filterDate(
    ee.Date.fromYMD(year,1,1), ee.Date.fromYMD(ee.Number(year).add(1),1,1)).size();
    return count;
});

print(ui.Chart.array.values(ee.Array.cat([counts]), 0, years)
    .setChartType('ColumnChart'));

link code

3
  • Thanks @Kuik - I had no idea there was missing data for Landsat. I thought recently all global coverage had been condensed. I'll follow with NASA. Thanks
    – Jock
    Jan 31, 2020 at 1:41
  • Interestingly, there are images in the LANDSAT/LT05/C01/T1_8DAY_NDVI collection.
    – Jock
    Jan 31, 2020 at 1:45
  • Hmm yeah that's weird. There should be data according to landlook.usgs.gov/viewer.html, so you'd better contact the support of GEE.
    – Kuik
    Jan 31, 2020 at 4:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.