2

I work with google earth engine on an imageCollection from landsat7. Some of those images are 'corrupted'. So I would like to remove one image from an image collection.

Actually I have :

var collectionLS7NDVI0 = ee.ImageCollection('LANDSAT/LE7_L1T_32DAY_NDVI')
    .filter(ee.Filter.calendarRange(6,6,'month'))
    .map(addTime);

var listOfImages = collectionLS7NDVI0.toList(collectionLS7NDVI0.size());
print(listOfImages)
0: 
Image LANDSAT/LE7_L1T_32DAY_NDVI/19990610 (2 bands)
1: 
Image LANDSAT/LE7_L1T_32DAY_NDVI/20000609 (2 bands)
2: 
Image LANDSAT/LE7_L1T_32DAY_NDVI/20010610 (2 bands)
3: 
Image LANDSAT/LE7_L1T_32DAY_NDVI/20020610 (2 bands)
4: 
Image LANDSAT/LE7_L1T_32DAY_NDVI/20030610 (2 bands)
5: 
Image LANDSAT/LE7_L1T_32DAY_NDVI/20040609 (2 bands)
6: 
Image LANDSAT/LE7_L1T_32DAY_NDVI/20050610 (2 bands)
7: 
Image LANDSAT/LE7_L1T_32DAY_NDVI/20060610 (2 bands)
8: 
Image LANDSAT/LE7_L1T_32DAY_NDVI/20070610 (2 bands)
9: 
Image LANDSAT/LE7_L1T_32DAY_NDVI/20080609 (2 bands)
10: 
Image LANDSAT/LE7_L1T_32DAY_NDVI/20090610 (2 bands)
11: 
Image LANDSAT/LE7_L1T_32DAY_NDVI/20100610 (2 bands)
12: 
Image LANDSAT/LE7_L1T_32DAY_NDVI/20110610 (2 bands)
13: 
Image LANDSAT/LE7_L1T_32DAY_NDVI/20120609 (2 bands)
14: 
Image LANDSAT/LE7_L1T_32DAY_NDVI/20130610 (2 bands)
15: 
Image LANDSAT/LE7_L1T_32DAY_NDVI/20140610 (2 bands)
16: 
Image LANDSAT/LE7_L1T_32DAY_NDVI/20150610 (2 bands)
17: 
Image LANDSAT/LE7_L1T_32DAY_NDVI/20160609 (2 bands)

And I want to remove images 6 (2005).

Any ideas are welcome

Etienne

  • The function "addTime" is not defined. Is it needed to illustrate your issue? – Tyler Erickson Nov 30 '17 at 21:01
4

You can remove images of a collection by constructing a filter that selects the images you want to remove, then negate the filter using ee.Filter.not().

var MAX_LIST_SIZE = 100;

var collectionLS7NDVI0 = ee.ImageCollection('LANDSAT/LE7_L1T_32DAY_NDVI')
    .filter(ee.Filter.calendarRange(6,6,'month'));
print('listOfImages', collectionLS7NDVI0.toList(MAX_LIST_SIZE));

// Filter out image(s) from 2005.
var filtered = collectionLS7NDVI0.filter(
  ee.Filter.date('2005', '2006').not()
);
print('filtered', filtered.toList(MAX_LIST_SIZE));

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.