目录

错误 

原始代码

 解决方案

修改后的代码

 结果


错误 

ImageCollection (Error)

Error in map(ID=LC08_138044_20220122): Image.select: Band pattern 'pixel_qa' did not match any bands. Available bands: [SR_B1, SR_B2, SR_B3, SR_B4, SR_B5, SR_B6, SR_B7, SR_QA_AEROSOL, ST_B10, ST_ATRAN, ST_CDIST, ST_DRAD, ST_EMIS, ST_EMSD, ST_QA, ST_TRAD, ST_URAD, QA_PIXEL, QA_RADSAT]

GEE错误: Image.select: Band pattern ‘pixel_qa‘ did not match any bands. Available bands_错误

原始代码

var ROI = 
    /* color: #d63000 */
    /* displayProperties: [
      {
        "type": "rectangle"
      }
    ] */
    ee.Geometry.Polygon(
        [[[85.03450802623571, 23.669108838069914],
          [85.03450802623571, 21.60067630150156],
          [87.80306271373571, 21.60067630150156],
          [87.80306271373571, 23.669108838069914]]], null, false);
Map.centerObject(ROI);
//cloud mask
function maskL8sr(col) {
// Bits 3 and 5 are cloud shadow and cloud, respectively.
var cloudShadowBitMask = (1 << 3);
var cloudsBitMask = (1 << 5);
// Get the pixel QA band.
var qa = col.select('pixel_qa');
// Both flags should be set to zero, indicating clear conditions.
var mask = qa.bitwiseAnd(cloudShadowBitMask).eq(0)
             .and(qa.bitwiseAnd(cloudsBitMask).eq(0));
  return col.updateMask(mask);
}

//vis params
var vizParams = {
  bands: ['SR_B5', 'SR_B6', 'SR_B4'],
  min: 642,
  max: 3307,
  gamma: [1, 0.9, 1.1]
};

var vizParams2 = {
  bands: ['SR_B4', 'SR_B3', 'SR_B2'],
  min: 0,
  max: 3000,
  gamma: 1.4,
};

//load the collection:
var col = ee.ImageCollection('LANDSAT/LC08/C02/T1_L2')
    .map(maskL8sr)
    .filterDate('2022-01-01','2022-02-27')
    .filterBounds(ROI)
    .map(function(image){return image.clip(ROI)});

print('coleccion', col);

//imagen reduction

var image = col.median();
print('image', image);

Map.addLayer(image, vizParams2);

//median
var ndvi1 = image.normalizedDifference(['SR_B5', 'SR_B4']).rename('NDVI');
var ndviParams = {min: -0.2, max:0.7894295302013423, palette: ['blue', 'white', 'green']};

print('ndvi1', ndvi1);

//individual LST images

var col_list = col.toList(col.size());

var LST_col = col_list.map(function (ele) {
 
  var date = ee.Image(ele).get('system:time_start');

  var ndvi = ee.Image(ele).normalizedDifference(['SR_B5', 'SR_B4']).rename('NDVI');
 
  // find the min and max of NDVI
  var min = ee.Number(ndvi.reduceRegion({
    reducer: ee.Reducer.min(),
    geometry: ROI,
    scale: 30,
    maxPixels: 1e13
  }).values().get(0));

  var max = ee.Number(ndvi.reduceRegion({
    reducer: ee.Reducer.max(),
    geometry: ROI,
    scale: 30,
    maxPixels: 1e13
  }).values().get(0));

  var fv = (ndvi.subtract(min).divide(max.subtract(min))).pow(ee.Number(2)).rename('FV');
 
  var a= ee.Number(0.004);
  var b= ee.Number(0.986);
 
  var EM = fv.multiply(a).add(b).rename('EMM');

  var image = ee.Image(ele);

  var LST = image.expression(
    '(Tb/(1 + (0.00115* (Tb / 1.438))*log(Ep)))-273.15', {
      'Tb': image.select('SR_B10').multiply(0.0000275),
      'Ep': fv.multiply(a).add(-0.2)
  });
  return ee.Algorithms.If(min, LST.set('system:time_start', date).float().rename('LST'), 0);

}).removeAll([0]);

