3

I am trying to download ERA-5 daily minimum temperature data of 10 years (2010-2020) for a particular month (at present for November) and a study area (an imported shapefile as WH). I have extracted the daily minimum temperature for the study area but couldn't download the images for each day.

var era5_2mt = ee.ImageCollection('ECMWF/ERA5/DAILY')
                   .select('minimum_2m_air_temperature')
                   .filter(ee.Filter.calendarRange(1990,2020,'year'))
                   .filter(ee.Filter.calendarRange(11,11,'month'));

var era5_2mt_list = era5_2mt.toList(era5_2mt.size());

print(era5_2mt_list);

var study_area = era5_2mt_list.map(function(img){
  
  var date = ee.Date(ee.Image(img).get('system:time_start')).format().slice(0, 10);
  img = ee.Image(img).subtract(273.15);
  
  // Reducing region and getting value
  var value_temp = ee.Image(img)
    .reduceRegion(ee.Reducer.mean(), table)
    .get('minimum_2m_air_temperature');
  
  return [date, value_temp];
  
});

var vis2mt = {
  min: -20,
  max: -10,
  palette: [
    '#000080', '#0000D9', '#4000FF', '#8000FF', '#0080FF', '#00FFFF', '#00FF80',
    '#80FF00', '#DAFF00', '#FFFF00', '#FFF500', '#FFDA00', '#FFB000', '#FFA400',
    '#FF4F00', '#FF2500', '#FF0A00', '#FF00FF'
  ]
};

var image = ee.Image(era5_2mt_list.get(0))
  .subtract(273.15)
  .clip(table);

print(image);

Map.centerObject(image);
Map.addLayer(image, vis2mt);

print(study_area);

I am getting a mean value for the entire area but I want to download each single daily data i.e.,900 elements which is listed in the task section in .tiff format.

the GEE link of my code is below:-GEE CODE

1 Answer 1

4

You can try converting the image collection to bands in a single image. I just tried the following code and it took around 10 minutes to export to Google Drive.

var era5_2mt = ee.ImageCollection('ECMWF/ERA5/DAILY')
                   .select('minimum_2m_air_temperature')
                   .filter(ee.Filter.calendarRange(1990,2020,'year'))
                   .filter(ee.Filter.calendarRange(11,11,'month'))
                   // clip to your study area
                   .map(function(image) {return image.clip(table)});


// if you actually need to subtract 273.15, you can map over the image collection, rather than a list of images
// uncomment the following block

// var study_area = era5_2mt.map(function(img){
//   var s_ts = img.get('system:time_start')    // get the 'system:time start' property from the image
//   img = ee.Image(img).subtract(273.15)
//                      .set({'system:time_start': s_ts});   // set the 'system:time_start' property from the output image
//   return(img);
  
// });


// flatten collection to a single image
var merged = era5_2mt.toBands();
// var merged = study_area.toBands();  // use this if you need the calculated images


// export image to Google Drive
Export.image.toDrive({
  image: merged,
  description: 'era5_2mt',
  scale: 20000,
  region: table
});

2
  • Thank you Sir. But, after running the above code, my GEE crashing. Commented Jan 11, 2022 at 9:27
  • 3
    See my updated code for a working alternative
    – Matt
    Commented Jan 11, 2022 at 11:14

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.