如何从陆地卫星图像中去除云层

问题描述 投票:0回答:1
我正在尝试计算平均每年 MSAVI2 点估计值,但我想在分析中考虑云层覆盖情况。我认为这可以通过过滤数据以仅包含云层覆盖率低于 10% 的图像来实现。我认为可以使用

ee.Algorithms.Landsat.simpleComposite

 函数来做到这一点,但是当我将该函数应用于我的 
filtered
 变量时,我继续运行其余的代码,这表明filtered.map 不是一个函数。我的猜测是 simplecomposite 函数以某种方式改变了过滤对象的类,但我不确定如何正确实现 
ee.Algorithms.Landsat.simpleComposite
 以仅包含云量低于 10% 的图像。我对 Google 地球引擎还很陌生,因此我们将不胜感激任何帮助!

var LS7 = ee.ImageCollection("LANDSAT/LE07/C02/T1"), //filtering data var filtered = LS7.filterDate('2016-01-01', '2016-12-31'); var filtered = ee.Algorithms.Landsat.simpleComposite({collection: filtered,asFloat:true}) // Map over the collection to produce the desired data as a collection. var MSAVI2_collection = filtered.map(function (image) { return image.expression( '(2 * NIR + 1 - sqrt(pow((2 * NIR + 1), 2) - 8 * (NIR - RED)) ) / 2', { 'NIR': image.select('B4'), 'RED': image.select('B3') } ); }); //take an average of all MSAVI2 Values. var MSAVI2 = MSAVI2_collection.median(); //add the MSAVI2 layer Map.addLayer(MSAVI2, {min: -0.15, max: 0.15}, 'MSAVI2');
    
cloud google-earth-engine
1个回答
0
投票
我不断运行其余的代码,这表明filtered.map不是一个函数。

原因是

ee.Algorithms.Landsat.simpleComposite

的输出是一个简单的图像,而不是
ImageCollection
 ee对象(根据
函数文档),并且ee.Image
没有
map
方法。

要计算单个图像中的 MSAVI2 表达式,请遵循以下方法:

// Check the image type of 'filtered' variable print(ee.Algorithms.ObjectType(filtered)); // Compute MSAVI2 index var getMSAVI2 = function(img){ return img.expression( '(2 * NIR + 1 - sqrt(pow((2 * NIR + 1), 2) - 8 * (NIR - RED)) ) / 2', { 'NIR': img.select('B4'), 'RED': img.select('B3') }); }; // Apply above function to the composite image var MSAVI2 = getMSAVI2(filtered); //add the MSAVI2 layer Map.addLayer(MSAVI2, {min: -0.15, max: 0.15}, 'MSAVI2');
    
© www.soinside.com 2019 - 2024. All rights reserved.