0

One image in an ImageCollection is giving me problems (2019030509) so I'd like to remove it. I am trying to use .filter.not() to remove by ID:

var dataset = ee.ImageCollection('HYCOM/sea_temp_salinity')
                   .filter(ee.Filter.date('2019-01-01', '2019-12-31'))
                   .filter(ee.Filter.inList('HYCOM/sea_temp_salinity/2019030509').not());
print(dataset)

var seaWaterTemperature = dataset.select('water_temp_0')

print(seaWaterTemperature)

var visParams = {   min: -20000.0,   max: 15000.0,   palette:
['000000', '005aff', '43c8c8', 'fff700', 'ff0000'], };
Map.setCenter(-76.55, 38.92, 8); Map.addLayer(seaWaterTemperature,
visParams, 'Sea Water Temperature');

But I am still getting an error saying 'Error in map(ID=2019030509): Image.select: Pattern 'water_temp_0' did not match any bands.' so I don't think it was removed.

1

You are not using the filter correctly. Look up the properties, you will see that the system:index property consist of a YYYYMMddhh format. Name that property (system:index) and that value ('2019030509', as a string) to filter the image of the collection:

var dataset = ee.ImageCollection('HYCOM/sea_temp_salinity')
                   .filter(ee.Filter.date('2019-01-01', '2019-12-31'))
                  .filter(ee.Filter.inList('system:index',['2019030509']).not());

But probably the filter neq is more convenient to use:

var dataset = ee.ImageCollection('HYCOM/sea_temp_salinity')
                   .filter(ee.Filter.date('2019-01-01', '2019-12-31'))
                  .filter(ee.Filter.neq('system:index','2019030509'));

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.