0
点赞
收藏
分享

微信扫一扫

GEE:探索黄河流域20年来植被变化特征

棒锤_45f2 2022-02-04 阅读 65

目录


前言

GEE,如何分析黄河流域20年来植被变化特征?

本次进行分析的区域如下:
在这里插入图片描述


一、分析步骤

主要分析步骤:

二、python代码

1、加载影像集

python代码如下

# 定义添加时间波段函数,将毫秒历元转换为年单位
def addTime(image):
    return image.addBands(image.metadata('system:time_start').divide(1000 * 60 * 60 * 24 * 365))

# 添加MODIS影像集合,添加时间波段
collection = ee.ImageCollection('MODIS/006/MYD13A1') \
    .filterDate('2010-01-01', '2020-12-31') \
    .map(addTime) 

2、流域植被变化特征

  • ee.Reducer.linearFit()
    在这里插入图片描述
    python代码如下:
# 流域边界
basin_shp = '../world_basins/worldrivers2/huanghe.shp' 
basin_bj = geemap.shp_to_ee(basin_shp) 
roi = basin_bj.geometry()

# 选择用于线性趋势预测的波段
trend = collection.select(['system:time_start', 'NDVI']) \
    .reduce(ee.Reducer.linearFit()) \
    .clip(roi)

Map = geemap.Map()
Map.centerObject(roi)
# 绿色为增加趋势,红色为减少趋势
Map.addLayer(
    trend,
    {'bands':['scale', 'scale', 'offset'], 'min':0, 'max':[-100, 100, 10000]},
    'NDVI'
)
Map

结果如下:
在这里插入图片描述


三、小结

  1. 通过MODIS长时间序列NDVI变化,探索了流域内植被的变化特征
  2. 应掌握ee.Reducer.linearFit()函数的用法,该函数有2个参数的产出,分别为scale(斜率)和offset(截距),可以通过scale的变化看出区域植被的演变趋势。

参考:
  • https://developers.google.com/earth-engine/apidocs/ee-reducer-linearfit?hl=en
  • https://developers.google.com/earth-engine/guides/ic_reducing
  • https://github.com/giswqs/earthengine-py-notebooks/blob/master/ImageCollection/reducing_collection.ipynb
举报

相关推荐

0 条评论