I am trying to mask clouds in Landsat 8 surface reflectance imagery but I am getting a white output (Left image below) - the expected imagery is on the right.
Below are the lines of code.
var image = ee.ImageCollection('LANDSAT/LC08/C02/T1_L2')
.filterBounds(CCmaine);
function maskL8sr(image) {
var cloudShadowBitMask = (1 << 4);
var cloudsBitMask = (1 << 3);
var qa = image.select('QA_PIXEL');
var mask = qa.bitwiseAnd(cloudShadowBitMask).eq(0)
.and(qa.bitwiseAnd(cloudsBitMask).eq(0));
return image.updateMask(mask).divide(10000)
.select("SR_B[0-9]*")
.copyProperties(image, ["system:time_start"]);
}
var sum20 = ee.Filter.date('2020-06-01','2020-09-30');
var sum19 = ee.Filter.date('2019-06-01','2019-09-30'); //Note the date adjustment
var SumFilter = ee.Filter.or(sum20, sum19);
var allsum = image.filter(SumFilter);
var composite = allsum
.map(maskL8sr)
.median()
.clip(CCmaine);
Map.addLayer(composite, {bands: ['SR_B4','SR_B3','SR_B2'],min:0, max:0.3},'Cumberland Color Image', 0);
Looking forward to your help!