首页 > 其他分享 >GEE错误:Image.select: Band pattern ‘BQA‘ did not match any bands. Available bands:

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

时间:2024-09-10 10:23:46浏览次数:17  
标签:Available confidence BQA bands image 30 Band var Cloud

目录

错误

原始代码

Landsat 8 TOA数据介绍

错误解析

正确的代码

 结果


错误

Error in map(ID=LC08_044034_20130603): Image.select: Band pattern 'BQA' did not match any bands. Available bands: [B1, B2, B3, B4, B5, B6, B7, B8, B9, B10, B11, QA_PIXEL, QA_RADSAT, SAA, SZA, VAA, VZA]

 

原始代码

var roi = /* color: #d63000 */ee.Geometry.Point([-121.9353461265564, 37.56180984982223]),
    l8toa = ee.ImageCollection("LANDSAT/LC08/C02/T1_TOA");
Map.centerObject(roi, 10);

// This field contains UNIX time in milliseconds.
var timeField = 'system:time_start';

// Use this function to mask clouds in Landsat 8 imagery.
var maskClouds = function(image) {
  var quality = image.select('BQA');
  var cloud01 = quality.eq(61440);
  var cloud02 = quality.eq(53248);
  var cloud03 = quality.eq(28672);
  var mask = cloud01.or(cloud02).or(cloud03).not();
  return image.updateMask(mask);
};

// Use this function to add variables for NDVI, time and a constant
// to Landsat 8 imagery.
var addVariables = function(image) {
  // Compute time in fractional years since the epoch.
  var date = ee.Date(image.get(timeField));
  var years = date.difference(ee.Date('1970-01-01'), 'year');
  // Return the image with the added bands.
  return image
    // Add an NDVI band.
    .addBands(image.normalizedDifference(['B5', 'B4']).rename('NDVI')).float()
    // Add a time band.
    .addBands(ee.Image(years).rename('t').float())
    // Add a constant band.
    .addBands(ee.Image.constant(1));
};

// Remove clouds, add variables and filter to the area of interest.
var filteredLandsat = l8toa
  .filterBounds(roi)
  .map(maskClouds)
  .map(addVariables);

// Plot a time series of NDVI at a single location.
var l8Chart = ui.Chart.image.series(filteredLandsat.select('NDVI'), roi)
    .setChartType('ScatterChart')
    .setOptions({
      title: 'Landsat 8 NDVI time series at ROI',
      trendlines: {0: {
        color: 'CC0000'
      }},
      lineWidth: 1,
      pointSize: 3,
    });
print(l8Chart);

Landsat 8 TOA数据介绍

NameDescriptionResolutionWavelengthB1

Coastal aerosol

30 meters0.43 - 0.45 μmB2

Blue

30 meters0.45 - 0.51 μmB3

Green

30 meters0.53 - 0.59 μmB4

Red

30 meters0.64 - 0.67 μmB5

Near infrared

30 meters0.85 - 0.88 μmB6

Shortwave infrared 1

30 meters1.57 - 1.65 μmB7

Shortwave infrared 2

30 meters2.11 - 2.29 μmB8

Band 8 Panchromatic

15 meters0.52 - 0.90 μmB9

Cirrus

30 meters1.36 - 1.38 μmB10

Thermal infrared 1, resampled from 100m to 30m

30 meters10.60 - 11.19 μmB11

Thermal infrared 2, resampled from 100m to 30m

30 meters11.50 - 12.51 μmQA_PIXEL

Landsat Collection 2 OLI/TIRS QA Bitmask

