1

The below code exports monthly data. However while it is saving in Google Drive, returns this error:

Error: Expected a homogeneous image collection, but an image with incompatible bands was encountered: First image type: 1 bands ([1993030100]). Current image type: 1 bands ([1993030200]). Image ID: null Some bands might require explicit casts.

code link: https://code.earthengine.google.com/a3062bac73d72ca444106081ff99ecca

var temporalCollection = function(collection, start, count, interval, units){
  
  var sequence = ee.List.sequence(0, ee.Number(count).subtract(1.0));
  var originDate = ee.Date(start);
  
  return ee.ImageCollection(sequence.map(function(i){
    
    var startDate = originDate.advance(ee.Number(interval).multiply(i), units);
    var endDate = originDate.advance(ee.Number(interval).multiply(ee.Number(i).add(1)), units);
    
    return collection.filterDate(startDate, endDate).mean().clip(table)
    .set('system:time_start', startDate.millis())
    .set('system:time_end', endDate.millis());
  }));
};

var sailinity = function(img){
  var nam = img.id();
  var bands = img.select(['salinity_0']).multiply(0.001).add(20.0).clip(table);
  return bands.rename(nam)
  .copyProperties(img,['system:time_start','system:time_end']);
};

var HYCOM = ee.ImageCollection("HYCOM/sea_temp_salinity")
.filterDate('1993-01-01','2003-01-01')
.filterBounds(table)
.map(sailinity);

print(HYCOM);


var HYCOM9303 = temporalCollection(HYCOM, '1993-01-01', 120, 1, 'month').toBands();


print('HYCOM9303',HYCOM9303);


Export.image.toDrive({
  image: HYCOM9303,
  description: 'HYCOM9303',
  scale: 10000,
  region: table,
  crs: HYCOM9303.getInfo().crs,
  maxPixels: 1e13
});

1 Answer 1

0

The error message you got complains that the bandname of image in image collection are not homogeneous. So I remove the band rename command in line 23, it successfully export your image to Drive. Here is the edited code: https://code.earthengine.google.com/8a8d3fe4fa98feb94c895707a01adc0e

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.