1

I'm struggling in finding a way to extract daily minimum temperatures for a particular month (at present for january) and a study area (an imported shapefile as chamoli), for a selected period of time (1990-2021(30 years)). For now, I have extracted the daily minimum temperature for the study area. I need to have one average value for each day of the study area as table.

`var era5_2mt = ee.ImageCollection('ECMWF/ERA5/DAILY')
               .select('minimum_2m_air_temperature')
               .filter(ee.Filter.calendarRange(1990,2021,'year'))
               .filter(ee.Filter.calendarRange(1,1,'month'));
               var study_area = era5_2mt.map
                (function(era5_2mt){
                  return era5_2mt.clip(table);
                });
              var vis2mt = {
              min: 250,
              max: 320,
              palette: [
                   '#000080', '#0000D9', '#4000FF', '#8000FF', 
                   '#0080FF', '#00FFFF', '#00FF80',
                   '#80FF00', '#DAFF00', '#FFFF00', '#FFF500', 
                   '#FFDA00', '#FFB000', '#FFA400',
                   '#FF4F00', '#FF2500', '#FF0A00', '#FF00FF'
                     ]
                     };
              Map.addLayer(study_area,vis2mt);

GEE code link

1 Answer 1

1

Geometry in your asset is not available so, I assumed one arbitrarily in USA. For 'minimum_2m_air_temperature' in Celsius degrees, following code works as expected.

var geometry = ee.Geometry.Polygon(
        [[[-106.62578125, 37.316033269641146],
          [-106.62578125, 35.97625743920629],
          [-104.780078125, 35.97625743920629],
          [-104.780078125, 37.316033269641146]]], null, false);

var era5_2mt = ee.ImageCollection('ECMWF/ERA5/DAILY')
                   .select('minimum_2m_air_temperature')
                   .filter(ee.Filter.calendarRange(1990,2010,'year'))
                   .filter(ee.Filter.calendarRange(1,1,'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(), geometry)
    .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(geometry);

print(image);

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

print(study_area);

var myFeatures = ee.FeatureCollection(study_area.map(function(el){
  el = ee.List(el); // cast every element of the list

  return ee.Feature(null, {
    'date': el.get(0),
    'temp_min': el.get(1),
  });
}));

print(myFeatures);

// Export features, specifying corresponding names.
Export.table.toDrive(myFeatures,
"CSV_Export", //my task
"GEE_Folder", //my export folder
"mean_temp_jan",  //file name
"CSV");
1
  • Thank you very much for your quick help. Nov 11, 2021 at 12: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.