ECMWF model data comes in a hybrid GRIB format, that is, model level output is stored in GRIB2 messages, whereas surface data still uses GRIB1 format. Ungrib is unable to understand this hybrid GRIB format. Previous posts referred to ECMWF's grib-api which should be able to convert GRIB2 to GRIB1, but this doesn't seem to work since the 2013 update when 137 model levels were introduced. So my question is, how to get it working again?

  • $\begingroup$ I could not find geopotential in model levels. What is the solution? $\endgroup$ – user18844 Feb 4 at 12:58

I finally solved this problem with the following steps:

  • Download the ECMWF data separately for model level variables (Q,T,U,V and geopotential) and surface variables. In this way, you will get 'pure' GRIB1 and 'pure' GRIB2 files rather than the hybrid type.
  • Run ungrib twice: for the model levels files, use this Vtable. For the surface file, use the 'old' Vtable.ECMWF_sigma. Between the two ungrib runs, change the ungrib prefix in the namelist.wps (e.g. I used prefix = 'FILE_ML' and prefix = 'FILE_SFC').
  • Run util/calc_ecmwf_p.exe. This only works if the program can read both files. To achieve this, make sure that in the metgrid part of the namelist.wps, both input names are given (fg_name = 'FILE_ML','FILE_SFC','PRES',). Not sure whether 'PRES' makes a difference here, but since it will be used for metgrid I already put it there and it worked for me. 'PRES' are the files created by calc_ecmwf_p.exe. Note that you'll also need an 'ecmwf_coeffs' file for this step.
  • Run metgrid, real and wrf as usual.
| improve this answer | |
  • $\begingroup$ Advice from first hand experience: when you run ungrib.exe, don't run it serially. $\endgroup$ – BarocliniCplusplus Jan 20 '17 at 19:32
  • $\begingroup$ @BarocliniCplusplus What do you mean? ungrib is not a parallel program. $\endgroup$ – milancurcic Jan 20 '17 at 22:21
  • $\begingroup$ @Peter9192 Is the Vtable that you provide in the Gist available from WPS Vtables, or you modified it in any way? $\endgroup$ – milancurcic Jan 20 '17 at 22:31
  • $\begingroup$ @milancurcic I mean, when you compile WPS compile it serially (it does give you other options too) and when you run it, don't use mpirun or ibrun. $\endgroup$ – BarocliniCplusplus Jan 20 '17 at 22:58
  • $\begingroup$ @milancurcic I made that Vtable myself, using the GFS grib2 vtable as an example and taking the correct parameter codes from the ECMWF website. $\endgroup$ – Peter9192 Jan 21 '17 at 9:03

Not the answer you're looking for? Browse other questions tagged or ask your own question.