Skip to main content
Tweeted twitter.com/StackGIS/status/1101859874651234311
syntax highlighting
Source Link
Kersten
  • 10k
  • 3
  • 41
  • 60
var Jan2016 = ee.ImageCollection('COPERNICUS/S2') .filterBounds(NSW) .filterDate('2016-01-01', '2016-01-30'); var trueColor = {bands: ['B4', 'B3', 'B2'], min: 0, max: 3000}; var falseColor= {bands: ['B8', 'B3', 'B4'], min: 0, max: 3000}; //Define the CLoud layer (here: QA60 is MSI2's quality mask) var Clouds = {bands: ['QA60']}; //Add the cloud mask as layer; PROBLEM: SEEMS QA60 is taken from different images every time.. //Clouds is just a band, do i need to specify the threshold? Map.addLayer(Jan2016, Clouds, "CloudsJan16"); // Mask clouds var noclouds = Jan2016.map(function(img) { var mask = img.select(['QA60']).neq(11); //.neq(xx) doesn't seem to make a difference return img.updateMask(mask); }); //Add the layer/imagery to the map with variable, display type, and name Map.addLayer(noclouds, trueColor, "NoClouds"); Map.addLayer(Jan2016, falseColor, "Jan2016false"); 
var Jan2016 = ee.ImageCollection('COPERNICUS/S2') .filterBounds(NSW) .filterDate('2016-01-01', '2016-01-30'); var trueColor = {bands: ['B4', 'B3', 'B2'], min: 0, max: 3000}; var falseColor= {bands: ['B8', 'B3', 'B4'], min: 0, max: 3000}; //Define the CLoud layer (here: QA60 is MSI2's quality mask) var Clouds = {bands: ['QA60']}; //Add the cloud mask as layer; PROBLEM: SEEMS QA60 is taken from different images every time.. //Clouds is just a band, do i need to specify the threshold? Map.addLayer(Jan2016, Clouds, "CloudsJan16"); // Mask clouds var noclouds = Jan2016.map(function(img) { var mask = img.select(['QA60']).neq(11); //.neq(xx) doesn't seem to make a difference return img.updateMask(mask); }); //Add the layer/imagery to the map with variable, display type, and name Map.addLayer(noclouds, trueColor, "NoClouds"); Map.addLayer(Jan2016, falseColor, "Jan2016false"); 
var Jan2016 = ee.ImageCollection('COPERNICUS/S2') .filterBounds(NSW) .filterDate('2016-01-01', '2016-01-30'); var trueColor = {bands: ['B4', 'B3', 'B2'], min: 0, max: 3000}; var falseColor= {bands: ['B8', 'B3', 'B4'], min: 0, max: 3000}; //Define the CLoud layer (here: QA60 is MSI2's quality mask) var Clouds = {bands: ['QA60']}; //Add the cloud mask as layer; PROBLEM: SEEMS QA60 is taken from different images every time.. //Clouds is just a band, do i need to specify the threshold? Map.addLayer(Jan2016, Clouds, "CloudsJan16"); // Mask clouds var noclouds = Jan2016.map(function(img) { var mask = img.select(['QA60']).neq(11); //.neq(xx) doesn't seem to make a difference return img.updateMask(mask); }); //Add the layer/imagery to the map with variable, display type, and name Map.addLayer(noclouds, trueColor, "NoClouds"); Map.addLayer(Jan2016, falseColor, "Jan2016false"); 
var Jan2016 = ee.ImageCollection('COPERNICUS/S2') .filterBounds(NSW) .filterDate('2016-01-01', '2016-01-30'); var trueColor = {bands: ['B4', 'B3', 'B2'], min: 0, max: 3000}; var falseColor= {bands: ['B8', 'B3', 'B4'], min: 0, max: 3000}; //Define the CLoud layer (here: QA60 is MSI2's quality mask) var Clouds = {bands: ['QA60']}; //Add the cloud mask as layer; PROBLEM: SEEMS QA60 is taken from different images every time.. //Clouds is just a band, do i need to specify the threshold? Map.addLayer(Jan2016, Clouds, "CloudsJan16"); // Mask clouds var noclouds = Jan2016.map(function(img) { var mask = img.select(['QA60']).neq(11); //.neq(xx) doesn't seem to make a difference return img.updateMask(mask); }); //Add the layer/imagery to the map with variable, display type, and name Map.addLayer(noclouds, trueColor, "NoClouds"); Map.addLayer(Jan2016, falseColor, "Jan2016false"); 
removed help appreciation
Source Link
Vince
  • 20.5k
  • 16
  • 49
  • 65

I am trying to create and map an image collection (not image or mosaic if that is even possible), where QA60 defines the Cloud-mask. I have written the code below - however, it seems the Jan2016 images do not correspond the cloud mask, even though the pixel inspector shows the same image time stamp for all layers. Hence, "NoCLouds" layer contains many pixels with clouds and has many other without masked. Maybe my mask is wrong?

