[ncl-talk] NETCDF to GRIB

Dennis Shea shea at ucar.edu
Fri Mar 3 15:10:01 MST 2017


[I wrote this few days ago but forgot to send it   :-( }
---
A few random comments:

[0] netCDF, HDF and GRIB are machine independent.

[1] netCDF and HDF are *file* formats. There are rules for creating these
files. Further, well constructed nc/hdf files are totally
'self-describing.' Further, the capability of including 'file attributes'
allows for considerable additional information to be included in each file.

[2] GRIB is a *record* format not a file format. eg: Each GRIB1 record
('message') corresponds to a single 'horizontal' two-dimensional level.
(eg: pressure level) at one instance in time. While sometimes called
'self-describing', users must consult an exterior table to find the
variable name and units associated with a particular 'parameter Id.'

[3] There are no rules for for how to collectively structure groups of grib
records. Since there are no rules ... anything goes!!!!  Random record
ordering is acceptable!

[4] GRIB variables are identified by 'parameter IDs'. Parameter IDs through
128 are standardized by the WMO. Parameters above 128 are left up to the
data centers.

===
Some comments by Dave Brown who is most knowledgeable on GRIB (actually,
*ALL* file formats)

"I'm sure there's more -- new types of data that require new
descriptive items that don't fit into the original scheme. That was
the motivation for GRIB2, but now there are attempts to backport these
concepts into GRIB1. Examples include more complex statistical
variables -- averages of averages, for example. Also types of data
that require new types of dimensions, such as particle size and
wavelength for atmospheric chemical constituents.

Anyway, it just takes a lot of monitoring and continuous development
to keep up with changes  --- not to mention that we have never
supported the full specification -- it would be very difficult without
having example files that use particular features.

Of course NCL sorts the records pretty well usually."

==============

Like, I said, GRIB is a moving target !!!

Cheers
D

On Fri, Feb 24, 2017 at 1:18 PM, HAVENER, KEVIN F GS-12 USAF ACC 14 WS/WXED
<kevin.havener at us.af.mil> wrote:

> Well, I may be wrong on this, too.  But couldn't you read in a netcdf with
> python-netcdf4 and write it back out with pygrib?  The complexity you
> mention is still there, but you might be able to make a reasonable grib
> file with pygrib.  Also CDO should be able to do the trick.  But either
> way, creating grib correctly files is a tricky business.
>
> Kevin Havener
>
> -----Original Message-----
> From: ncl-talk-bounces at ucar.edu [mailto:ncl-talk-bounces at ucar.edu] On
> Behalf Of Alan Brammer
> Sent: Friday, February 24, 2017 3:04 PM
> To: debasish mazumder <debasish at ucar.edu>
> Cc: ncl-talk at ucar.edu
> Subject: Re: [ncl-talk] NETCDF to GRIB
>
> Grib files are center specific so are not something that the average user
> can generate from scratch.  They rely on codes and underlying tables, hence
> the many emails regarding new variables in forecast files that NCL
> struggles to read until such tables are updated.
>
> Existing Grib files are fairly easy to manipulate yourself, using
> grib_tools from ecmwf among other options and you can concatenate the files
> together to make large single files. But you can’t, with any tool I
> believe, create a grib file a netcdf however due to the basic nature of the
> files.
>
> I may be wrong on this and maybe something is out there that can force a
> way around.
>
>
> > On 24 Feb 2017, at 12:25, debasish mazumder <debasish at ucar.edu> wrote:
> >
> > Hi All,
> >
> > Is there any way in NCL to convert netcdf (.nc) file to grib (.grb)
> > file or can I write a grib file in NCL
> >
> > with regards
> >
> > -Deb
> >
> > _______________________________________________
> > ncl-talk mailing list
> > ncl-talk at ucar.edu
> > List instructions, subscriber options, unsubscribe:
> > http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170303/38b6293c/attachment.html 


More information about the ncl-talk mailing list