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

Re: Troubles in converting mrf grib file to netcdf with gribtonc



Hi Doug,

> Help!  
> 
> I have several mrf model grib files from the NMC (picked up from 
> nic.fb4.noaa.gov) which I can't seem to translate to netcdf.  I'm
> using gribtonc found in decoders-1.0.2 and recently installed on a Sun
> running Solaris 2.4.  I give gribtonc this command:
> 
> gribtonc -v mrf125.cdl 95061900f00_mrf.cdf < 95061900f00_mrf.grib
> 
> This results in a seemingly OK netcdf file (there were a few errors of this
> type printed on the console:  
> 
> gribtonc[1503]: GRIB product is much too short (0 bytes)
> 
> This netcdf file is filled with 'FloatInf' values instead of real numbers.
> 
> If anyone has any ideas, I would appreciate some help.

I suspect the problem is that the GRIB input you are trying to decode does
not have WMO product envelopes around it, which is the form gribtonc expects
for its input.  If the products just start with 'GRIB' and end with '7777',
with no WMO headers and no WMO end-of-product characters, gribtonc won't
find the end of the product correctly, because it requires some trailing
context after '7777' to know this is really the end of a product and not
just an occurrence of the bytes '7777' as part of the data.

gribtonc could look for 'GRIB' as trailing context to '7777' for identifying
the end of products without WMO product envelopes, but this could not be
done easily in a portable way, since the POSIX standard for ungetc() to push
back characters onto the standard input stream only provides a single
character of pushback.  With some work, we could implement more pushback on
the input to handle raw GRIB products, but currently gribtonc only handles
the GRIB data on the HRS datastream, which all comes in WMO product
envelopes.

A fairly simple workaround for this problem is to write a program that reads
the raw GRIB products and sticks a dummy WMO envelope around them, writing
the resulting output to stdout for gribtonc to read.  If you need more
details on what WMO envelopes look like, let me know and I'll send you an
example.

--Russ

______________________________________________________________________________

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