1

I'm attempting to merge Landsat 4, Landsat 5, and Landsat 7 imagery into a single image collection in Google Earth Engine, in hopes of running simpleComposite() on the entire collection.

var geo = ee.Geometry.Polygon([
  [[-144.887,61.468], 
   [-141.712,61.468], 
   [-141.712,62.454], 
   [-144.887,62.454], 
   [-144.887,61.468]]
]);

Map.centerObject(geo, 8);
var startDate = '1999-01-01';
var endDate = '2000-01-01';

var ls45_bands = ['B1', 'B2',  'B3',  'B4',  'B5', 'B7', 'B6']; 
var ls7_bands = ['B1', 'B2',  'B3',  'B4',  'B5', 'B7', 'B6_VCID_2'];
var std_names = ['B1', 'B2',  'B3',  'B4',  'B5', 'B7', 'B6']; 

var ls4 = ee.ImageCollection("LANDSAT/LT04/C01/T1").select(ls45_bands, std_names);
var ls5 = ee.ImageCollection("LANDSAT/LT05/C01/T1").select(ls45_bands, std_names);
var ls7 = ee.ImageCollection("LANDSAT/LE07/C01/T1").select(ls7_bands, std_names);

var lsAll = ee.ImageCollection(ls4.merge(ls5).merge(ls7));
var lsAll = ee.ImageCollection(lsAll)
      .filterBounds(geo)
      .filterDate(startDate, endDate)
      .filter(ee.Filter.calendarRange(6, 8, 'month'))
      .filterMetadata('CLOUD_COVER', 'less_than', 50);

var composite = ee.Algorithms.Landsat.simpleComposite({
  collection: lsAll,
}).clip(geo);  

Map.addLayer(composite, null, 'composite');

I renamed the relevant bands properly as outlined here:

Merging raw data from Landsat 5, Landsat 7 and Landsat 8

However, I get this error:

composite: Tile error: Error in map(ID=2_LE07_066017_19990818): Landsat.simpleCloudScore: No band named 'B6_VCID_2'. Available band names: [B1, B2, B3, B4, B5, B7, B6].

It seems that simpleComposite() identifies if an image is from Landsat 7 and requires that the B6_VCID_2 band is there in order to calculate simpleCloudScore. How should I merge these collections so that I can apply simpleComposite() to all of the images? I did find a workaround where I took the Simple Composite of Landsat 4/5 and Landsat 7 individually, and then took the median of these two images. However, it fails when one of the collections is empty. The code for that is here.

Sorry if this question is poorly asked. I'm a high schooler new to GEE.

1

SimpleComposite basically just runs SimpleCloudScore and does a qualityMosaic of the result. You can do that on your own. There's a javascript version of the cloud score in the Examples section

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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