Read_GRiB (“read_grib”) is a World Meteorological Organization (WMO) GRiB file reader.

To Download tar file, click here: read_grib. Website located: here.

Read_grib reads GRiB formatted data files into Matlab.

Installation

The downloaded tar file contents untars into the directory read_grib.r3.

Compilation

Compilation is relatively simple as there only one file needs compilation. Move into the read_grib directory as start Matlab. Type the following: » mex BDS_unpack_mex5.c

Tutorial

The syntax for read_grib is: grib_struct=read_grib(gribname,irec,p1,v1,p2,v2,…) where,

Examples

*To get an inventory of the grib, » grib_struct=read_grib('eta.grb','inv');

*To extract (decode) the first and third records in the grib, » grib_struct=read_grib('eta.grb',[1 3])

*The decoded records are in the .fltarray fields of the 1×2 grib_struct structure. The parameter names are in the .parameter fields of the grib_struct: » {grib_struct(1:2).parameter}

*The times of the parameters in the GRiB are in the .pds fields of the grib_struct: » grib_struct(1).pds

*To extract all records in the grib, » grib_struct=read_grib('eta.grb',-1);