var Jan2016 = ee.ImageCollection('COPERNICUS/S2') .filterBounds(NSW) .filterDate('2016-01-01', '2016-01-30'); var trueColor = {bands: ['B4', 'B3', 'B2'], min: 0, max: 3000}; var falseColor= {bands: ['B8', 'B3', 'B4'], min: 0, max: 3000}; //Define the CLoud layer (here: QA60 is MSI2's quality mask) var Clouds = {bands: ['QA60']}; //Add the cloud mask as layer; PROBLEM: SEEMS QA60 is taken from different images every time.. //Clouds is just a band, do i need to specify the threshold? Map.addLayer(Jan2016, Clouds, "CloudsJan16"); // Mask clouds var noclouds = Jan2016.map(function(img) { var mask = img.select(['QA60']).neq(11); //.neq(xx) doesn't seem to make a difference return img.updateMask(mask); }); //Add the layer/imagery to the map with variable, display type, and name Map.addLayer(noclouds, trueColor, "NoClouds"); Map.addLayer(Jan2016, falseColor, "Jan2016false"); 

As I am new to GEE - any help is greatly appreciated! Thanks

I am trying to create and map an image collection (not image or mosaic if that is even possible), where QA60 defines the Cloud-mask. I have written the code below - however, it seems the Jan2016 images do not correspond the cloud mask, even though the pixel inspector shows the same image time stamp for all layers. Hence, "NoCLouds" layer contains many pixels with clouds and has many other without masked. Maybe my mask is wrong?

var Jan2016 = ee.ImageCollection('COPERNICUS/S2') .filterBounds(NSW) .filterDate('2016-01-01', '2016-01-30'); var trueColor = {bands: ['B4', 'B3', 'B2'], min: 0, max: 3000}; var falseColor= {bands: ['B8', 'B3', 'B4'], min: 0, max: 3000}; //Define the CLoud layer (here: QA60 is MSI2's quality mask) var Clouds = {bands: ['QA60']}; //Add the cloud mask as layer; PROBLEM: SEEMS QA60 is taken from different images every time.. //Clouds is just a band, do i need to specify the threshold? Map.addLayer(Jan2016, Clouds, "CloudsJan16"); // Mask clouds var noclouds = Jan2016.map(function(img) { var mask = img.select(['QA60']).neq(11); //.neq(xx) doesn't seem to make a difference return img.updateMask(mask); }); //Add the layer/imagery to the map with variable, display type, and name Map.addLayer(noclouds, trueColor, "NoClouds"); Map.addLayer(Jan2016, falseColor, "Jan2016false"); 

As I am new to GEE - any help is greatly appreciated! Thanks

I am trying to create and map an image collection (not image or mosaic if that is even possible), where QA60 defines the Cloud-mask. I have written the code below - however, it seems the Jan2016 images do not correspond the cloud mask, even though the pixel inspector shows the same image time stamp for all layers. Hence, "NoCLouds" layer contains many pixels with clouds and has many other without masked. Maybe my mask is wrong?

var Jan2016 = ee.ImageCollection('COPERNICUS/S2') .filterBounds(NSW) .filterDate('2016-01-01', '2016-01-30'); var trueColor = {bands: ['B4', 'B3', 'B2'], min: 0, max: 3000}; var falseColor= {bands: ['B8', 'B3', 'B4'], min: 0, max: 3000}; //Define the CLoud layer (here: QA60 is MSI2's quality mask) var Clouds = {bands: ['QA60']}; //Add the cloud mask as layer; PROBLEM: SEEMS QA60 is taken from different images every time.. //Clouds is just a band, do i need to specify the threshold? Map.addLayer(Jan2016, Clouds, "CloudsJan16"); // Mask clouds var noclouds = Jan2016.map(function(img) { var mask = img.select(['QA60']).neq(11); //.neq(xx) doesn't seem to make a difference return img.updateMask(mask); }); //Add the layer/imagery to the map with variable, display type, and name Map.addLayer(noclouds, trueColor, "NoClouds"); Map.addLayer(Jan2016, falseColor, "Jan2016false"); 
Source Link
Caroline
  • 57
  • 1
  • 5

Sentinel Cloud-free Collection Google Earth Engine Code Editor

I am trying to create and map an image collection (not image or mosaic if that is even possible), where QA60 defines the Cloud-mask. I have written the code below - however, it seems the Jan2016 images do not correspond the cloud mask, even though the pixel inspector shows the same image time stamp for all layers. Hence, "NoCLouds" layer contains many pixels with clouds and has many other without masked. Maybe my mask is wrong?

var Jan2016 = ee.ImageCollection('COPERNICUS/S2') .filterBounds(NSW) .filterDate('2016-01-01', '2016-01-30'); var trueColor = {bands: ['B4', 'B3', 'B2'], min: 0, max: 3000}; var falseColor= {bands: ['B8', 'B3', 'B4'], min: 0, max: 3000}; //Define the CLoud layer (here: QA60 is MSI2's quality mask) var Clouds = {bands: ['QA60']}; //Add the cloud mask as layer; PROBLEM: SEEMS QA60 is taken from different images every time.. //Clouds is just a band, do i need to specify the threshold? Map.addLayer(Jan2016, Clouds, "CloudsJan16"); // Mask clouds var noclouds = Jan2016.map(function(img) { var mask = img.select(['QA60']).neq(11); //.neq(xx) doesn't seem to make a difference return img.updateMask(mask); }); //Add the layer/imagery to the map with variable, display type, and name Map.addLayer(noclouds, trueColor, "NoClouds"); Map.addLayer(Jan2016, falseColor, "Jan2016false"); 

As I am new to GEE - any help is greatly appreciated! Thanks