[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: 950418: netCDF-to-GRIB?



>Organization: Geophysical Fluid Dynamics Laboratory/NOAA.
>Keywords: 199504181600.AA15027

Hi John,

> I have been monitoring the netcdfgroup mail, but haven't yet seen any
> mention of a netCDF-to-GRIB conversion utility - are you aware of any?
> We have some die-hard GrADS users here that I want to get into netCDF,
> and I think it will be more palatable to them if they know they can
> get their netCDF data into a form that GrADS can read.  (GrADS own
> "format" is not general enough, but it can read GRIB, which should be
> able to accommodate any data representable in netCDF.)  I have heard
> that GrADS will support netCDF "in the future", but in the meantime
> a conversion utility would be fine.

I've heard of GRIB to netCDF programs (I'm even working on one), but this is
the first request I've encountered for netCDF to GRIB conversion.  I don't
think it would be practical to convert arbitrary netCDF data to GRIB for
several reasons:

 - GRIB supports only 2-dimensional gridded data, so a variable with more
   than 2 dimensions would have to be converted into multiple GRIB records;

 - GRIB can be used only for predefined variable-unit combinations, since
   there is no way to store a units attribute for a variable, and there is
   no way to store a variable that doesn't already have a parameter number
   assigned to it in the GRIB standard;

 - GRIB assumes special characteristics of meteorological model output data
   that are not true of other kinds of data, e.g. that every variable has a
   "center ID", a "grid ID", a "type of level", etc.;

 - there is no automatic way to determine how many bits of precision should
   be used in the compact GRIB representation of each variable unless the
   netCDF file has variable-specific attributes for just this purpose; and

 - there is no way to store variable names, dimension names, attribute
   names, or character strings in the GRIB format, since it's only designed
   for storing binary numbers.

Given all these limitations of GRIB, however, it might still be possible to
write a limited netCDF to GRIB conversion utility that worked for data
that could be stored in GRIB format, e.g. netCDF files that had previously
been generated from GRIB data.  A set of conventions for determining the
order of the GRIB records from the netCDF dimensions and variables would be
required, so you could preserve the information about how 2-D slabs fit
together into higher-dimensional netCDF variables.

I wouldn't want to write such a utility however, and I don't know of anyone
who has written one.

______________________________________________________________________________

Russ Rew                                           UCAR Unidata Program
address@hidden                              http://www.unidata.ucar.edu