当前位置:网站首页>GEE(8):使用MODIS填补由去云后的Landsat影像计算得到的NDVI数据
GEE(8):使用MODIS填补由去云后的Landsat影像计算得到的NDVI数据
2022-08-01 19:16:00 【BetterQ.】
最近想要在GEE中使用Landsat影像计算一下广州的NDVI值,发现这片区域云覆盖较多,去云以后部分月份的数据很少,就造成NDVI计算结果缺失的问题。经过查阅相关资料,可以使用MODIS的NDVI产品来填补由Landsat计算NDVI数据缺失的部分。主要用到了GEE中的.blend()函数。
.
实现代码如下:
//设置研究区
var geometry =
/* color: #d63000 */
/* shown: false */
/* displayProperties: [ { "type": "rectangle" } ] */
ee.Geometry.Polygon(
[[[112.38214918009086, 23.76360001525737],
[112.38214918009086, 22.348421631032746],
[114.09601636759086, 22.348421631032746],
[114.09601636759086, 23.76360001525737]]], null, false);
//Landsat去云函数
function maskL8sr(image) {
// Bits 3 and 5 are cloud shadow and cloud, respectively.
var cloudShadowBitMask = (1 << 3);
var cloudsBitMask = (1 << 5);
// Get the pixel QA band.
var qa = image.select('pixel_qa');
// Both flags should be set to zero, indicating clear conditions.
var mask = qa.bitwiseAnd(cloudShadowBitMask).eq(0)
.and(qa.bitwiseAnd(cloudsBitMask).eq(0));
return image.updateMask(mask);
}
// 定义计算NDVI函数
var getNDVI = function(image){
var NDVI = image.normalizedDifference(['B5', 'B4']).rename('NDVI')
return image.addBands(NDVI).copyProperties(image, ["system:time_start"])
};
//由Landsat 8 计算NDVI
var l8 = ee.ImageCollection('LANDSAT/LC08/C01/T1_SR')
.map(maskL8sr)
.filterBounds(geometry)
.select('B4','B5')
.map(getNDVI)
.select(['NDVI'])
//导入MODIS NDVI产品
var MOD13Q1 = ee.ImageCollection('MODIS/006/MOD13Q1').select('NDVI')
.map(function(image){
var img = image.multiply(0.0001);
return img.set('system:time_start',image.get('system:time_start')) ;
});
// 以2020年为例,计算2020年12个月NDVI最大值
var listMonths = ee.List.sequence(1,12);
var collectMonth = ee.ImageCollection(listMonths
.map(function(month) {
var start = ee.Date.fromYMD(2020, month, 1);
var end = ee.Date.fromYMD(2020, month, 1).advance(1, 'month');
var landsat = l8.filterDate(start, end).max()
var modis = MOD13Q1.filterDate(start, end).max().reproject('EPSG:4326',null,250)
return modis.blend(landsat)
.reduce(ee.Reducer.max()).float().clip(geometry)
.set('system:time_start',month)
.resample();
}));
//print (collectMonth);
var visParams = {
bands: ['B4', 'B3', 'B2'],
min: 0,
max: 3000,
gamma: 1.4,
};
var ndviVis = {
min: 0.0,
max: 1.0,
palette: [
'FFFFFF', 'CE7E45', 'DF923D', 'F1B555', 'FCD163', '99B718', '74A901',
'66A000', '529400', '3E8601', '207401', '056201', '004C00', '023B01',
'012E01', '011D01', '011301'
],
};
var dataset = ee.ImageCollection('LANDSAT/LC08/C01/T1_SR')
.filterDate('2020-01-01', '2020-02-01')
.map(maskL8sr);
var ndvil8 = dataset.map(getNDVI)
.select('NDVI')
.max()
.clip(geometry);
Map.addLayer(ndvil8,ndviVis,'landsat_NDVI'); //使用去云后Landsat数据计算得到的NDVI
Map.addLayer(ee.Image(collectMonth.toList(12).get(0)),ndviVis,'Tianbu'); //使用MODIS填补后
Map.addLayer(dataset,visParams,'OriginImage'); //原始影像
//批量展示2020年12个月的NDVI计算结果
for(var i = 0;i < 12;i++){
var image = ee.Image(collectMonth.toList(12).get(i));
Map.addLayer(image,ndviVis,'NDVI_'+String(i));
}
下面分别为填补前后的结果:
原始影像:

去云后计算的NDVI:

填补后的NDVI:

小结:
这只是一种比较简单的填补方法,由于文中所选取的月份云量较大,所以填补内容较多,效果还是可以的。在实际中可以结合sentinel 数据计算NDVI来替换Landsat中云量较大的时间段。在之前也见过一种方法,是通过计算哨兵数据两个月份(比如1月和2月)之间NDVI值的比例,如果现在需要使用Landsat计算2月的NDVI,就将这个比例乘以1月的Landsat计算的NDVI,从而得到2月的NDVI值,这也是一种替换方法。大家实际计算时可以自行选择。
边栏推荐
- 屏:全贴合工艺之GFF、OGS、Oncell、Incell
- Keras deep learning practice - traffic sign recognition
- Fuzzy query in Map pass-by-value and object pass-by-value
- 1个小时!从零制作一个! AI图片识别WEB应用!
- 生命周期和作用域
- MLX90640 红外热成像仪测温模块开发笔记(完整篇)
- Library website construction source code sharing
- 百度无人驾驶商业化已“上路”
- Redis启动时提示Creating Server TCP listening socket *:6379: bind: No error
- Multi-Party Threshold Private Set Intersection with Sublinear Communication-2021:解读
猜你喜欢
![[Neural Network] This article will take you to easily analyze the neural network (with an example of spoofing your girlfriend)](/img/2c/18ce72dfd0889d901ea0d95721ed19.png)
[Neural Network] This article will take you to easily analyze the neural network (with an example of spoofing your girlfriend)

The life cycle and scope

Win11校园网无法连接怎么办?Win11连接不到校园网的解决方法

A simple Flask PIN

升哲科技携全域数字化方案亮相2022全球数字经济大会

网站建设流程

MySQL中超键、主键及候选键的区别是什么

安装win32gui失败,解决问题

即时通讯开发移动端弱网络优化方法总结

No need to crack, install Visual Studio 2013 Community Edition on the official website
随机推荐
mysql函数的作用有哪些
How many steps does it take to convert an ENS domain name into music?
Keras深度学习实战——交通标志识别
odoo+物联网
如何记录分析你的炼丹流程—可视化神器Wandb使用笔记【1】
通配符 SSL/TLS 证书
硬件大熊原创合集(2022/07更新)
log factory (detail)
短视频软件开发,Android开发,使用Kotlin实现WebView
vtk体绘制代码报错的解决办法(代码在vtk7,8,9中都能运行),以及VTK数据集网站
Screen: GFF, OGS, Oncell, Incell of full lamination process
【服务器数据恢复】服务器Raid5阵列mdisk组中多块磁盘离线的数据恢复案例
Multi-Party Threshold Private Set Intersection with Sublinear Communication-2021:解读
Win11如何删除升级包?Win11删除升级包的方法
1065 A+B and C (64bit)
Choosing the right DevOps tool starts with understanding DevOps
使用常见问题解答软件的好处有哪些?
选择合适的 DevOps 工具,从理解 DevOps 开始
XML配置
【Redis】缓存雪崩、缓存穿透、缓存预热、缓存更新、缓存击穿、缓存降级