Google Earth Engine(GEE)——Landsat8影像数组排序和归约

阵列排序对于获得自定义质量的mask很有用,这涉及根据不同波段中的值减少图像波段的子集。以下示例按云索引排序,然后获取集合中云最少的图像子集的平均值:

函数:

ee.Algorithms.Landsat.simpleCloudScore(image)

使用亮度、温度和 NDSI 的组合计算 [0,100] 范围内的简单的云似然分数。这不是一个多云的云检测器,主要用于比较同一点的多个外观以获取*相对*云可能性。

Computes a simple cloud-likelihood score in the range [0,100] using a combination of brightness, temperature, and NDSI. This is not a robust cloud detector, and is intended mainly to compare multiple looks at the same point for *relative* cloud likelihood.

Arguments:

image (Image):

The Landsat TOA image to process.

Returns: Image

代码:

// 将任意感兴趣区域定义为一个点。
var roi = ee.Geometry.Point(-122.26032, 37.87187);

// 使用这些波段。
var bandNames = ee.List(['B2', 'B3', 'B4', 'B5', 'B6', 'B7', 'B10', 'B11']);

// 加载 Landsat 8 影像集合。
var collection = ee.ImageCollection('LANDSAT/LC08/C01/T1_TOA')
  // 选择感兴趣的波段以避免占用内存。
  .select(bandNames)
  // 过滤以仅获取感兴趣点的图像。
  .filterBounds(roi)
  // 过滤以仅获取六个月的数据。
  .filterDate('2014-06-01', '2014-12-31')
  // 通过在集合上映射 cloudMask 函数来屏蔽云。
  // 这将为每个图像添加一个名为“cloud”的云尽心简单给这个点影像是否有云评分来对比。
  .map(function(image) {
    return ee.Algorithms.Landsat.simpleCloudScore(image);
});

// 将集合转换为数组。
var array = collection.toArray();

// 轴的标签。
var imageAxis = 0;
var bandAxis = 1;

// 获取云切片和感兴趣的波段。
var bands = array.arraySlice(bandAxis, 0, bandNames.length());
var clouds = array.arraySlice(bandAxis, bandNames.length());

// 按云量排序。
var sorted = bands.arraySort(clouds);

// 获取最少混浊的图像,占总数的 20%。
var numImages = sorted.arrayLength(imageAxis).multiply(0.2).int();
var leastCloudy = sorted.arraySlice(imageAxis, 0, numImages);

// 通过沿图像轴减少来获得最少云图像的平均值。
var mean = leastCloudy.arrayReduce({
  reducer: ee.Reducer.mean(),
  axes: [imageAxis]
});

// 将缩小后的阵列图像变成多波段图像进行显示。
var meanImage = mean.arrayProject([bandAxis]).arrayFlatten([bandNames]);
Map.centerObject(roi, 12);
Map.addLayer(meanImage, {bands: ['B5', 'B4', 'B2'], min: 0, max: 0.5});

影像结果:

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

此星光明

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值