read_grib V1.4.0 (20 Sep 2005)

a WMO GRiB file reader for MATLAB

CONTACT:brian_blanton@unc.edu
LAST MODIFIED: 20 Sep 2005


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

READ_GRIB is now being used by numerous people at a wide variety of places. Alerts users at the following locations have found bugs that I've created, suggested improvements, and provided testing of READ_GRIB. Many thanks.

NOAA Universita di Genova e della Basilicata
Uni. of Miami Nanjing Institute of Meteorology, China
Uni. of Wisconsin
Space Science and Engineering
Universidad de Concepcion
Uni. of Virginia
ENVI-SCI
Universities of Innsbruck
Boeing Aircraft GKSS Forschungszentrum
Institute for Coastal Research
Colorado State University of Kiel
Leibniz Institute of Marine Sciences
C-CORE Consulting energy & meteo systems GmbH
Weather Services International (WSI), Inc. School of Environmental Sciences
University of East Anglia
M.I.T. RPS Kirk McClure Morton
University of Southampton, UK Maurice Lamontagne Institute Peches et Oceans Canada
University of Quebec School of Engineering
University of Edinburgh

READ_GRIB reads WMO international exchange GRiB formatted data files into MATLAB. It has various input modes, including extraction of individial GRiB records by record number, extraction by parameter name (which is not unique), and generating an inventory of the GRiB file contents. It has been tested on the following standard model output files: AVN, ETA, RUC, ECMWF, and WAM. The default GRiB parameter table used is the NCEP Operational table.

o Version 1.4.0 is a bug fix for Version 1.3.1 It repairs a memory leak in the code that unpacks the Binary Data Segment. This bug was hidden in V1.3.1 and prior under MATLAB R13 and less. But it became fatal in R14. The memory needed for BDS_unpack is now handled according to R14 requirements.

Version 1.3.1 was a bug fix a problem in handling the HeaderFlag varargin. Version 1.3 adds flexible user-defined parameter tables, with NCEP operational and reanalysis and ECMWF 128 and 160 tables built in. Varargins have been added to the READ_GRIB interface to simplify calls. The functionality is more complete than V1.2.

o Calls to READ_GRIB now look like:
  >> grib_struct=read_grib(gribname,irec,'HeaderFlag',0,'ParamTable','ECMWF128');

o DOWNLOAD the read_grib.m V1.4.0 tar file.

o INSTALLATION: The tar file contents untar into the directory read_grib1.4.0. The files can be left here and the path to read_grib be included in the startup.m file. It might be a good idea to make a soft link from read_grib1.4.0 to read_grib, and put the directory "read_grib" in the MATLABPATH.

o COMPILATION: The decoding of the binary sections of the GRiB records uses c-code written by Wesley Ebisuzaki . Click here for GRiB format documentation. There is now only 1 mex file, written in c, that needs to be compiled. Fire up MATLAB in the read_grib directory and type the following: >> mex BDS_unpack_mex5.c All should go well. This code is known to work on Linux, DEC-alpha, IBM, SGI, and MACs!!!. The code is standard, and should work on most other platforms. Binaries for MAC OS X and GLX are shipped with the distribution.

o TUTORIAL

The calling syntax for READ_GRIB is:

   grib_struct=read_grib(gribname,irec,p1,v1,p2,v2,...)
The first 2 arguments are required: READ_GRIB accepts the following property/value pairs: Additional help comments can be obtained by passing one argument to READ_GRIB.
Try: 'mainhelp','paramtableshort','paramtablelong','output_struct'.

READ_GRIB outputs a MATLAB structure containing the GRiB contents for the requested records. Call read_grib('output_struct') for a better description.

Examples: Assume the existence of a GRiB file that contains a few records from the NCEP operational ETA model. This file is called eta.grb.