I am using air surface temp data from 2015 in Google Earth Engine but there is missing data for June 19, 2015 which is assigned the value 9.9621e+36.

So I need to create a date range from Jan 1 2015 to Dec 31 2015 which excludes June 19 2015. I know how to filter by date:

var AST2015 = ee.ImageCollection('NCEP_RE/surface_temp')
                .filterDate('2015-01-01', '2015-12-31');

But as long as that one June date is in their my mean and other stats are ruined. SOS


You can remove images from an image collection by creating a date filter for the 'bad/missing' data and then remove it using ee.Filter.not(). For example:

var collection = ee.ImageCollection('NCEP_RE/surface_temp');
var AST2015 = collection.filterDate('2015-01-01', '2016-01-01');

var start_bad_data = '2015-06-18T00:00:00';
var end_bad_data = '2015-06-20T00:00:00';
var bad_data_filter = ee.Filter.date(start_bad_data, end_bad_data);

// Select the bad data.
var AST2015_bad_data = AST2015.filter(bad_data_filter);
// Select the good data.
var AST2015_good_data = AST2015.filter(bad_data_filter.not());

Map.addLayer(AST2015, {}, 'AST2015');
Map.addLayer(AST2015_bad_data, {}, 'AST2015_bad_data');
Map.addLayer(AST2015_good_data, {}, 'AST2015_good_data');

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(). Example is shown below from another question

var MAX_LIST_SIZE = 100;

var collectionLS7NDVI0 = ee.ImageCollection('LANDSAT/LE7_L1T_32DAY_NDVI')
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));

It is possible to add a filter to filter the images by month using the following command:

ee.Filter.calendarRange (6,10, 'month')

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.