Working with GEE I noticed that there are different methods for masking cloud pixels in Sentinel-2 images. I would like to clear up some doubts about the different methods. Here are two of the functions I found for cloud masking:
function maskS2clouds(image) {
var qa = image.select('QA60');
var cloudBitMask = 1 << 10;
var cirrusBitMask = 1 << 11;
var mask = qa.bitwiseAnd(cloudBitMask).eq(0).and(
qa.bitwiseAnd(cirrusBitMask).eq(0));
return image.updateMask(mask).divide(10000)
.select("B.*")
.copyProperties(image, ["system:time_start"]);
};
and
function s2ClearSky(image) {
var scl = image.select('SCL');
var clear_sky_pixels = scl.eq(4).or(scl.eq(5)).or(scl.eq(6)).or(scl.eq(11));
return image.updateMask(clear_sky_pixels).divide(10000);
};
I understand that in maskS2clouds
method only cloudy pixels are removed, while in s2ClearSky
also removes cloud shadows, thin cirrus, defective, etc. But, is there any other difference? Which of the two methods is better? Which one should I use in each case? What is the reason for using .select("B.*").copyProperties(image, ["system:time_start"])
in the first case? Are there better methods?