Re: GrIB to NetCDF

NOTE: The decoders mailing list is no longer active. The list archives are made available for historical reasons.

Dennis,

> > We have a decoder named gribtonc written in C that combines the data
> > from multiple related GRIB files into a single netCDF file, but I
> > suspect you already know about that ...

> Actually, no I am not aware of gribtonc.
> Can I get it? 
> 
> We currently use either the fortran interface
> or, more frequently, the NCL interface. Each works fine
> but I have been asked for something that can 
> be used as a "stand-alone operator"
> 
> Incidently;, to see how it is done in NCL see
>   (1)   http://www.cgd.ucar.edu/cas/ncl-csm/IO_grb2nc_3.html
>         This illustrates a very straightforward but inefficient
>         way to go from GrIB to netCDF
>   (2)   http://www.cgd.ucar.edu/cas/ncl-csm/IO_grb2nc_4.html
>         This illustrates how to efficiently go from
>         GrIB to netCDF. However, it does require that
>         the user to 'map' the file before hand.

These are interesting, and I wasn't aware of this documentation for how
to convert GRIB to netCDF using NCL.  Thanks for the information.

The gribtonc decoder uses the second approach, in which you must provide
either an existing netCDF file to write into or a CDL file that gives
the structure of the netCDF variables and their attributes.  If
necessary, gribtonc invokes ncgen to create the initial netCDF file from
the CDL file given as a command-line argument.

The gribtonc program is part of the Unidata decoders package, available
from 

   ftp://ftp.unidata.ucar.edu/pub/decoders/decoders-2.3.4.tar.Z

and described at

   http://www.unidata.ucar.edu/packages/decoders/index.html

Note that gribtonc is not a completely general GRIB decoder: it handles
GRIB products that appear on the NWS Family of Services data stream as
well as other similar GRIB files, but it doesn't handle GRIB products
that use "second-order packing" and requires that you follow its
conventions for how to stitch together and stack multiple GRIB products
into a single netCDF file.

It is some work to modify gribtonc to handle new kinds of levels and
parameters, but often most GRIB data can be decoded by just supplying
the necessary information in a CDL file.  The way you develop such a CDL
file is iterative:

  - run gribtonc with a draft CDL file and GRIB file and note the error
    messages
  - use "gribdump" to tell what is really in the GRIB file
  - add new parameter declarations, level dimensions, and layer
    dimensions to the CDL file as needed to get some of the error
    messages to go away
  - repeat

You may have to look at the source code for gribdump to add new levels,
layers, and parameters.  Especially note the gribtonc source files
levels.h, levels.c, params.h, and params.c.

We will continue to maintain gribtonc to handle the GRIB data we see in
the NWS FOS data stream, but we don't currently have the resources to
rewrite it to handle all possible GRIB data.

--Russ


  • 1998 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the decoders archives: