簡體   English   中英

如何屏蔽 LANDSAT/LE07/C01/T1_TOA 的陰影?

[英]How to mask out shadows from LANDSAT/LE07/C01/T1_TOA?

我想在谷歌地球引擎中使用 LANDSAT/LE07/C01/T1_TOA 集合,我正在努力了解這些位是如何工作的,以便用雲和陰影掩蓋區域。 我設法寫了以下內容,但我不是很自信,也不知道如何遮蓋陰影。

var dataset = ee.ImageCollection('LANDSAT/LE07/C01/T1_TOA')
 .filterBounds(geometry)
    .map(function(image){return image.clip(geometry)})
    .filter(ee.Filter.calendarRange(6,8,'month'))
      .filterDate('1999-05-01','2017-09-30');

var qas = function(image) {
  var qa = image.select('BQA');
  var mask = qa.eq(672);
  return image.updateMask(mask).copyProperties(image);
}
var merged = dataset.map(qas);


var addNDVI = function(image) {
  var ndvi = image.normalizedDifference(['B4', 'B3']).rename('NDVI');
  return image.addBands(ndvi);
};

var ndvi = merged.map(addNDVI);

如何正確地用位進行質量掩蔽?

嘗試一下


var cloudMaskL7 = function(image) {
  var qa = image.select('BQA');
  var cloud = qa.bitwiseAnd(1 << 4)
                  .and(qa.bitwiseAnd(1 << 6))
                  .or(qa.bitwiseAnd(1 << 8));
  var mask2 = image.mask().reduce(ee.Reducer.min());
  return image
       .select(['B3', 'B4'], ['Red', 'NIR'])
       .updateMask(cloud.not()).updateMask(mask2)
       .set('system:time_start', image.get('system:time_start'));
};


var dataset = ee.ImageCollection("LANDSAT/LE07/C01/T1_TOA")
                            .filterBounds(geometry)
                            .filterDate('2012-05-01','2017-09-30')
                            .map(cloudMaskL7)

var NDVIofLANDSAT = function(image) {
  var ndvi = image.normalizedDifference(['NIR', 'Red']).rename('NDVI');
  return image.addBands(ndvi);
};

var ndviCollection = dataset
                     .map(NDVIofLANDSAT)
                     .select("NDVI");
print("Total no of LANDSAT Images ", ndviCollection);
Map.addLayer (ndviCollection.first().select('NDVI').clip(geometry),  {min:0, max:1,  'palette': ['red','yellow', 'green']}, 'NDVI')

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM