问题描述
我想列出在GEE中用于镶嵌的图像列表。我知道镶嵌函数使用最后图像的像素(按时间顺序)。但是我非常需要这样做,所以我想减少一些时间。遵循代码示例:
(共享必要的输入)
var roi = ee.FeatureCollection('users/erlisantos/Poligono_buffer_BH_Riodoce').geometry();
var start = ee.Date("2018-01-01");
var finish = ee.Date("2018-02-02");
var sentinel1 = ee.ImageCollection('copERNICUS/S1_Grd_FLOAT')
.filter(ee.Filter.eq('instrumentMode','IW'))
.filter(ee.Filter.eq('orbitProperties_pass','DESCENDING'))
.filter(ee.Filter.eq('resolution_meters',10))
.filterBounds(roi)
.filterDate(start,finish);
print(sentinel1,"Selected images");
/** Mosaicking Sentinel-1 scenes by date */
// Difference in days between start and finish
var diff = finish.difference(start,'month');
//print(diff,"Difference of months");
// Make a list of all dates
var range = ee.List.sequence(0,diff.subtract(1)).map(function(day){return start.advance(day,'month')});
print(range,"List of all months");
// Funtion for iteraton over the range of dates
var day_mosaics = function(date,newlist) {
// Cast
date = ee.Date(date);
newlist = ee.List(newlist);
// Filter collection between date and the next day
var filtered = sentinel1.filterDate(date,date.advance(1,'month'));
// get date as YEARMONTHDAY. For example,for January 8th 2010
// would be: 20100108
var date_formatted = ee.Number.parse(date.format('YYYYMMdd'));
// Make the mosaic
var image = ee.Image(filtered.mosaic()).set('Mosaic',date_formatted);
// Add the mosaic to a list only if the collection has images
return ee.List(ee.Algorithms.If(filtered.size(),newlist.add(image),newlist));
};
// Iterate over the range to make a new list,and then cast the list to an imagecollection
var newcols1 = ee.ImageCollection(ee.List(range.iterate(day_mosaics,ee.List([]))));
//print(newcols1,"Collection with Sentinel-1 mosaic images");
/** VISUALIZING ON THE MAP THE AOI AND SCEnes PROCESSED: */
Map.centerObject(roi);
Map.addLayer(sentinel1,{},"S1 collection");
Map.addLayer(newcols1,"S1 mosaic");
谢谢
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)