1

I am trying to composite an image with the mean value of the METADATA layer "CLOUDY_PIXEL_PERCENTAGE" for every pixel.

My goal is to do this for monthly mean values, but I can't find the way to simply extract the values of this metadata expressed by a percentage (which I know is the format of this layer)

Does anybody know how to?

  • I am using Google Earth Engine. I just realized though, that "CLOUDY_PIXEL_PERCENTAGE" is a value assigned to an image, not to every single pixel, so I think that what was in my mind can not be done (in the way I wanted). But know a question reaches my mind... A cloud mask in Sentinel 2 is done by using band "QA60". But... what the pixel values within this band represent? The lower the value of QA60 for a pixel, the lower it is that pixel affected by clouds? I thought about constructing a mean composite of the values of that band, which hopefully will represent some "cloudiness index" – Enrique Casas Nov 29 '18 at 18:09
1

On EARTH ENGINE, if u want to check a pixel for cloud, you can use the QA60 band of the Sentinel-2 image.

The QA60 band is meant to be read in binary form. In its binary form, the 10th bit( 0 or 1 ) represents whether the pixel has cloud or not, whereas the 11th bit ( 0 or 1 ) represents whether the pixel has cirrus clouds or not.

The below code will return you a raster image of the same footprint as your original image with pixel values 1 or 0, where 1 denotes that the pixel contains cloud and 0 otherwise.

function cloudPixels(image) {
  var qa = image.select('QA60');
  var cloudBitMask = Math.pow(2, 10);
  var cirrusBitMask = Math.pow(2, 11);   //for cirrus clouds
  var cloudMask = qa.bitwiseAnd(cloudBitMask);
  var cirrusMask = qa.bitwiseAnd(cirrusBitMask);    //return this variable to get cirrus cloud pixels
  return cloudMask;
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.