1

I am trying to export hourly wind speed data from ERA5 hourly dataset via GEE. But when I am exporting the dataset it gives me daily average. I want a CSV file with dates, times in separate columns along with the wind speed value. I am trying to modify this code.

var ERA5 = ee.ImageCollection("ECMWF/ERA5_LAND/HOURLY")
     .filter(ee.Filter.date('2017-09-01', '2017-10-01'));
     
     
var ERA5DOM = ERA5.map(function(im){ 
   return im.clip(AOI);
});

//var u = ERA5DOM.select('u_component_of_wind_10m');
//var v = ERA5DOM.select('v_component_of_wind_10m');

//var calcwind = function(feature) {
//    return feature.set({windspeed:((u.pow(2)).add(v.pow(2)).sqrt()) })
//};

// Wind calculation

var ERA5windspeed = ERA5DOM.map(function(image){
  var wind_10m = image.expression(
    'sqrt(u**2 + v**2)', {
      'u': image.select('u_component_of_wind_10m'),
      'v': image.select('v_component_of_wind_10m')
  }).rename('windspeed');
  
  var time = image.get('system:time_start');
  return wind_10m.set('system:time_start', time) } );
  
print(ERA5windspeed);


Map.setCenter(-61.34, 15.4, 12);

var vis = {
  min: 0,
  max: 30,
  palette: [
    '#FFFFFF', '#FFFF71', '#DEFF00', '#9EFF00', '#77B038', '#007E55', '#005F51',
    '#004B51', '#013A7B', '#023AAD'
  ]
};

Map.addLayer(ERA5windspeed.select('windspeed'), vis, "Wind speed (m/s) 10m above surface");

//var Wind_chart = ui.Chart.image.series(ERA5windspeed, AOI, ee.Reducer.mean(), 1000, 'system:time_start')
//  .setOptions({
 //title: 'Wind speed Full Time Series',
 //vAxis: {title: 'm/s'},  });
//print(Wind_chart);

// Export the FeatureCollection to a csv file.
// Export.table.toDrive({
//   collection: ERA5windspeed.select('windspeed'),
//   description: 'DOM_mean_wind',
//   fileformat: 'csv',
//   selectors: ['date', 'windspeed', 'hour']
// });

                    

1 Answer 1

2

If your aim is just to get the csv you mentioned, you don't need to map ERA5DOM to an ImageCollection and to make a chart. Instead, it is adequate to get a FeatureCollection from the function as shown below.

var AOI = ee.Geometry.Polygon(
        [[[28.827, 41.076],
          [28.827, 40.891],
          [29.162, 40.891],
          [29.162, 41.076]]]);

var ERA5DOM = ERA5.map(function(im){return im.clip(AOI);});

// Wind calculation
var ERA5windspeedTable = ERA5DOM.map(function(image){
  var wind_10m = image.expression(
    'sqrt(u**2 + v**2)', {
      'u': image.select('u_component_of_wind_10m'),
      'v': image.select('v_component_of_wind_10m')
  }).rename("windspeed");
  
  // date of the image
  var date = ee.Date(image.get('system:time_start')).format('yyyy-MM-dd');
  // hour of the image
  var hour = ee.Date(image.get('system:time_start')).format('HH');
  
  // return a feature with date, hour, windspeed attributes
  return ee.Feature(null, {
    date: date,
    hour: hour,
    windspeed: wind_10m.reduceRegion(ee.Reducer.mean()).get('windspeed')
  })
});

// Check the results from Console  
print(ERA5windspeedTable);

// Export the FeatureCollection to a csv file.
Export.table.toDrive({
  collection: ERA5windspeedTable,
  description: 'DOM_mean_wind',
  fileFormat: 'csv',
  selectors: ['date', 'hour', 'windspeed']
});

Results for Istanbul:

date     hour   windspeed
2017-09-01  0   3.541915279
2017-09-01  1   3.503340651
2017-09-01  2   3.469190862
2017-09-01  3   3.365405375
........
1
  • While computing with the code, I am having an error showing: Image.reduceRegion: Provide 'geometry' parameter when aggregating over an unbounded image. Feb 4 at 12:24

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.