2

I want to extract average daily wind speeds over the Netherlands (NL below) at 1pm from the ERA 5 dataset on GEE.

I am trying to map over an image collection, and for some reason it is telling me that "u.pow is not a function". The formula is right (I tested it on a single image).

It's the calcwind variable that doesn't run as a result. If I understand correctly, this code should add a windspeed attribute to the dataset which I will then use to identify days with low wind speed.

I will compare this wind data to S5P NO2 data, which should contain u and v wind vectors (see Panoply screenshot below), but unfortunately this seems to be excluded in the GEE L3 NO2 dataset...

//Setup

var countries = ee.FeatureCollection("FAO/GAUL/2015/level0");
var NL = countries.filterMetadata('ADM0_NAME', 'equals', 'Netherlands');

var ERA5 = ee.ImageCollection("ECMWF/ERA5_LAND/HOURLY")
     .filter(ee.Filter.date('2020-07-01', '2020-07-02'))
     .filterMetadata('hour', 'equals', 13);

var ERA5NL=ERA5.map(function(im){ 
   return im.clip(NL)
})


// Wind calculation
var u = ERA5NL.select('u_component_of_wind_10m');
var v = ERA5NL.select('v_component_of_wind_10m');

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

var ERA5x = ERA5NL.map(calcwind);


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

Map.setCenter(5.5, 52, 7.5);
Map.addLayer(ERA5x.select('windspeed'), vis, "Wind speed (m/s) 10m above surface");

enter image description here

1
  • You can map it by using an image.expression. It is more understandable and intuitive. I also set a 'system:time_start' in produced image. Please, see my answer.
    – xunilk
    Commented Feb 10, 2021 at 18:03

1 Answer 1

2

You can map it by using an image.expression. Following code works as expected.

var countries = ee.FeatureCollection("FAO/GAUL/2015/level0");
var NL = countries.filterMetadata('ADM0_NAME', 'equals', 'Netherlands');

var ERA5 = ee.ImageCollection("ECMWF/ERA5_LAND/HOURLY")
     .filter(ee.Filter.date('2020-07-01', '2020-07-02'))
     .filterMetadata('hour', 'equals', 13);

var ERA5NL = ERA5.map(function(im){ 
   return im.clip(NL)
})

var ERA5x = ERA5NL.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(ERA5x);

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

Map.setCenter(5.5, 52, 7.5);
Map.addLayer(ERA5x.select('windspeed'), vis, "Wind speed (m/s) 10m above surface");

After running it in GEE code editor, I got result of following image without any error.:

enter image description here

4
  • Thanks! I don't understand why you need to define a time variable/ why the system:time_start is necessary?
    – Olivier
    Commented Feb 11, 2021 at 14:21
  • If you don't need to use this result for other calculations it cannot be necessary. So, forget it. Sometimes, you can get errors if your images do not have a system:time_start.
    – xunilk
    Commented Feb 11, 2021 at 15:26
  • Alright. Excuse the long comment: Does the windspeed calculation above automatically calculate it based on all pixels in the geometry NL? Also, I am now trying to map another function over the new ERA5x collection. I want to produce a list/ dictionary of the windspeed in ascending order, since 01-01-2018. However, this code seems not to work: var ERA5list = ERA5x.map(function(image){ var meandict = image.reduceRegion({ reducer: ee.Reducer.mean(), geometry: NL }) return meandict; });
    – Olivier
    Commented Feb 12, 2021 at 13:46
  • Please, post it as another question and we will see it.
    – xunilk
    Commented Feb 12, 2021 at 13:52

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.