1

我想将 1985 年至今的所有 Landsat 传感器结合到 Google Earth Engine 中,去除云层并计算 NBR 指数的时间序列。作为一个新的 GEE 用户,我有以下内容:

// find all data and filter them by date
var lst5 = ee.ImageCollection('LANDSAT/LT5_SR').filterDate('1984-10-01', '2011-10-01');
var lst7 = ee.ImageCollection('LANDSAT/LE7_SR').filterDate('2011-10-01', '2013-04-07');
var lst8 = ee.ImageCollection('LANDSAT/LC8_SR').filterDate('2013-04-07', '2018-05-01');
var lst7_08 = ee.ImageCollection('LANDSAT/LE7_SR').filterDate('2007-12-01', '2008-02-01');
var lst7_92 = ee.ImageCollection('LANDSAT/LT4_SR').filterDate('1992-01-02', '1992-04-01');


// Combine all landsat data, 1985 through 2015
var everything = ee.ImageCollection(lst5.merge(lst7));
everything = everything.merge(lst8);
everything = everything.merge(lst7_08);
everything = everything.merge(lst7_92);

var alltogether = ee.ImageCollection(everything.filterDate('1984-01-01', '2018-05-01'));

从这一点来看,我不知道如何去除云层并为我最终收藏的每张图像计算 NBR 指数(此处为 NBR 指数)。

谁能帮我?

谢谢你。

编辑:

我认为我需要normalizedDifference在我的集合上映射一个函数以获得 NBR 索引,但我不确定如何使用不同的传感器为我的集合执行此操作。

4

1 回答 1

4

你在这里有很多事情要做,但这就是我认为你想要的。您应该非常仔细地检查它以确保它的行为符合预期:

// Function to cloud mask Landsat 8.
var maskL8SR = function(image) {
  // Bits 3 and 5 are cloud shadow and cloud, respectively.
  var cloudShadowBitMask = ee.Number(2).pow(3).int();
  var cloudsBitMask = ee.Number(2).pow(5).int();
  // Get the QA band.
  var qa = image.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 image
      // Scale the data to reflectance and temperature.
      .select(['B5', 'B7'], ['NIR', 'SWIR']).multiply(0.0001)
      .addBands(image.select(['B11'], ['Thermal']).multiply(0.1))
      .updateMask(mask);
};

// Function to cloud mask Landsats 5-7
var maskL57SR = function(image) {
  var qa = image.select('pixel_qa');
  // Second bit must be zero, meaning none to low cloud confidence.
  var mask1 = qa.bitwiseAnd(ee.Number(2).pow(7).int()).eq(0).and(
      qa.bitwiseAnd(ee.Number(2).pow(3).int()).lte(0)); // cloud shadow
  // This gets rid of irritating fixed-pattern noise at the edge of the images.
  var mask2 = image.select('B.*').gt(0).reduce('min');
  return image
      .select(['B4', 'B7'], ['NIR', 'SWIR']).multiply(0.0001)
      .addBands(image.select(['B6'], ['Thermal']).multiply(0.1))
      .updateMask(mask1.and(mask2));
};

// find all data and filter them by date
var lst5 = ee.ImageCollection('LANDSAT/LT05/C01/T1_SR')
    .filterDate('1984-10-01', '2011-10-01')
    .map(maskL57SR)
var lst7 = ee.ImageCollection('LANDSAT/LE07/C01/T1_SR')
    .filterDate('2011-10-01', '2013-04-07')
    .map(maskL57SR)
var lst8 = ee.ImageCollection('LANDSAT/LC08/C01/T1_SR')
    .filterDate('2013-04-07', '2018-05-01')
    .map(maskL8SR)
var lst7_08 = ee.ImageCollection('LANDSAT/LE07/C01/T1_SR')
    .filterDate('2007-12-01', '2008-02-01')
    .map(maskL57SR)
var lst7_92 = ee.ImageCollection('LANDSAT/LT04/C01/T1_SR')
    .filterDate('1992-01-02', '1992-04-01')
    .map(maskL57SR)

// Combine all landsat data, 1985 through 2015
var everything = ee.ImageCollection(lst5.merge(lst7));
everything = everything.merge(lst8);
everything = everything.merge(lst7_08);
everything = everything.merge(lst7_92);

// NBR:
var nbrFunction = function(image) {
  image = ee.Image(image)
  return image.addBands(image.expression(
    '(nir - 0.0001 * swir * thermal) / ' +
    '(nir + 0.0001 * swir * thermal)', {
      nir: image.select(['NIR']),
      swir: image.select(['SWIR']),
      thermal: image.select(['Thermal'])
    }).rename('NBR').clamp(-1, 1));
};

everything = everything.map(nbrFunction);

var check = ee.Image(everything.first());
Map.centerObject(check);
Map.addLayer(check);
于 2018-07-03T18:19:11.620 回答