Google Earth Engine Remove cloud and cloud shadow

Software Uncategorized

Google Earth Engine Remove cloud and cloud shadow

How do I remove clouds from Google Earth Engine?

Script:

// Create working area
var area = ee.Geometry.Rectangle(, , , );
Map.addLayer(area, {}, “Area”);
Map.centerObject(area, 10);

/*******************************************
Proccess Landsat 8 data
/*******************************************/
// Function to mask clouds based on the pixel_qa band of Landsat 8 SR data.
function maskL8sr(image) {
// Bits 3 and 5 are cloud shadow and cloud, respectively.
var cloudShadowBitMask = (1 << 3);
var cloudsBitMask = (1 << 5);
Get the pixel QA band.
var qa = image.select(‘pixel_qa’);
// Both flags should be set to zero, indicating clear conditions.
var mask = qa.bitwiseAnd(cloudShadowBitMask).eq(0)
.and(qa.bitwiseAnd(cloudsBitMask).eq(0));
return image.updateMask(mask);
}

// Load 2019 Landsat 8 annual composites.
var landsat2019 = ee.ImageCollection(‘LANDSAT/LC08/C01/T1_SR’)
.filterDate(‘2019-01-01’, ‘2019-12-31’)
.map(maskL8sr)
.filterBounds(area)
.median();

//Display Landsat data
var visParams = {
bands: [‘B4’, ‘B3’, ‘B2’],
min: 0,
max: 3000,
gamma: 1.4,
};
Map.centerObject(area, 9);
Map.addLayer(landsat2019, visParams, “Landsat 8 (2019)”);

Leave a Comment on Google Earth Engine Remove cloud and cloud shadowTagged ,

Leave a Reply

Your email address will not be published.

Back To Top