I have a similar question to this one here: Filter Landsat images base on cloud cover over a region of interest
Different from the linked question I would like to find a more general solution that is not just working for landsat.
I have some small areas (up to 1 kmĀ²) where I would like to get all the images that are completely cloud free.
Using the .filter(ee.Filter.lt('CLOUDY_PIXEL_PERCENTAGE', 5))
on the cropped image checks the entire scene for clouds and not just the small area. Is there something comparable to ee.Algorithms.Landsat.simpleCloudScore(image).select('cloud');
that would work for Sentinel 2?
Here is what I tried:
var rectangle = ee.Geometry.Rectangle([16.9, 78.31, 17.1, 78.33]);
var collection = ee.ImageCollection('COPERNICUS/S2')
.filterDate('2018-05-01', '2018-10-30')
.filterBounds(rectangle);
var clip_collection = collection.map(function(image) { return image.clip(rectangle); });
var coll_s2_filtered = clip_collection.filterBounds(rectangle)
.filter(ee.Filter.lte('CLOUDY_PIXEL_PERCENTAGE', 5))
.sort('system:time_start',false);
And I tried using the ee.Algorithms.Landsat.simpleCloudScore(image)
but then I get
"Error in map(ID=20180501T122701_20180501T122655_T33XWG):
Landsat.simpleCloudScore: Image is not a Landsat scene or is missing
SENSOR_ID metadata."
Best Answer
I think a good approach would be similar to this code sample below Sentinel Cloud-free Collection Google Earth Engine Code Editor