I am trying to filter low-cloud images from Landsat 8 or Path 39, Row 35 in GEE as part of a larger script to calculate LST around a solar farm.
I'm mid-way through exploring yet another approach and am adapting another persons script which didn't create a cloud mask for Landsat 8. The BQA band does this, but although I am able to identify low-cloud images using the 'CLOUD_COVER' value in metadata, for some images the BQA band seems to be missing and I get the error:
ImageCollection (Error) Error in map(ID=LC08_039035_20170611): Image.select: Pattern 'BQA' did not match any bands.
Am I doing something wrong? I thought Collection 1 data was complete? How should i handle images without the BQA band? I still need to mask clouds et al., but even if I knew how to do it mixing a method based on the BQA band with another approach.
An example scene would be LC08_L1TP_039035_20170118_20170218_01_T1 which isn't an SR product so I don't think this is a mistake regarding BQA/pixel_qa. I'm probably just doing this completely wrong!
var StatelineSolar = ee.Geometry.Polygon(
[[[-115.50906528445387, 35.63597003699956],
[-115.50906528445387, 35.528750545150906],
[-115.36349643679762, 35.528750545150906],
[-115.36349643679762, 35.63597003699956]]], null, false);
Map.centerObject(StatelineSolar, 14);
//cloud mask landsat8 based on the pixel_qa band of Landsat SR data.
var LC8_BANDS = ['B4', 'B5', 'B10', 'BQA']; //Landsat 8
var STD_NAMES = ['red', 'nir', 'temp', 'qa'];
//var cloudmasklandsat8= function(image){
// var Qlandsat8= image.select('qa');
// var cloudShadowBitMask = (1 << 3);
// var cloudsBitMask = (1 << 5);
// var mask5and7=Qlandsat5and7.clip(StatelineSolar).bitwiseAnd(cloudShadowBitMask).eq(0)
// .and(Qlandsat5and7.bitwiseAnd(cloudsBitMask).eq(0));
// return image.updateMask(mask5and7);
//};
var landsat8 = ee.ImageCollection('LANDSAT/LC08/C01/T1_SR').select(LC8_BANDS, STD_NAMES)
.filterDate('2017-01-01', '2020-12-31')
.filterBounds(StatelineSolar)
.filter(ee.Filter.lt('CLOUD_COVER', 5))
.filter(ee.Filter.eq('WRS_PATH', 39))
.filter(ee.Filter.eq('WRS_ROW', 35))
// .filter(ee.Filter.lt('BQA',))
// .map(cloudmasklandsat7and5and8);