30 metersQA_PIXEL Bitmask

  • Bit 0: Fill
    • 0: Image data
    • 1: Fill data
  • Bit 1: Dilated Cloud
    • 0: Cloud is not dilated or no cloud
    • 1: Cloud dilation
  • Bit 2: Cirrus
    • 0: Cirrus Confidence: no confidence level set or Low Confidence
    • 1: High confidence cirrus
  • Bit 3: Cloud
    • 0: Cloud confidence is not high
    • 1: High confidence cloud
  • Bit 4: Cloud Shadow
    • 0: Cloud Shadow Confidence is not high
    • 1: High confidence cloud shadow
  • Bit 5: Snow
    • 0: Snow/Ice Confidence is not high
    • 1: High confidence snow cover
  • Bit 6: Clear
    • 0: Cloud or Dilated Cloud bits are set
    • 1: Cloud and Dilated Cloud bits are not set
  • Bit 7: Water
    • 0: Land or cloud
    • 1: Water
  • Bits 8-9: Cloud Confidence
    • 0: No confidence level set
    • 1: Low confidence
    • 2: Medium confidence
    • 3: High confidence
  • Bits 10-11: Cloud Shadow Confidence
    • 0: No confidence level set
    • 1: Low confidence
    • 2: Reserved
    • 3: High confidence
  • Bits 12-13: Snow / Ice Confidence
    • 0: No confidence level set
    • 1: Low confidence
    • 2: Reserved
    • 3: High confidence
  • Bits 14-15: Cirrus Confidence
    • 0: No confidence level set
    • 1: Low confidence
    • 2: Reserved
    • 3: High confidence

QA_RADSAT

Radiometric saturation QA

30 metersQA_RADSAT Bitmask

  • Bit 0: Band 1 data saturated
  • Bit 1: Band 2 data saturated
  • Bit 2: Band 3 data saturated
  • Bit 3: Band 4 data saturated
  • Bit 4: Band 5 data saturated
  • Bit 5: Band 6 data saturated
  • Bit 6: Band 7 data saturated
  • Bit 7: Unused
  • Bit 8: Band 9 data saturated
  • Bits 9-10: Unused
  • Bit 11: Terrian occlusion
    • 0: No terrain occlusion
    • 1: Terrain occlusion

SAA

Solar Azimuth Angle

30 metersSZA

Solar Zenith Angle

30 metersVAA

View Azimuth Angle

30 metersVZA

View Zenith Angle

30 meters

错误解析

这里我们可以看到很明显的提示,这里的波段中是没有BQA这个波段的,所以这里我们需要进行检查,或者是不是错用了landsat C01之前的数据。这里我们应该使用正常的去云的函数。

正确的代码

var roi = /* color: #d63000 */ee.Geometry.Point([-121.9353461265564, 37.56180984982223]),
    l8toa = ee.ImageCollection("LANDSAT/LC08/C02/T1_TOA");
Map.centerObject(roi, 10);

// Use this function to mask clouds in Landsat 8 imagery.
var maskClouds = function(image) {
  var qa = image.select('QA_PIXEL');
  /// Check that the cloud bit is off.
  // See https://www.usgs.gov/media/files/landsat-8-9-olitirs-collection-2-level-1-data-format-control-book
  var mask = qa.bitwiseAnd(1 << 3).eq(0);
  return image.updateMask(mask);
};

// This field contains UNIX time in milliseconds.
var timeField = 'system:time_start';


// Use this function to add variables for NDVI, time and a constant
// to Landsat 8 imagery.
var addVariables = function(image) {
  // Compute time in fractional years since the epoch.
  var date = ee.Date(image.get(timeField));
  var years = date.difference(ee.Date('1970-01-01'), 'year');
  // Return the image with the added bands.
  return image
    // Add an NDVI band.
    .addBands(image.normalizedDifference(['B5', 'B4']).rename('NDVI')).float()
    // Add a time band.
    .addBands(ee.Image(years).rename('t').float())
    // Add a constant band.
    .addBands(ee.Image.constant(1));
};

// Remove clouds, add variables and filter to the area of interest.
var filteredLandsat = l8toa
  .filterBounds(roi)
  .map(maskClouds)
  .map(addVariables);

