0

I am trying to export a multiband image to my assets using this code:

var aoi= ee.Geometry.Rectangle([-1.2, 41.9, 2.8, 43.2]);
// filter 1 Jan to 30 Jan 
var c = ee.ImageCollection("MODIS/006/MOD10A1")
      .filterBounds(aoi)
      .select('NDSI_Snow_Cover')
      .filter(ee.Filter.calendarRange(1, 30, 'day_of_year')); 

// export collection to multiband image 
var stack = c.toBands().clip(aoi);
Export.image.toAsset(stack, 'stack', 'stack', null, null, null, 500);

The Task details window returns the error message: Error: Invalid band id '2001_01_01_NDSI_Snow_Cover' specified.

I have tried many things like renaming the bands, changing the data type, etc. without success. Another post reported a similar issue but I am not using the colon character here..

1

It seems like band names starting with a number is not a valid when exporting images as assets. Before exporting your image, you can rename the bands, prefixing them with a letter:

stack.regexpRename('^(.*)', 'b_$1')
1
  • Great! It works now. Thank you Daniel. – Simon Gascoin Mar 17 '20 at 12:41

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.