0

I would like to create a function so that my image description has the date im using to filter my image collection.

var BURNED = ee.ImageCollection("MODIS/061/MCD64A1")
                    .filter(ee.Filter.date('2019-08-01','2019-08-31'))

Export.image.toDrive({
  image: BURNED,
  description: 'BURN_2019-08-01_2019-08-31',
  maxPixels: 10e11,
  folder: 'Burned Areas'
});

1 Answer 1

0

You can use a variable for ee.Filter.date. You can also use string concatenation to make your description. You can put all that within a function and then call it with the dates you want. Putting it all together:

function export_date_range(date_start, date_end){
  var BURNED = ee.ImageCollection("MODIS/061/MCD64A1")
                      .filter(ee.Filter.date(date_start,date_end));
  Export.image.toDrive({
    image: BURNED,
    description: 'BURN_'+date_start+'_'+date_end,
    maxPixels: 10e11,
    folder: 'Burned Areas'
  });
}

export_date_range("2019-08-01","2019-08-31");
1
  • You can also use .filterDate(date_start,date_end) instead of .filter(ee.Filter.date()) Apr 6, 2023 at 8:50

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.