I have been confused by a strange phenomenon.
I use the code below to export a batch of images to Drive, but I cannot export successfully every time, sometimes here comes an Error message Cannot read property 'length' of undefined after almost 10 min awaiting, so I want to test on whether the list of imageCollection is empty or not, then I print the list out, then it works! But sometimes it still dosen't work, and I turn to comment all 'print', it works in some cases! Finally, I just try to export images to Drive with or without 'print'. It works randomly!
My Internet connection is available and I think 'print' may have no contribution to my code.
what happened?
export_imgCollection_raw2(L4578_delta, roi_boundingBox, stationName);
function export_imgCollection_raw2(imgCol, region, stationName){
var indexList = imgCol.reduceColumns(ee.Reducer.toList(), ["id_info"]).get("list");
// print('indexList',indexList)
indexList.evaluate(function(indexs) {
for (var i=0; i<indexs.length; i++) {
var image = ee.Image(imgCol.filter(ee.Filter.eq("id_info", indexs[i])).first());
var id ='delta_' + stationName + '_' + String(indexs[i]);
print(i);
Export.image.toDrive({
image: image,
folder: 'delta',
description: id,
fileNamePrefix: id,
region: region,
scale: 30,
crs: "EPSG:4326",
maxPixels: 1e13,
fileFormat: 'GeoTiff',
});
}
});
}