LST_col = ee.ImageCollection(LST_col);

print("LST_col", LST_col);

/

Map.addLayer(ndvi1, ndviParams, 'ndvi');

//select thermal band 10(with brightness tempereature), no calculation
var thermal= image.select('SR_B10').multiply(-0.2);

var b10Params = {min: 291.918, max:302.382, palette: ['blue', 'white', 'green']};

Map.addLayer(thermal, b10Params, 'thermal');

// find the min and max of NDVI
var min = ee.Number(ndvi1.reduceRegion({
  reducer: ee.Reducer.min(),
  geometry: ROI,
  scale: 30,
  maxPixels: 1e13
}).values().get(0));

print('min', min );

var max = ee.Number(ndvi1.reduceRegion({
  reducer: ee.Reducer.max(),
  geometry: ROI,
  scale: 30,
  maxPixels: 1e13
}).values().get(0));

print('max', max);

//fractional vegetation
var fv = (ndvi1.subtract(min).divide(max.subtract(min))).pow(ee.Number(2)).rename('FV');

print('fv', fv);

//Map.addLayer(fv);

//Emissivity
var a= ee.Number(0.004);
var b= ee.Number(0.986);
var EM = fv.multiply(a).add(b).rename('EMM');

var imageVisParam3 = {min: 0.9865619146722164, max:0.989699971371314};

//Map.addLayer(EM, imageVisParam3,'EMM');

//LST in Celsius Degree bring -273.15
//NB: In Kelvin don't bring -273.15
var LST = col.map(function (image){

  var date = image.get('system:time_start');
 
  var LST = image.expression(
    '(Tb/(1 + (0.00115* (Tb / 1.438))*log(Ep)))-273.15', {
    'Tb': thermal.select('SR_B11'),
    'Ep':EM.select('EMM')
  }).float().rename('LST');
 
  return LST.set('system:time_start', date);
 
});

print(LST);

Map.addLayer(LST, {min: 6.5, max: 39.9, palette: [
'040274', '040281', '0502a3', '0502b8', '0502ce', '0502e6',
'0602ff', '235cb1', '307ef3', '269db1', '30c8e2', '32d3ef',
'3be285', '3ff38f', '86e26f', '3ae237', 'b5e22e', 'd6e21f',
'fff705', 'ffd611', 'ffb613', 'ff8b13', 'ff6e08', 'ff500d',
'ff0000', 'de0101', 'c21301', 'a71001', '911003'
]},'LST');

print(
      ui.Chart.image.series({
        imageCollection: LST_col,
        region: ROI,
        scale: 30, // nominal scale Landsat imagery
        xProperty: 'system:time_start' // default
      }));
//export NDMI
 
