Google Earth EngineGEE合成长时序的月NDVI和LST
今天来简单分享下如何在GEE合成长时序的月NDVI与LST,并进行分析
目标:
利用MODIS为数据源,在GEE计算某一地区对月NDVI与LST,并制作统计图
以武汉市为研究区
GEE实现代码:
首先确定研究区和使用的数据集
-
var roi = ee.FeatureCollection("users/lilei655123/WUhan");
-
Map.centerObject(roi,7)
-
var styling = {color:"red",fillColor:"00000000"};
-
Map.addLayer(roi.style(styling),{},"geometry")
-
//添加MODIS植被指数16天全球250米
-
var Coll_NDVI = ee.ImageCollection("MODIS/006/MOD13Q1")
-
//MODIS/006/MOD13A1
-
var Coll_LST = ee.ImageCollection("MODIS/006/MOD11A2")
-
//MODIS/006/MOD11A1
确定起止时间和月份
-
var startYear = 2010;
-
var endYear = 2020;
-
var startDate = ee.Date.fromYMD(startYear, 1, 1);
-
var endDate = ee.Date.fromYMD(endYear, 12, 31);
合成NDVI和LST
-
Coll_NDVI = Coll_NDVI.filterDate(startDate, endDate).select("NDVI");
-
Coll_NDVI = ee.ImageCollection(ee.Algorithms.If(Coll_NDVI.size().eq(0),
-
ee.ImageCollection(ee.Image(0).selfMask().rename('NDVI')),
-
Coll_NDVI
-
));
-
Coll_LST = Coll_LST.filterDate(startDate, endDate).select("LST_Day_1km");
-
Coll_LST = ee.ImageCollection(ee.Algorithms.If(Coll_LST.size().eq(0),
-
ee.ImageCollection(ee.Image(0).selfMask().rename('LST_Day_1km')),
-
Coll_LST
-
));
-
// MOD12Q1数据的NDVI比例为0.0001 [ 最小值=-2000,最大值=10000]
-
var Coll_NDVI = Coll_NDVI.map(function(img) {
-
return img
-
.divide(10000).float().set("system:time_start", img.get("system:time_start")); // keep time info
-
});
-
-
-
var Coll_LST = Coll_LST.map(function(img) {
-
return img
-
.multiply(0.02).subtract(273.15).float().set("system:time_start", img.get("system:time_start")); // keep time info
-
});
-
-
-
print(Coll_NDVI);
-
print(Coll_LST);
合成月NDVI
-
var monthlyNDVI = ee.ImageCollection.fromImages(
-
years.map(function (y) {
-
return months.map(function(m) {
-
var monthly = Coll_NDVI
-
.filter(ee.Filter.calendarRange(y, y, "year"))
-
.filter(ee.Filter.calendarRange(m, m, "month"))
-
.mean();
-
return monthly
-
.set("year", y)
-
.set("month", m)
-
.set('date', ee.Date.fromYMD(y,m,1))
-
.set("system:time_start", ee.Date.fromYMD(y, m, 1));}); })
-
.flatten());
-
print('monthlyNDVI',monthlyNDVI)
-
//最大合成NDVI
-
var MonthlyMAX = ee.ImageCollection.fromImages(months
-
.map(function (m) {
-
var maxNDVI = monthlyNDVI.filter(ee.Filter.eq("month", m))
-
.reduce(ee.Reducer.percentile({percentiles: [90]}));
-
return maxNDVI
-
.set("month", m);})
-
.flatten());
-
//print (MonthlyMAX, 'MonthlyMAX');
-
Map.addLayer (MonthlyMAX.first().clip(roi), {min:0, max:1, 'palette': ['red','yellow', 'green']}, 'MonthlyMAX');
-
-
-
var MonthlyMIN = ee.ImageCollection.fromImages(months
-
.map(function (m) {
-
var minNDVI = monthlyNDVI.filter(ee.Filter.eq("month", m))
-
.reduce(ee.Reducer.percentile({percentiles: [10]}));
-
return minNDVI
-
.set("month", m);})
-
.flatten());
-
//print (MonthlyMIN, 'MonthlyMIN');
-
Map.addLayer (MonthlyMIN.first().clip(roi), {min:0, max:1, 'palette': ['red','yellow', 'green']}, 'MonthlyMIN');
同样的方法合成月LST
-
var monthlyLST = ee.ImageCollection.fromImages(
-
years.map(function (y) {
-
return months.map(function(m) {
-
var monthly = Coll_LST
-
.filter(ee.Filter.calendarRange(y, y, "year"))
-
.filter(ee.Filter.calendarRange(m, m, "month"))
-
.mean();
-
return monthly
-
.set("year", y)
-
.set("month", m)
-
.set('date', ee.Date.fromYMD(y,m,1))
-
.set("system:time_start", ee.Date.fromYMD(y, m, 1));}); })
-
.flatten());
-
print('monthlyLST',monthlyLST)
-
-
-
-
-
//最大合成LST
-
var Monthly_LST_MAX = ee.ImageCollection.fromImages(months
-
.map(function (m) {
-
var maxNDVI = monthlyLST.filter(ee.Filter.eq("month", m))
-
.reduce(ee.Reducer.percentile({percentiles: [90]}));
-
return maxNDVI
-
.set("month", m);})
-
.flatten());
-
-
//print (Monthly_LST_MAX, 'Monthly_LST_MAX');
-
Map.addLayer (Monthly_LST_MAX.first().clip(roi), {min:15, max:35, 'palette': ['red','yellow', 'green']}, 'Monthly_LST_MAX');
-
-
-
var Monthly_LST_MIN = ee.ImageCollection.fromImages(months
-
.map(function (m) {
-
var minNDVI = monthlyNDVI.filter(ee.Filter.eq("month", m))
-
.reduce(ee.Reducer.percentile({percentiles: [10]}));
-
return minNDVI
-
.set("month", m);})
-
.flatten());
-
-
//print (Monthly_LST_MIN, 'Monthly_LST_MIN');
-
Map.addLayer (Monthly_LST_MIN.first().clip(roi), {min:0, max:1, 'palette': ['red','yellow', 'green']}, 'Monthly_LST_MIN');
创建统计图
-
var ndviTimeSeries = ui.Chart.image.seriesByRegion(
-
monthlyNDVI, roi, ee.Reducer.mean(), 'NDVI', 500, 'system:time_start', 'label')
-
.setChartType('ScatterChart')
-
.setOptions({trendlines: {0: {color: 'green'}},lineWidth: 1,pointSize: 3,
-
title: 'MODIS NDVI Time Series',
-
vAxis: {title: 'NDVI'},
-
series: {
-
0: {color: 'green'},
-
-
}});
-
print(ndviTimeSeries);
-
print(ui.Chart.image.series(monthlyNDVI , roi , ee.Reducer.mean(), 500));
运行结果如下:
LST
NDVI的带状平均值
LST的带状平均值
感谢关注,欢迎转发!
声明:仅供学习使用!
希望关注的朋友们转发,如果对你有帮助的话记得给小编点个赞或者在看!
这篇好文章是转载于:学新通技术网
- 版权申明: 本站部分内容来自互联网,仅供学习及演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,请提供相关证据及您的身份证明,我们将在收到邮件后48小时内删除。
- 本站站名: 学新通技术网
- 本文地址: /boutique/detail/tanhibafga
系列文章
更多
同类精品
更多
-
photoshop保存的图片太大微信发不了怎么办
PHP中文网 06-15 -
word里面弄一个表格后上面的标题会跑到下面怎么办
PHP中文网 06-20 -
photoshop扩展功能面板显示灰色怎么办
PHP中文网 06-14 -
《学习通》视频自动暂停处理方法
HelloWorld317 07-05 -
TikTok加速器哪个好免费的TK加速器推荐
TK小达人 10-01 -
Android 11 保存文件到外部存储,并分享文件
Luke 10-12 -
微信公众号没有声音提示怎么办
PHP中文网 03-31 -
excel下划线不显示怎么办
PHP中文网 06-23 -
微信运动停用后别人还能看到步数吗
PHP中文网 07-22 -
excel打印预览压线压字怎么办
PHP中文网 06-22