Introduction to GRIB2 using the GFS forecasts
2/2013 Wesley Ebisuzaki
GRIB2 (grib edition 2) is a standard format sponsored by the WMO (UN's World
Meteorological Organization) for the transmission of gridded data between the
national meteorological centers. In English, grib2 is a format for meteorological
and oceanographic forecasts and analyses that is is used by the big guys that make
the operational weather forecasts. If you want the model weather forecasts from a
government meterological agency, the changes are that it will be available in grib
format.
GRIB2 is a transmission format so compression is a high priority. Starting with a
GFS forecast file, converting it to netcdf-3 increases the file size by 6.4 times.
-rwxr-xr-x 1 wd51we wd5 58043511 2013-02-08 09:55 gfs.t06z.pgrb2f12 (grib2)
-rw-r--r-- 1 wd51we wd5 372295888 2013-02-08 10:06 gfs.t06z.pgrb2f12.nc
(netcdf3)
Grib2 is a transmission format but can be used by application programs and common
database functions can be accomplished by utilities/programs.
GRIB2 is defined endian independent and and computer word size independent.
However, 32-bit computer tend to limited to 2 GB files and grib2 software have been
written assuming a word size of at least 32 bits.
What is in a GRIB2 file?
An easy way to see the contents of a grib2 files is to run wgrib2 on it. Wgrib2 is
freely available for Windows, linux and Unix machines. Using a GFS forecast file,
bash-3.2$ wgrib2 gfs.t06z.pgrb2f12
1.1:0:d=2013020806:UGRD:planetary boundary layer:12 hour fcst:
1.2:0:d=2013020806:VGRD:planetary boundary layer:12 hour fcst:
2:232030:d=2013020806:VRATE:planetary boundary layer:12 hour fcst:
3:337239:d=2013020806:HGT:10 mb:12 hour fcst:
4:571416:d=2013020806:TMP:10 mb:12 hour fcst:
5:632506:d=2013020806:RH:10 mb:12 hour fcst:
6.1:647281:d=2013020806:UGRD:10 mb:12 hour fcst:
6.2:647281:d=2013020806:VGRD:10 mb:12 hour fcst:
...
312:56419187:d=2013020806:HGT:PV=-2e-06 (Km^2/kg/s) surface:12 hour fcst:
313:56671672:d=2013020806:PRES:PV=-2e-06 (Km^2/kg/s) surface:12 hour fcst: