zl程序教程

您现在的位置是:首页 >  其他

当前栏目

Google Earth Engine(GEE)——过滤filter影像集合

Google集合 Engine Earth 过滤 filter GEE 影像
2023-09-11 14:15:12 时间

Earth Engine 提供了多种方便的方法来过滤图像集合。具体来说,许多常见用例由imageCollection.filterDate()、 和处理imageCollection.filterBounds()。对于一般目的的过滤,使用 imageCollection.filter()具有ee.Filter作为参数。以下示例演示了两种便捷方法以及filter() 从 中识别和删除配准不良的图像ImageCollection

filterMetadata(name, operator, value)

按元数据过滤集合的快捷方式。这相当于 this.filter(ee.Filter.metadata(...))。当然这两个可以根据自己喜好来随意切换。

Shortcuts to filter a collection by metadata. This is equivalent to this.filter(ee.Filter.metadata(...)).

Returns the filtered collection.

Arguments:

this:collection (Collection):

The Collection instance.

name (String):这里一般是你要过滤的影像波段名称

The name of a property to filter.

operator (String):这里是进行顾虑的条件

The name of a comparison operator. Possible values are: "equals", "less_than", "greater_than",

"not_equals", "not_less_than", "not_greater_than", "starts_with",

"ends_with", "not_starts_with", "not_ends_with", "contains",

"not_contains".

value (Object):

- The value to compare against.

Returns: Collection

ee.Algorithms.Landsat.simpleComposite(collection, percentilecloudScoreRangemaxDepthasFloat)

从原始 Landsat 场景集合中计算 Landsat TOA 合成。它应用标准 TOA 校准,然后使用 SimpleLandsatCloudScore 算法为每个像素分配一个云分数。它在每个点选择尽可能低的云分数范围,然后根据接受的像素计算每个波段的百分位值。该算法还使用 LandsatPathRowLimit 算法在超过 maxDepth 输入场景可用的区域中仅选择最少云的场景。说白了就是一个简单的除云函数。

Computes a Landsat TOA composite from a collection of raw Landsat scenes. It applies standard TOA calibration and then assigns a cloud score to each pixel using the SimpleLandsatCloudScore algorithm. It selects the lowest possible range of cloud scores at each point and then computes per-band percentile values from the accepted pixels. This algorithm also uses the LandsatPathRowLimit algorithm to select only the least-cloudy scenes in regions where more than maxDepth input scenes are available.

Arguments:

collection (ImageCollection):影像集合

The raw Landsat ImageCollection to composite.

percentile (Integer, default: 50):百分比

The percentile value to use when compositing each band.

cloudScoreRange (Integer, default: 10):可以接受的云质量的影像范围

The size of the range of cloud scores to accept per pixel.

maxDepth (Integer, default: 40):

An approximate limit on the maximum number of scenes used to compute each pixel.

用于计算每个像素的最大场景数的近似限制。

asFloat (Boolean, default: false):

如果为真,则输出波段与 Landsat.TOA 算法的单位相同;如果为 false,TOA 值将通过乘以 255(反射带)或减去 100(热带)并四舍五入到最接近的整数来转换为 uint8。这里默认false我也不知道为什么,一般不影响结果就好。

If true, output bands are in the same units as the Landsat.TOA algorithm; if false, TOA values are converted to uint8 by multiplying by 255 (reflective bands) or subtracting 100 (thermal bands) and rounding to the nearest integer.

Returns: Image

这是显示效果不好的影像

 这个现实效果较好,这里重点说的是除了云之后的影像完整性! 

代码:

// 加载Landsat5影像,然后按照时间进行筛选并且以点为数据进行筛选
var collection = ee.ImageCollection('LANDSAT/LT05/C01/T2')
  .filterDate('1987-01-01', '1990-05-01')
  .filterBounds(ee.Geometry.Point(25.8544, -18.08874));

// 同样可以进行影像质量的筛选,一会会介绍关于filterMetadata函数
var filtered = collection
  .filterMetadata('IMAGE_QUALITY', 'equals', 9);

// 创建两个简单合成以检查按上面进行过筛选过后的 IMAGE_QUALITY 过滤的效果。
var badComposite = ee.Algorithms.Landsat.simpleComposite(collection, 75, 3);
var goodComposite = ee.Algorithms.Landsat.simpleComposite(filtered, 75, 3);

// 加载展示的中心经纬度和缩放打下,最后展示两幅影像
//效果明显是经过质量筛选后的效果好
Map.setCenter(25.8544, -18.08874, 13);
Map.addLayer(badComposite,
             {bands: ['B3', 'B2', 'B1'], gain: 3.5},
             'bad composite');
Map.addLayer(goodComposite,
             {bands: ['B3', 'B2', 'B1'], gain: 3.5},
             'good composite');