-
Notifications
You must be signed in to change notification settings - Fork 110
Cloud Masks
Rodrigo E. Principe edited this page Oct 25, 2018
·
3 revisions
Applying masks for clouds, shadows and snow is a very common process. This module provides some funtions to do it directly.
var cloud_masks = require('users/fitoprincipe/geetools:cloud_masks');
In the cloud_masks
module exist the following functions:
var sentinel2function = cloud_masks.sentinel2(options)
This function is made to use in collection COPERNICUS/S2
. Options are:
cirrus
and/or opaque
. If no argument is passed, will mask both.
var landsatSRfunction = cloud_masks.landsatSR(options)
This function is made to use in:
LANDSAT/LT04/C01/T1_SR
LANDSAT/LT05/C01/T1_SR
LANDSAT/LE07/C01/T1_SR
LANDSAT/LC08/C01/T1_SR
It can accept one argument indicating which part you want to mask out. Options are:
cloud
snow
-
adjacent
(not for Landsat 8) shadow
There is a module to test cloud_masks
. All functions in that module use the
center of the map to filter by bounds, so if you move around you'll see
different images.
var cloud_masks = require('users/fitoprincipe/geetools:cloud_masks_test');
cloud_masks.sentinel2() // Test Sentinel 2
cloud_masks.landsat4SR() // Test Landsat 4 SR
cloud_masks.landsat5SR() // Test Landsat 5 SR
cloud_masks.landsat7SR(['cloud']) // Test only cloud of Landsat 7 SR
cloud_masks.landsat8SR(['cloud'], 'L8 SR only cloud') // Test only cloud of Landsat 8 SR and assign a name to the layer
var cloud_masks = require('users/fitoprincipe/geetools:cloud_masks');
var sentinel2function = cloud_masks.sentinel2();
// The original Image
var S2Image = ee.Image('COPERNICUS/S2/20171117T142739_20171117T143844_T18GYU');
// Apply mask
var masked_image = sentinel2function(S2Image);
// Visualize
var vis = {bands:['B8', 'B12', 'B4'], min:0, max:5000};
Map.addLayer(masked_image, vis, 'Sentinel 2 masked');
Map.centerObject(masked_image)
var cloud_masks = require('users/fitoprincipe/geetools:cloud_masks');
var landsatSRfunction = cloud_masks.landsatSR;
// The original Image
var L8Image = ee.Image('LANDSAT/LC08/C01/T1_SR/LC08_232089_20170416');
// Apply mask
var masked_image = landsatSRfunction()(L8Image);
// Visualize
var vis = {bands:['B5', 'B7', 'B4'], min:0, max:5000}
Map.addLayer(masked_image, vis, 'Landsat 8 SR masked');
Map.centerObject(masked_image)
- @author: Rodrigo E. Principe
- email: fitoprincipe82 at gmail
- Licence: MIT