失败并出现此错误:
That failed with this error:
ImageCollection (Error)
ImageCollection.fromImages, argument 'images': Invalid type. Expected type: List<Image<unknown bands>>. Actual type: Image<[daymet_01_20150101_hourly_temp, daymet_01_20150101_rel_hum,
daymet_02_20150101_hourly_temp,
daymet_02_20150101_rel_hum,
daymet_03_20150101_hourly_temp,
daymet_03_20150101_rel_hum,
图像收集(错误)
ImageCollection.fromImages,参数“图像”:无效类型。预期类型:List<Image<unknown band>>。实际类型:Image<[daymet_01_20150101_hourly_temp, daymet_01_20150101_rel_hum,
daymet_02_20150101_hourly_temp,
daymet_02_20150101_rel_hum,
daymet_03_20150101_hourly_temp,
daymet_03_20150101_rel_hum,
原始代码:
var tmrh = ee.Image('users/japolo/temp_min_max/tmnr_15_q1'); var tmrh2 = ee.ImageCollection(tmrh); var tmrh2 = ee.List(tmrh); var tmrh3 = ee.ImageCollection(tmrh2); print( tmrh3);
这里的错误是不能直接使用ee.List()去遍历影像,而是用GEE中内置的
ee.ImageCollection.fromImages(images)
Returns the image collection containing the given images.
Arguments:
images (List):
The images to include in the collection.
Returns: ImageCollection
修改后的代码:
var image = ee.Image("users/japolo/temp_min_max/tmnr_15_q1"); var bands = image.bandNames(); print(bands); var imageBandsAsList = bands.map(function(b) { var imageBand = image.select(ee.String(b)); // 在这里,将属性 "system:time_start "与乐队的时间戳(以毫秒为单位)进行设置。 // ee.Date.millis()这里或许能用的上在设置影像时间上 return imageBand.copyProperties(image, ['system:time_start']); }); var ic = ee.ImageCollection.fromImages(imageBandsAsList); print(ic);
文章知识点与官方知识档案匹配,可进一步学习相关知识
Java技能树集合Collection集合遍历73032 人正在系统学习中