I am trying to filter Sentinel 2 images by percent of cloud cover (say, 20%) and then perform some image arithmetic on the output.
I am trying to do implement what is found here:gis.stackexchange thread (https://gis.stackexchange.com/questions/303344/filter-landsat-images-cloud-cover). Unfortunately, the function ee.Algorithms.Landsat...
does not work with Sentinel 2 images, which is required for what I am doing.
My code thus far is below.
var myCollection = ee.ImageCollection('COPERNICUS/S2');
var dataset2 = ee.ImageCollection(
myCollection.filterBounds(point) //use only one image that contains the POI
.filterDate('2015-06-23', '2019-04-25') //filter by date range
);
var ds2_cloudiness = dataset2.map(function(image){
var cloud = ee.Algorithms.Landsat.simpleCloudScore(image).select('cloud');
var cloudiness = cloud.reduceRegion({
reducer: 'median'
});
return image.set(cloudiness);
});
var filteredCollection = ds2_cloudiness.filter(ee.Filter.lt('cloud', 20));
Map.addLayer(filteredCollection, {min: -.2, max:.2}, 'test')
This outputs an error: Landsat.simpleCloudScore: Image is not a Landsat scene or is missing SENSOR_ID metadata.
Any nudge in the right direction would be appreciated.