I am trying to get image collection of MODIS daily LST for monsoon season for a region that often has cloudy days. Filtering MODIS collection with filterBounds seems unable to remove scenes that have no pixel in study area.
First, I checked them with printing number of scenes in each collection
// Boundary
var DMDP = ee.Geometry.Rectangle(90.24, 23.59, 90.62, 24.00);
Map.centerObject(DMDP);
// Filtered by boundary
var terra_filtered = ee.ImageCollection('MODIS/061/MOD11A1')
.filter(ee.Filter.date('2021-06-01', '2021-09-30'))
.select('LST_Day_1km')
.filterBounds(DMDP);
print(terra_filtered);
// Not filtered by boundary
var terra = ee.ImageCollection('MODIS/061/MOD11A1')
.filter(ee.Filter.date('2021-06-01', '2021-09-30'))
.select('LST_Day_1km');
print(terra); // Both image collection yeilds same number of images
Then, I checked if there are images which does not contain any pixel, e.g., I checked the first image of the collection and found that the image is empty. To be sure, I counted the pixels and it was confirmed - it does not have any pixel.
// First image
var monsoon = terra.first();
var visparams = {min: 13000.0, max: 16500.0, palette: ['green', 'yellow', 'red']};
Map.addLayer(monsoon.clip(DMDP), visparams, 'monsoon'); // No pixel visible in study area
// Print number of pixels to check if visual inspection is right
var pixels = monsoon.reduceRegion({
reducer: ee.Reducer.count(),
geometry: DMDP,
scale: 500,
});
print('Pixels:', pixels);
What could be the possible ways to discard the zero pixel scenes from the image collection, other then the filterBounds? Also, why does filterBounds do not work in this case?