Monthly Archives: December 2012

Running WRF with ECMWF data

My own notes on how to get WRF to work with ECMWF data.

First get the right data.

See previous blog posts on this. ERA-interim may be a good place to start. Generally, surface and 3D variables need to be fetched separately.  For 3D fields, there is a choice of working with model levels, or pressure levels.

According to the online tutorial, WRF requires a number of fields as input. I’ve added in the ECMWF grib codes from Table 128.

3D Data (e.g. data on pressure or model levels)

  • Temperature (130.128) 
  • U and V components of Wind (131.128, 132.128) 
  • Geopotential Height (129.128 is geopotential, 156.128 is height but not available in ERA-Interim) 
  • Relative Humidity (157.128 not available in ERA-Interim) (the code can calculate RH if Specific Humidity (133.128) is available; this is controlled in the Vtable)

2D Data

  • Surface Pressure (152.128 is log(p)) 
  • Mean Sea Level Pressure (151.128
  • Skin Temperature (235.128
  • 2-meter Temperature (167.128, 2m dewpoint 168.128
  • 2-meter Relative or Specific Humidity** 
  • 10-meter U and V components of wind (165.128, 166.128

If any masked field is ingested, then a LANDSEA (172.128) field is recommended

If the WRF model is going to be run with the Noah LSM model, then at least 2 levels of Soil Temperature (139,170,183,236.128) and Soil Moisture (39,40,41,42.128) are required.

SST (34.128) is needed if you plan on updating SST during the model run (often done for very long simulations).

Soil Height is recommended but not required. If Soil Height is supplied, then SOIL Temperatures and TSK can be adjusted to the WRF model terrain height.

Water equivalent snow depth (SNOW 141.128) is a nice field to have, but not required.

SEAICE (31.128) is good to have for a high latitude winter case, but it is not required.

** not available in ECMWF data, but derivable according to ECMWF:

To obtain humidity, take a look at the latest documentation of the IFS.Look at equations 7.4 and 7.5 (pages 91-92) in part IV , physical processes. Use the 2m dew point temperature and surface pressure to obtain specific humidity. The relative humidity is defined as:
RH=100*es(Td)/es(T)

Another way to see which variables are required, expected, or recommended is to look in theWPS/ungrib/VariableTables, For example, Vtable.ERA-interim.pl.

In the Vtable above, 1 indicates a surface level variable. 100 indicates pressure level variables, and 112 indicates soil levels.

Pitfalls
In the ERA interim dataset, surface pressure is not archived as a surface variable. Log of surface pressure is archived as a model level variable. However, you can’t grab this with the other model level variables, as it is only defined on the first level.  So, you need to do three requests:

  1. Model level 3D fields
  2. Surface variables
  3. Log of surface pressure AND gepotential

In theory, the easiest vertical coordinate to work with is pressure, so go ahead and get pressure-level variables. Many routes to ECMWF data require you to get the surface variables and the pressure-level variables separately. That’s fine, you can either run ungrib.exe twice, specifying a different output prefix e.g. (the FILE: bit) and list all of these in the fg_inputs section of the namelist. Alternatively, merge the separate files with: cdo merge f1.grib f2.grib f3.grib

Ungrib.exe reads a Vtable to map grib codes to a METGRID name. What is curious is there appear to be entries in the Vtable which are only distinguishable by the units, such as soil geopotential and soil height. The output from ungrib.exe are intermediate files, usually named FILE:2006-01-01 etc. These can be examined using util/rd_intermediate.exe. The first problem that I ran into is this:

INFORM: Going to create the field SOIL_LEVELS
INFORM: Going to create the field PRES
INFORM: PRES at level 200100.000000 already exists; leaving it alone.
WARNING: Field PRES has missing values at level 200100 at (i,j)=(1,20)
WARNING: Field PMSL has missing values at level 200100 at (i,j)=(1,20)
WARNING: Field PSFC has missing values at level 200100 at (i,j)=(1,20)

I’m not sure how to solve this. It’s probably that the ECMWF data is on pressure levels, and hence may have missing values where pressure levels intersect land. Level 200100 is the surface (who knows why?). What should happen is that the pressure levels fields should get replaced by their surface equivalents e.g. U gets replaced by U10 etc. I think this can be specified in METGRID.TBL, though the documentation is not very clear about how this is specified. A simple fix might be just to fill missing values with a default value, but bear in mind this might upset the vertical interpolation done by real.exe. The units of surface pressure are in Pa, therefore a sensible fill value might be As someone notes on the WRF forum, there is no standard ECMWF output content, so users have to know what’s in their file and modify the Vtable to match it. PSFC (134,1,0) is the preferred field. Some files only have PSFCH (134,109,1) which is PSFC at the lowest model level. Others only have LOGSFP (152,109,1). You may need to delete some lines from the Vtable.

Renegade Master

Back once again, pre-empting a New Year resolution to re-start my work blog.  Lots of interesting stuff happening, or about to happen, in terms of wind power forecasting for offshore wind farms.

All I will say at the moment is: we’re confident we can beat ECMWF at their own game. Watch this space. (nobody else is!).