javascript - 谷歌地球引擎 - 在 imagecollection 中填充图像间隙
问题描述
我需要将 MODIS Terra 和 Aqua 集合合并到一个新集合中,以便每天获得最大 NDSI 值。
问题是,多年来,数据集存在一些差距,并且连接函数仅保留两个数据集上的常见图像。
例如,在 2003 年,Terra 数据集有 358 张图像,而 Aqua 数据集有 365 张,合并后的数据集只有 358 张图像。
我希望组合功能在 Terra 不可用时保留 Aqua 图像值,以便最终获得 365 图像。
有什么建议吗?谢谢!
这是代码的 GEE 链接 https://code.earthengine.google.com/b71873bff48fe5f3de883763f25c4938
这是代码
var MOD = ee.ImageCollection("MODIS/006/MOD10A1")
var MYD = ee.ImageCollection("MODIS/006/MYD10A1")
var ROI = geometry
// MONITORING DATE
var currdate = ee.Date.fromYMD(2004,1,1)
var firstdate = ee.Date.fromYMD(2003,1,1)
Map.centerObject(ROI,5);
var clip = function(img) {return img.clip(ROI);}
var MOD = MOD.filterDate(firstdate, currdate)
.map(clip)
var MYD = MYD.filterDate(firstdate, currdate)
.map(clip)
print(MOD,'MOD')
print(MYD,'MYD')
// Combine collections (MOD & MYD)
var Filter = ee.Filter.equals({
leftField: 'system:time_start',
rightField: 'system:time_start'
});
var simpleJoin = ee.Join.inner();
var innerJoin = ee.ImageCollection(simpleJoin.apply(MOD, MYD, Filter))
var comb = innerJoin.map(function(feature) {
return ee.Image.cat(feature.get('primary'), feature.get('secondary'));
})
print(comb,'comb');
// calculate maximum value from the two MODIS images
var max = function(img) {
var br = img.select('NDSI_Snow_Cover').max(img.select('NDSI_Snow_Cover_1'))
return br.rename('NDSI')
.copyProperties(img, ['system:time_start', 'system:time_end']);
}
var NDSImax = comb.map(max)
print(NDSImax,'NDSImax')
// Map.addLayer(NDSImax.first().clip(ROI).select('NDSI'),{min: -9,max: 100,palette: ['red', 'white', 'blue']}, 'NDSImax')
解决方案
推荐阅读
- ansible - Ansible:如何过滤 dict2items 并仅为匹配的值运行 playbook
- java - 测试扩展抽象类和接口的 Spring Service 类
- python - 比较两个 Python 字典:CS50 PSET6 DNA
- docker-swarm - Docker Swarm Secrets + Portainer
- r - 将带有自己数据框的 geom_bar 添加到现有的 ggplot2
- java - Wildfly 数据源通过 VPN 到 MS SQL Server
- csv - 如何在groovy中比较2个CSV文件只有前6个标志
- python - 微分熵是用 scipy.stats 中的integrate.quad 计算的?
- python - 如何在 Django 中使用字典字段?
- java - 无法解析intellij想法中的弹簧注释