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);
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
QA_RADSAT
Radiometric saturation QA
30 metersQA_RADSAT Bitmask
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);
扫码关注腾讯云开发者
领取腾讯云代金券
Copyright © 2013 - 2025 Tencent Cloud. All Rights Reserved. 腾讯云 版权所有
深圳市腾讯计算机系统有限公司 ICP备案/许可证号:粤B2-20090059 深公网安备号 44030502008569
腾讯云计算(北京)有限责任公司 京ICP证150476号 | 京ICP备11018762号 | 京公网安备号11010802020287
Copyright © 2013 - 2025 Tencent Cloud.
All Rights Reserved. 腾讯云 版权所有