Export.image.toDrive({
image: LST,
description: "exp_LST",
fileNamePrefix: "LST",
folder: "GEE_exp",
scale: 100,
region: ROI,
maxPixels: 1e13,
crs: "EPSG:32719"
});
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25.
  • 26.
  • 27.
  • 28.
  • 29.
  • 30.
  • 31.
  • 32.
  • 33.
  • 34.
  • 35.
  • 36.
  • 37.
  • 38.
  • 39.
  • 40.
  • 41.
  • 42.
  • 43.
  • 44.
  • 45.
  • 46.
  • 47.
  • 48.
  • 49.
  • 50.
  • 51.
  • 52.
  • 53.
  • 54.
  • 55.
  • 56.
  • 57.
  • 58.
  • 59.
  • 60.
  • 61.
  • 62.
  • 63.
  • 64.
  • 65.
  • 66.
  • 67.
  • 68.
  • 69.
  • 70.
  • 71.
  • 72.
  • 73.
  • 74.
  • 75.
  • 76.
  • 77.
  • 78.
  • 79.
  • 80.
  • 81.
  • 82.
  • 83.
  • 84.
  • 85.
  • 86.
  • 87.
  • 88.
  • 89.
  • 90.
  • 91.
  • 92.
  • 93.
  • 94.
  • 95.
  • 96.
  • 97.
  • 98.
  • 99.
  • 100.
  • 101.
  • 102.
  • 103.
  • 104.
  • 105.
  • 106.
  • 107.
  • 108.
  • 109.
  • 110.
  • 111.
  • 112.
  • 113.
  • 114.
  • 115.
  • 116.
  • 117.
  • 118.
  • 119.
  • 120.
  • 121.
  • 122.
  • 123.
  • 124.
  • 125.
  • 126.
  • 127.
  • 128.
  • 129.
  • 130.
  • 131.
  • 132.
  • 133.
  • 134.
  • 135.
  • 136.
  • 137.
  • 138.
  • 139.
  • 140.
  • 141.
  • 142.
  • 143.
  • 144.
  • 145.
  • 146.
  • 147.
  • 148.
  • 149.
  • 150.
  • 151.
  • 152.
  • 153.
  • 154.
  • 155.
  • 156.
  • 157.
  • 158.
  • 159.
  • 160.
  • 161.
  • 162.
  • 163.
  • 164.
  • 165.
  • 166.
  • 167.
  • 168.
  • 169.
  • 170.
  • 171.
  • 172.
  • 173.
  • 174.
  • 175.
  • 176.
  • 177.
  • 178.
  • 179.
  • 180.
  • 181.
  • 182.
  • 183.
  • 184.
  • 185.
  • 186.
  • 187.
  • 188.
  • 189.
  • 190.
  • 191.
  • 192.
  • 193.
  • 194.
  • 195.
  • 196.
  • 197.
  • 198.
  • 199.
  • 200.
  • 201.

 解决方案

这里我们是在进行Landsat C01和C02数据对于不同波段的命名造成的,所以这里我们很简单的就可以进行处理,因为GEE错误已经给出了提示。

这里还有一个问题,Landsat数据中的ST_10不是SR_10所以这里还会报错:

GEE错误: Image.select: Band pattern ‘pixel_qa‘ did not match any bands. Available bands_error_02

修改后的代码

var ROI = 
    /* color: #d63000 */
    /* displayProperties: [
      {
        "type": "rectangle"
      }
    ] */
    ee.Geometry.Polygon(
        [[[85.03450802623571, 23.669108838069914],
          [85.03450802623571, 21.60067630150156],
          [87.80306271373571, 21.60067630150156],
          [87.80306271373571, 23.669108838069914]]], null, false);
Map.centerObject(ROI);
//cloud mask
function maskL8sr(image) {
  // Bit 0 - Fill
  // Bit 1 - Dilated Cloud
  // Bit 2 - Cirrus
  // Bit 3 - Cloud
  // Bit 4 - Cloud Shadow
  var qaMask = image.select('QA_PIXEL').bitwiseAnd(parseInt('11111', 2)).eq(0);
  var saturationMask = image.select('QA_RADSAT').eq(0);

  // Apply the scaling factors to the appropriate bands.
  var opticalBands = image.select('SR_B.').multiply(0.0000275).add(-0.2);
  var thermalBands = image.select('ST_B.*').multiply(0.00341802).add(149.0);

  // Replace the original bands with the scaled ones and apply the masks.
  return image.addBands(opticalBands, null, true)
      .addBands(thermalBands, null, true)
      .updateMask(qaMask)
      .updateMask(saturationMask);
}

//vis params
var vizParams = {
  bands: ['SR_B5', 'SR_B6', 'SR_B4'],
  min: 642,
  max: 3307,
  gamma: [1, 0.9, 1.1]
};

var vizParams2 = {
  bands: ['SR_B4', 'SR_B3', 'SR_B2'],
  min: 0,
  max: 3000,
  gamma: 1.4,
};

