GEE:遥感影像数据集的多个属性获取分析
作者:互联网
目录
前言
如何查看影像数据集的各个属性?
以鄱阳湖湖区Landsat遥感影像为例,该区域的相关分析参见:
GEE学习:按照行列号筛选鄱阳湖湖区影像数据并查询相关信息.
GEE学习:Landsat8 Collection2 level2数据集获取影像范围及坐标.
GEE学习:遥感影像设置新的属性并查询.
GEE学习:使用正则表达式筛选影像波段并改名.
本次进行分析的区域如下,影像为2020年3月14日Landsat8数据:
一、分析内容
主要分析内容:
二、python代码
python代码如下
Map = geemap.Map()
collection = ee.ImageCollection('LANDSAT/LC08/C01/T1_TOA') \
.filterDate('2020-01-01', '2020-12-31') \
.filter(ee.Filter.eq('WRS_PATH', 121)) \
.filter(ee.Filter.eq('WRS_ROW', 40)) \
.sort('system:time_start')
first = collection.first()
Map.addLayer(first, {'bands':['B7', 'B5', 'B3'], 'min':0, 'max':0.3}, 'first')
Map.centerObject(first)
Map
结果如下:
可视化结果见上图
# 查询影像集内的影像数量
print('count:',collection.size().getInfo())
# 查询影像数据范围
range = collection.reduceColumns(ee.Reducer.minMax(), ['system:time_start'])
print('Data range:', ee.Date(range.get('min')).format('yyyy-MM-dd').getInfo(),
ee.Date(range.get('max')).format('yyyy-MM-dd').getInfo())
# 查询影像集的统计属性
sunStats = collection.aggregate_stats('SUN_ELEVATION')
print('sun elevation statistics:', sunStats.getInfo())
# 该时间段内的所有影像id
image_ids = collection.aggregate_array('system:id')
print('image ids:', image_ids.getInfo())
# 该时间段内的所有影像获取时间system:time_start
Dates = collection.aggregate_array('system:time_start') \
.map(lambda d: ee.Date(d).format('yyyy-MM-dd'))
print('all the images dates:', Dates.getInfo())
# 云量排序,获取影像信息
first = collection.sort('CLOUD_COVER').first()
print('Least cloud image:', first.bandNames().getInfo())
# 该时间段内的前5个影像
limit5 = collection.sort('system:time_start').limit(5)
# limit5.getInfo()
结果如下:
count: 12
Data range: 2020-03-14 2020-12-27
sun elevation statistics: {'max': 69.12312316894531, 'mean': 58.50251611073812, 'min': 33.47686004638672, 'sample_sd': 11.158252018414434, 'sample_var': 124.50658810644977, 'sum': 702.0301933288574, 'sum_sq': 42440.10516461702, 'total_count': 12, 'total_sd': 10.683212957606852, 'total_var': 114.13103909757895, 'valid_count': 12, 'weight_sum': 12, 'weighted_sum': 702.0301933288574}
image ids: ['LANDSAT/LC08/C01/T1_TOA/LC08_121040_20200314', 'LANDSAT/LC08/C01/T1_TOA/LC08_121040_20200415', 'LANDSAT/LC08/C01/T1_TOA/LC08_121040_20200517', 'LANDSAT/LC08/C01/T1_TOA/LC08_121040_20200602', 'LANDSAT/LC08/C01/T1_TOA/LC08_121040_20200618', 'LANDSAT/LC08/C01/T1_TOA/LC08_121040_20200720', 'LANDSAT/LC08/C01/T1_TOA/LC08_121040_20200805', 'LANDSAT/LC08/C01/T1_TOA/LC08_121040_20200821', 'LANDSAT/LC08/C01/T1_TOA/LC08_121040_20200906', 'LANDSAT/LC08/C01/T1_TOA/LC08_121040_20201008', 'LANDSAT/LC08/C01/T1_TOA/LC08_121040_20201024', 'LANDSAT/LC08/C01/T1_TOA/LC08_121040_20201227']
all the images dates: ['2020-03-14', '2020-04-15', '2020-05-17', '2020-06-02', '2020-06-18', '2020-07-20', '2020-08-05', '2020-08-21', '2020-09-06', '2020-10-08', '2020-10-24', '2020-12-27']
Least cloud image: ['B1', 'B2', 'B3', 'B4', 'B5', 'B6', 'B7', 'B8', 'B9', 'B10', 'B11', 'BQA']
三、小结
学习了影像数据集的多个属性的查询, 如影像数据集内影像的数量,影像起止时间、影像集统计、影像按照某一特征进行排序等
参考:
- https://github.com/giswqs/earthengine-py-notebooks/blob/master/ImageCollection/metadata.ipynb
- https://developers.google.com/earth-engine/apidocs/ee-imagecollection-aggregate_stats?hl=en
标签:LANDSAT,T1,遥感,LC08,2020,GEE,TOA,影像 来源: https://blog.csdn.net/qq_32497109/article/details/122777628