2015-08-19

Setting up to work with GRIB2

We are still receiving requests for translation of data files from GRIB2 to GRIB1.  Archiving the same data in two different formats takes up disk space that could otherwise be used to provide other useful data.  That is why our policy is to offer data in its native format.


In a very few cases, where a broad community could benefit, we will archive translations.  E.g. NCEP ADP Upper Air data in ds351.0 is offered in both its native BUFR and translated to little_R format for ingest into WRF (the Weather Research Forecast model).

As explained in GRIB1, GRIB2, NetCDF: What do I use?, GRIB1 files are much larger (2x) than GRIB2 files. They use up more disk space AND network bandwidth.  Smaller files means we can serve more data to more users.  That's a good thing.

In the distant past, setting up to work with GRIB2 was complicated.  That is no longer the case as long as your machine is set up for common scientific computing tasks.

GRIB2 files are smaller than GRIB1 files due to file compression with JPEG2000.  This commonly requires installation of the JasPer library, an open-source implementation of JPEG2000.  The JasPer website is very straightforward and assumes users know precisely what they are doing.  It's understandable to get stuck and decide to put off JasPer installation to 'later'.

There is an easier way.

Install NCEP's wgrib2 utility--the Swiss army knife of tools for GRIB2!  The wgrib2 tar package includes all the libraries it needs, including JasPer.  'Make' wgrib2, and you also compile and install JasPer.

Follow the instructions found in Source Code and Compiling Hints section of the main wgrib2 website.  I am honored that my wgrib2 installation guide for OS X and Linux are included in that section.

Try installing JasPer the easy way and you'll be able to use it for GRADS g2clib and WRF ungrib.  If you do run WRF, you may want to read Guidance for WRF users for new NCEP GFS and FNL GRIB2 files.

Tradeoffs:

File compression and decompression take time and computational resources.  Some national centers continued to disseminate data in GRIB1 format for this reason.  However, data can be packed (compressed) in different ways.  A slightly less aggressive packing will result in a greatly reduced packing/unpacking time with only a slight increase in file size.  (See this discussion at gradsusr.org.)

Beginning January 14, 2015, NCEP switched to a less aggressive file compression, which results in a 10x reduction (from 30 seconds to 3 seconds) for unpacking a FNL file with wgrib2.  Sometimes, this is called GRIB2 version 2.  In the near future, more national centers, notably ECMWF, will be switching from GRIB1 to GRIB2 version 2.

It's time to set up your workflow to handle GRIB2 files.

2 comments:

  1. Hello Grace,

    Thank you for providing us with a wgrib2 installation tutorial.

    I am trying to set it up on my Mac. I followed your steps carefully and it turns out that I get a fortran error when I run the make command:

    makefile:362: *** ERROR, fortran compiler (enironment vararible FC) is not recognized. Stop.

    Would you have any suggestions for my problem?

    Best regards,

    Sebastien Boulnois.

    ReplyDelete
  2. Did you install gfortran per the instructions here?
    https://rda.ucar.edu/datasets/ds083.2/software/wgrib2_install+.txt

    ReplyDelete

This section is for people who want to discuss using our data holdings effectively. Moderators will delete irrelevant comments.