//load the collection:
var col = ee.ImageCollection('LANDSAT/LC08/C02/T1_L2')
    .map(maskL8sr)
    .filterDate('2022-01-01','2022-02-27')
    .filterBounds(ROI)
    .map(function(image){return image.clip(ROI)});

print('coleccion', col);

//imagen reduction

var image = col.median();
print('image', image);

Map.addLayer(image, vizParams2);

//median
var ndvi1 = image.normalizedDifference(['SR_B5', 'SR_B4']).rename('NDVI');
var ndviParams = {min: -0.2, max:0.7894295302013423, palette: ['blue', 'white', 'green']};

print('ndvi1', ndvi1);

//individual LST images

var col_list = col.toList(col.size());

var LST_col = col_list.map(function (ele) {
 
  var date = ee.Image(ele).get('system:time_start');

  var ndvi = ee.Image(ele).normalizedDifference(['SR_B5', 'SR_B4']).rename('NDVI');
 
  // find the min and max of NDVI
  var min = ee.Number(ndvi.reduceRegion({
    reducer: ee.Reducer.min(),
    geometry: ROI,
    scale: 30,
    maxPixels: 1e13
  }).values().get(0));

  var max = ee.Number(ndvi.reduceRegion({
    reducer: ee.Reducer.max(),
    geometry: ROI,
    scale: 30,
    maxPixels: 1e13
  }).values().get(0));

  var fv = (ndvi.subtract(min).divide(max.subtract(min))).pow(ee.Number(2)).rename('FV');
 
  var a= ee.Number(0.004);
  var b= ee.Number(0.986);
 
  var EM = fv.multiply(a).add(b).rename('EMM');

  var image = ee.Image(ele);

  var LST = image.expression(
    '(Tb/(1 + (0.00115* (Tb / 1.438))*log(Ep)))-273.15', {
      'Tb': image.select('ST_B10').multiply(0.0000275),
      'Ep': fv.multiply(a).add(-0.2)
  });
  return ee.Algorithms.If(min, LST.set('system:time_start', date).float().rename('LST'), 0);

}).removeAll([0]);

LST_col = ee.ImageCollection(LST_col);

print("LST_col", LST_col);

/

Map.addLayer(ndvi1, ndviParams, 'ndvi');

//select thermal band 10(with brightness tempereature), no calculation
var thermal= image.select('ST_B10').multiply(-0.2);

var b10Params = {min: 291.918, max:302.382, palette: ['blue', 'white', 'green']};

Map.addLayer(thermal, b10Params, 'thermal');

// find the min and max of NDVI
var min = ee.Number(ndvi1.reduceRegion({
  reducer: ee.Reducer.min(),
  geometry: ROI,
  scale: 30,
  maxPixels: 1e13
}).values().get(0));

print('min', min );

var max = ee.Number(ndvi1.reduceRegion({
  reducer: ee.Reducer.max(),
  geometry: ROI,
  scale: 30,
  maxPixels: 1e13
}).values().get(0));

print('max', max);

//fractional vegetation
var fv = (ndvi1.subtract(min).divide(max.subtract(min))).pow(ee.Number(2)).rename('FV');

print('fv', fv);

//Map.addLayer(fv);

//Emissivity
var a= ee.Number(0.004);
var b= ee.Number(0.986);
var EM = fv.multiply(a).add(b).rename('EMM');

var imageVisParam3 = {min: 0.9865619146722164, max:0.989699971371314};

//Map.addLayer(EM, imageVisParam3,'EMM');

//LST in Celsius Degree bring -273.15
//NB: In Kelvin don't bring -273.15
var LST = col.map(function (image){

  var date = image.get('system:time_start');
 
  var LST = image.expression(
    '(Tb/(1 + (0.00115* (Tb / 1.438))*log(Ep)))-273.15', {
    'Tb': thermal.select('ST_B10'),
    'Ep':EM.select('EMM')
  }).float().rename('LST');
 
  return LST.set('system:time_start', date);
 
});

print(LST);

