working with sentinel 2

calculate yearly water mask for the whole country.

step 1: add a geometry to the map

step 2: copy the code below and fill out the ??

var s2 = ee.ImageCollection("COPERNICUS/S2");

// filter for location
s2 = s2.filterBounds(??);

// print number of images
print(s2.size());

// filter for date;
s2 = s2.filterDate("??","??");

function removeClouds(image){
// get QA band
var QA = image.select("??");
// get QA band
var clouds = QA.bitwiseAnd(Math.pow(2, 10)).eq(0);
var cirrus = QA.bitwiseAnd(Math.pow(2, 11)).eq(0);

// mask clouds and cirrus
return image.updateMask(clouds).updateMask(cirrus);

}

function calculateNDWI(image){
return image.normalizedDifference(['??','??']);
}

s2 = s2.map(??);
var ndwi = s2.map(??).??;

Map.addLayer(ndwi,{min:-0.1,max:0.3,palette:"green,blue"},"ndwi");
Advertisements