当前位置:网站首页>Google Earth engine (GEE) -- an error caused by the imagecollection (error) traversing the image collection

Google Earth engine (GEE) -- an error caused by the imagecollection (error) traversing the image collection

2022-06-28 01:37:00 The star light blog in 2021 cloud computing top3

Failed with this error :

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,

Image collection ( error )

ImageCollection.fromImages, Parameters “ Images ”: Invalid type . Expected type :List<Image<unknown band>>. 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,

Original code :

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);

  The mistake here is that you can't directly use ee.List() To traverse the image , It's about using GEE The built-in

ee.ImageCollection.fromImages(images)

Returns the image collection containing the given images.

Arguments:

images (List):

The images to include in the collection.

Returns: ImageCollection

The modified code :

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));
  //  ad locum , Attribute  "system:time_start " With the band's timestamp ( In Milliseconds ) Set it up .
  // ee.Date.millis() This may be useful in setting the video time 
  return imageBand.copyProperties(image, ['system:time_start']);
});
var ic = ee.ImageCollection.fromImages(imageBandsAsList);
print(ic);

 

 

 

原网站

版权声明
本文为[The star light blog in 2021 cloud computing top3]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/178/202206271625584938.html