Map.addLayer(LST, {min: 6.5, max: 39.9, palette: [
'040274', '040281', '0502a3', '0502b8', '0502ce', '0502e6',
'0602ff', '235cb1', '307ef3', '269db1', '30c8e2', '32d3ef',
'3be285', '3ff38f', '86e26f', '3ae237', 'b5e22e', 'd6e21f',
'fff705', 'ffd611', 'ffb613', 'ff8b13', 'ff6e08', 'ff500d',
'ff0000', 'de0101', 'c21301', 'a71001', '911003'
]},'LST');

print(
      ui.Chart.image.series({
        imageCollection: LST_col,
        region: ROI,
        scale: 30, // nominal scale Landsat imagery
        xProperty: 'system:time_start' // default
      }));
//export NDMI
 
Export.image.toDrive({
image: LST,
description: "exp_LST",
fileNamePrefix: "LST",
folder: "GEE_exp",
scale: 100,
region: ROI,
maxPixels: 1e13,
crs: "EPSG:32719"
});
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25.
  • 26.
  • 27.
  • 28.
  • 29.
  • 30.
  • 31.
  • 32.
  • 33.
  • 34.
  • 35.
  • 36.
  • 37.
  • 38.
  • 39.
  • 40.
  • 41.
  • 42.
  • 43.
  • 44.
  • 45.
  • 46.
  • 47.
  • 48.
  • 49.
  • 50.
  • 51.
  • 52.
  • 53.
  • 54.
  • 55.
  • 56.
  • 57.
  • 58.
  • 59.
  • 60.
  • 61.
  • 62.
  • 63.
  • 64.
  • 65.
  • 66.
  • 67.
  • 68.
  • 69.
  • 70.
  • 71.
  • 72.
  • 73.
  • 74.
  • 75.
  • 76.
  • 77.
  • 78.
  • 79.
  • 80.
  • 81.
  • 82.
  • 83.
  • 84.
  • 85.
  • 86.
  • 87.
  • 88.
  • 89.
  • 90.
  • 91.
  • 92.
  • 93.
  • 94.
  • 95.
  • 96.
  • 97.
  • 98.
  • 99.
  • 100.
  • 101.
  • 102.
  • 103.
  • 104.
  • 105.
  • 106.
  • 107.
  • 108.
  • 109.
  • 110.
  • 111.
  • 112.
  • 113.
  • 114.
  • 115.
  • 116.
  • 117.
  • 118.
  • 119.
  • 120.
  • 121.
  • 122.
  • 123.
  • 124.
  • 125.
  • 126.
  • 127.
  • 128.
  • 129.
  • 130.
  • 131.
  • 132.
  • 133.
  • 134.
  • 135.
  • 136.
  • 137.
  • 138.
  • 139.
  • 140.
  • 141.
  • 142.
  • 143.
  • 144.
  • 145.
  • 146.
  • 147.
  • 148.
  • 149.
  • 150.
  • 151.
  • 152.
  • 153.
  • 154.
  • 155.
  • 156.
  • 157.
  • 158.
  • 159.
  • 160.
  • 161.
  • 162.
  • 163.
  • 164.
  • 165.
  • 166.
  • 167.
  • 168.
  • 169.
  • 170.
  • 171.
  • 172.
  • 173.
  • 174.
  • 175.
  • 176.
  • 177.
  • 178.
  • 179.
  • 180.
  • 181.
  • 182.
  • 183.
  • 184.
  • 185.
  • 186.
  • 187.
  • 188.
  • 189.
  • 190.
  • 191.
  • 192.
  • 193.
  • 194.
  • 195.
  • 196.
  • 197.
  • 198.
  • 199.
  • 200.
  • 201.
  • 202.
  • 203.
  • 204.
  • 205.
  • 206.
  • 207.
  • 208.
  • 209.

 结果

GEE错误: Image.select: Band pattern ‘pixel_qa‘ did not match any bands. Available bands_服务器_03

GEE错误: Image.select: Band pattern ‘pixel_qa‘ did not match any bands. Available bands_error_04