Mask clouds on Landsat 8 surface reflectance

Get rid of clouds, shadows and snow in surface reflectance maps.

Use the code below or open this link.

// import the image
var img = ee.Image("LANDSAT/LC8_SR/LC81270472016041");

// set viz parameters
var viz = {bands:['B4','B3','B2'],min:0,max:3000};

//details for cfmask

// we want no shadow, snow or cloud
var imgMask = img.mask('cfmask').lt(2));

// add to map
Map.addLayer(imgMask,viz,"without clouds");
Map.addLayer(img,viz,"with clouds");

One comment

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s