I want to use the Landsat QA_PIXEl from this dataset to create a cloud mask in GEE. I only want to mask out the areas where there is high confidence that cloud cover is present. Looking at the documentation
Bits 8-9: Cloud Confidence
0: None
1: Low
2: Medium
3: High
However I do not understand very well the bitwiseAnd function in this context and so I'm not sure if what I'm doing is correct. Which I am guessing is not since I am not giving to the code the information that I only want to mask the High confidence pixels. Plus no image is rendered when I do this.
The code I'm doing for this part is this:
def maskClouds(image):
qa = image.select('QA_PIXEL')
mask = qa.bitwiseAnd(1<<8).gt(2).Or(qa.bitwiseAnd(1<<9)).gt(2)
return image.updateMask(mask)
How can I use the 'bitwiseAnd' function in this context and mask the "high" cloud confidence parts?
I have tried to do adapt my code to this question: Using cloud confidence to create cloud mask from Landsat 8 BQA? but this results in getting this error:
Image.rightShift: Bitwise operands must be integer only.