Skip to main content

Posts

Extracting reanalysis data from GRIB files

19 May 2017

GRIB is a compact binary data format, widely used for gridded climate and weather forecast data. There are two widely-used variants, GRIB1 and GRIB2. The Met Eireann MERA dataset uses the GRIB1 format. Meteorologists are very familiar with GRIB, but what is the best (i.e. easiest) way for an occasional user to extract data from GRIB files?

For example, I would like to examine MERA 10 m surface wind speeds at a particular location. A huge number of software tools for handling GRIB data is available. Most tools are native to Unix. Many are supplied as source code for the user to compile on their chosen platform. Some have been ported to Windows by others, but most of these Windows versions betray their unix origins via requirements for cygwin or additional libraries in order to run. I run Windows 99% of the time and I'd prefer not to have to compile source code, and I don't want to read huge user manuals, so what is the best option? Here are a few I ran through before settling on the final one in the list:

  • wgrib and wgrib2. Precompiled windows binaries available from http://wesley.wwb.noaa.gov/wgrib.html. I couldn't get wgrib to run from the command line in Windows 7, and received the error STATUS_ACCESS_VIOLATION when I tried to list the inventory of a sample GRIB file.
  • CDO, a collection of functions to manipulate climate data. Again, a simple command 'cdo info' resulted in an error ("numberOfPoints and gridSize differ"). There are a lot of commmand-line options for cdo so this can quite possibly be overcome, but it doesn't look straightforward.
  • Panoply, from NASA Goddard Institute for Space Studies. Panoply appears to be more of a viewing tool than a data extraction tool and supports multiple formats including GRIB. It requires the java runtime engine. This also produced an error when I tried to use it to open a GRIB-1 file.
  • OpenGRADS on Windows, using the cygwin library. I didn't have much success with this, but my installation is a few years old, and there is a new "Win32 superpack" available now, which promises to run completely in stand-alone mode.
  • There are also Matlab toolboxes (e.g. nctoolbox), which typically rely on libraries compiled as .MEX objects. As I don't really need to access GRIB data directly from Matlab, I discounted these.
  • Finally I settled back on using wgrib, this time running on a virtual machine (lubuntu) via Oracle VirtualBox. This worked straightaway and wgrib is very widely used so there is plenty of online documentation available.

Update 19/05/2017 After some problems with sharing files from Windows to my virtual lubuntu box, Lucia Hermida Gonzalez suggested trying Panoply on Windows again, and pointed out a critical setting -- disabling "strict mode" for GRIB-1 datasets. When this is done (accessed via the Panoply menu option Preferences>Files>Launch/Open), Panoply can open and visualise the data in Met Eireann's sample MERA GRIB files. I will show some very basic visualisations of the MERA surface wind fields in a subsequent post.

Electricity and Environment Laboratory

Renewable energy and land-atmosphere interactions research

Top