// Plot a time series of NDVI at a single location.
var l8Chart = ui.Chart.image.series(filteredLandsat.select('NDVI'), roi)
    .setChartType('ScatterChart')
    .setOptions({
      title: 'Landsat 8 NDVI time series at ROI',
      trendlines: {0: {
        color: 'CC0000'
      }},
      lineWidth: 1,
      pointSize: 3,
    });
print(l8Chart);

 结果

标签:Available,confidence,BQA,bands,image,30,Band,var,Cloud
From: https://blog.csdn.net/qq_31988139/article/details/141967096

相关文章

  • 网站提示“503 Service Unavailable:服务器暂时无法处理请求”错误如何解决
    当您遇到“503ServiceUnavailable:服务器暂时无法处理请求”的错误时,这表示服务器当前不能处理请求,但预计稍后可以恢复。这可能是由于服务器过载、正在进行维护、配置错误或其他暂时性问题。以下是解决此类问题的一些步骤:检查服务器负载:确认服务器是否过载。如果服务器资源(......
  • 网站提示451 Unavailable For Legal Reasons:因法律原因不可用怎么办
    当遇到“451UnavailableForLegalReasons”错误时,这意味着服务器无法提供请求的内容,原因是出于法律原因。这种错误通常出现在内容受到版权保护、涉及敏感信息或其他法律限制的情况下。解决方案检查内容合法性确认请求的内容是否涉及版权、隐私或其他法律问题。如果内容......
  • 网站提示503 Service Unavailable:服务器目前无法使用(由于超载或停机维护)怎么办
    当遇到“503ServiceUnavailable”错误时,这意味着服务器当前因为超载、维护或配置问题而无法处理请求。这种错误通常是因为服务器资源不足或正在进行维护操作。解决方案刷新页面有时候简单地刷新页面就能解决问题。服务器可能只是暂时无法响应请求。稍后再试如果服......
  • No qualifying bean of type 'feign' available: expected at least 1 bean which qua
    问题:刚用低代码平台引入的一个module,但是启动报错Exceptionencounteredduringcontextinitialization-cancellingrefreshattempt:org.springframework.beans.factory.UnsatisfiedDependencyException:Errorcreatingbeanwithname'ServiceImpl'definedinfile[Ser......
  • HTTP Error 503. The service is unavailable.
    第一次遇见这个问题,装了IIS重写模块导致的。查了资料才知道,是URLRewrite的版本和2012系统的lIS不兼容导致。最新的URLRewrite的版本是2018年9月20日的7.1.1993.2351版,就是这个版本产生问题,不能用在2012上,在它前面的一个版本是2017年6月7日的7.1.1980.0版,这个......
  • 解决pip无法更新问题的简单方法:WARNING: You are using pip version 20.2.1; however,
    用pip安装python应用的程序包时,也遇到了同样的问题,pip无法正常更新,因此就不能用pip下载安装程序包了。需要必须把pip更新到最新的状态后,才能使用pip的便捷功能。当时网上搜搜答案解决了,没有记录下来。今天使用pip使,又遇到了同样的问题,依然是网上一顿搜,试了各种方法,才成功安装好了......
  • [Typescript] Restrict available operations on values using value objects
    ValueObjectsareanotherpatterninDomain-drivenDesignthatprovidemorestructurearoundwhatyoucanandcannotdowithatype.InTypeScriptwecreateValueObjectswithclassesthatwilldefinewhatoperationscanbeperformedtothevalueonthec......
  • 服务启动报错: [ main] c.a.n.c.config.http.ServerHttpAgent : no available server
    场景:一个服务,注册中心使用nacos 服务启动时报错:2024-07-1913:11:17.466ERROR32188---[main]c.a.n.c.config.http.ServerHttpAgent:[NACOSSocketTimeoutExceptionhttpGet]currentServerAddr:http://localhost:8848,err:connecttimedout2024-07-1913:11:18.......