I have created an google earth engine image collection by combining multiband rasters (I previously had eleven rasters, one for each year of my analysis period, each with 365 bands). I first combined all the rasters, then turned them into an image collection This is the code I used to make the image collection (composite is my combined set of multiband rasters)

var bands_all = composite.bandNames()
var list_all = bands_all.map(function(n) { return composite.select([n]) })
var collection = ee.ImageCollection.fromImages(list_all)

Now I have one image collection with individual features for each day of the eleven years, with only one band for each feature, to match existing image collections such as gridMET heat data). I need to assign a date to each feature so I can filter by date, and the rasters I started with did not contain that data.

I used the following code to create a list of dates and assign it to the image collection:

var Date_Start = ee.Date('2008-01-01');
var Date_End = ee.Date('2018-12-31');
var Date_window = ee.Number(30);

var n_days = Date_End.difference(Date_Start,'day').round();
var dates = ee.List.sequence(0,n_days,1);
var make_datelist = function(n) {
  return Date_Start.advance(n,'day')
dates = dates.map(make_datelist);

var collection_2 = collection.set({
  date: dates

But, what I noticed is that the "date" is added as a main property for the entire collection in the form of a list, but I need it to be added to "properties" under each individual feature so I can ultimately filter by date and overlay with other similar image collections. How can I accomplish this in google earth engine?


1 Answer 1


Assuming that you have an image for every day of every year, including leap days, the index of each band would be the number of days since your start date.

var start_date = '2008-01-01'

var band_indexes = ee.List
  .sequence(0, composite.bandNames().size().subtract(1))
var list_all = band_indexes.map(function(i) {
  var date = ee.Date(start_date).advance(i, 'days')
  return composite
    .select([i], ['someBandName'])
    .set('system:time_start', date.millis())
var collection = ee.ImageCollection.fromImages(list_all)


In principle, you should try to avoid dealing with long lists of images and work with image collections instead. If you start running into problems your script, you might have to update the earlier parts of your processing. Perhaps you don't need to create the 365 band composites at all and instead build an image collection with the daily data directly, each image with the date set already at that point.

  • Thanks so much, this worked! The original 365 band composites are from existing netcdf files from an atmospheric model, so that was my starting point.
    – Rachel
    Commented Aug 22, 2023 at 3:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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