首页 > 解决方案 > 谷歌地球引擎 - 在 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')

标签: javascriptgoogle-earth-engine

解决方案


推荐阅读