1.**下载影像代码**
var mod16a2ET = ee.ImageCollection('MODIS/006/MOD16A2')
.filterBounds(table2)
.filterDate('2016-01-01', '2016-12-31')
.select('ET');
print('Collection: ', mod16a2ET);
// collection 中的个数
var numTS = 50;
// convert the collection to image list
var list = mod16a2ET.toList(numTS);
print(list);
// get the size of image list
// 这里只用list.size()是不对的,还要通过getInfo()获取相应的属性信息,如果没有getInfo(),虽然也能输出count,但是下面的循环不执行,不知道为啥。
var count = list.size().getInfo();
print(count)
// var i = 0
// loop to output all images
for(var i=0;i<count;i++)
{
// get the single image from list
var image = ee.Image(list.get(i));
print(i,image);
// get the id property as the part of filenames
var id=image.id();
print(id);
// out name
var name2="ET_"+id.getInfo();
print(name2)
Export.image.toDrive({
image: image, //
description: 'MOD16A2_ET_2016',
fileNamePrefix: name2,
scale: 500,
maxPixels: 999999999999,
crs:'EPSG:32648',
region: table2,
fileFormat: 'GeoTIFF',
formatOptions: {
cloudOptimized: true
}
});
}
2.**开启多个任务代码**
function runTaskList() {
var tasklist = document.getElementsByClassName('awaiting-user-config');
for (var i = 0; i < tasklist.length; i++)
tasklist[i].children[2].click();
}
function confirmAll() {
var ok = document.getElementsByClassName('goog-buttonset-default goog-buttonset-action');
for (var i = 0; i < ok.length; i++)
ok[i].click();
}
runTaskList();
confirmAll();