Re: [ldm-users] cnvgrib Utility Help

For me, since I just need a simple conversion to use the data in other
code, the pygrib2 option may be the best.  I use Python a lot and was not
aware that it had this capability!  Because I was directed to the cnvgrib
utility, I thought that was the only option to achieve what I wanted.  I
will have to look into pygrib2 further and have my advisor install it on my
machine.
On Apr 20, 2016 11:11 AM, "George Trojan - NOAA Federal" <
george.trojan@xxxxxxxx> wrote:

> Well, it depends what you want to do.
>
> If you just need the data, an option is to split the grib2 file into
> separate messages, then run cnvgrib on each message. Split can be done with
> wgrib2, or you can write a simple program to do it: each message starts
> with the string 'GRIB' and ends with '7777'.
>
> There are other utilities to convert grib2 to grib1 format: Python package
> pygrib2 available at  https://pypi.python.org/pypi/pygrib2 contains
> utility cnvgrib2to1 that would work for you.
>
> If you want to track the cause of cnvgrib2 failure, try to run it via gdb.
> The debugger will catch program crashes. I tested cnvgrib on a corrupted
> files, it completes without an error message or simply prints some codes
> without any indication of an error. You could try different grib2 file (be
> sure it contains more than one message), though I doubt the result will be
> different. The files on NOMADS site are fine.
>
> George
>
> On Wed, Apr 20, 2016 at 4:30 AM, Michelle Serino <mmserino@xxxxxxxx>
> wrote:
>
>> I downloaded the newest cnvgrib (1.4.1) and its libraries from
>> http://www.nco.ncep.noaa.gov/pmb/codes/GRIB2/, and it was compiled on
>> the same operating system for which I sent you the info, CentOS 6.7.  Does
>> what crash?  When I run cnvgrib to convert the file, it seems to run just
>> fine, and I do not get any error messages.  Would modifying either of the
>> libraries be helpful in fixing this?
>>
>> I will have to talk with my advisor to determine if we really want to use
>> these .grb2 files and take the next steps for that.
>>
>> Michelle M. Serino
>> M.S. Candidate
>> Texas A&M University
>> Atmospheric Sciences Dept.
>> Eller O&M, Suite 1017
>> College Station, TX 77843
>> (484) 769-0949
>>
>> On Tue, Apr 19, 2016 at 11:18 PM, George Trojan <george.trojan@xxxxxxxx>
>> wrote:
>>
>>> And where cnvgrib comes from? Was it compiled on this or same system? Is
>>> it the newest version, i.e. 1.4.1? Does it crash after completing the first
>>> message in the file?
>>>
>>> My only suggestion is to build your own executable.This is not a trivial
>>> task, the makefiles in the source retrieved from NCEP site would need to be
>>> updated. There are dependencies on w3lib and g2lib, those libraries would
>>> have to be build first. I do know that version 1.4.1 does run on Centos6.
>>>
>>> Let me know you want to go this route, I might be able to dig out
>>> makefiles I used to compile it.
>>>
>>> George
>>>
>>>
>>> On 20/04/16 12:55 AM, Michelle Serino wrote:
>>>
>>> That's good.  Here's the info for my computer:
>>>
>>> CentOS release 6.7 (Final)
>>>
>>>
>>> LSB_VERSION=base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch
>>>
>>> CentOS release 6.7 (Final)
>>>
>>> CentOS release 6.7 (Final)
>>>
>>> Michelle M. Serino
>>> M.S. Candidate
>>> Texas A&M University
>>> Atmospheric Sciences Dept.
>>> Eller O&M, Suite 1017
>>> College Station, TX 77843
>>> (484) 769-0949
>>>
>>> On Tue, Apr 19, 2016 at 8:41 PM, George Trojan <george.trojan@xxxxxxxx>
>>> wrote:
>>>
>>>> So grib2 file looks OK. Something wrong with cnvgrib. As I said before,
>>>> I have had problems with cnvgrib in the past. If I recall correctly it had
>>>> to do with default integer sizes 4 vs 8 bytes.  What version of operating
>>>> system are you using?
>>>>
>>>> On 20/04/16 12:11 AM, Michelle Serino wrote:
>>>>
>>>> Sorry about that.  On the .grb2 file, I get: 492053148 21637412
>>>> ruc2anl_130_20090605_2200_000.grb2.
>>>>
>>>> Thanks, too, for the cksum info.
>>>>
>>>> Michelle M. Serino
>>>> M.S. Candidate
>>>> Texas A&M University
>>>> Atmospheric Sciences Dept.
>>>> Eller O&M, Suite 1017
>>>> College Station, TX 77843
>>>> (484) 769-0949
>>>>
>>>> On Tue, Apr 19, 2016 at 7:10 PM, George Trojan - NOAA Federal <
>>>> george.trojan@xxxxxxxx> wrote:
>>>>
>>>>> By the way, I asked for checksum on the GRIB2 file. We know the
>>>>> converted one is too short.
>>>>>
>>>>> On Tue, Apr 19, 2016 at 11:07 PM, George Trojan - NOAA Federal <
>>>>> <george.trojan@xxxxxxxx>george.trojan@xxxxxxxx> wrote:
>>>>>
>>>>>> Checksum value and file size. Google should be your friend:
>>>>>> https://en.wikipedia.org/wiki/Cksum
>>>>>>
>>>>>> I did have in the past issues with cnvgrib built on Centos 6 and
>>>>>> recent Fedora's. Before going into this, let's eliminate simple causes.
>>>>>>
>>>>>> On Tue, Apr 19, 2016 at 10:53 PM, Michelle Serino <
>>>>>> <mmserino@xxxxxxxx>mmserino@xxxxxxxx> wrote:
>>>>>>
>>>>>>> I get:
>>>>>>>
>>>>>>> 942363691 228074 ruc2anl_130_20090605_2200_000.grb.
>>>>>>>
>>>>>>>
>>>>>>> What do those numbers represent?  I am not familiar with the cksum
>>>>>>> command.
>>>>>>>
>>>>>>> Michelle M. Serino
>>>>>>> M.S. Candidate
>>>>>>> Texas A&M University
>>>>>>> Atmospheric Sciences Dept.
>>>>>>> Eller O&M, Suite 1017
>>>>>>> College Station, TX 77843
>>>>>>> (484) 769-0949 <%28484%29%20769-0949>
>>>>>>>
>>>>>>> On Tue, Apr 19, 2016 at 6:49 PM, George Trojan - NOAA Federal <
>>>>>>> <george.trojan@xxxxxxxx>george.trojan@xxxxxxxx> wrote:
>>>>>>>
>>>>>>>> Either the input file is corrupted, or your version of cnvgrib is
>>>>>>>> bad. Try this to eliminate the first possibility:
>>>>>>>>
>>>>>>>> $ cksum ruc2anl_130_20090605_2200_000.grb2
>>>>>>>> 492053148 21637412 ruc2anl_130_20090605_2200_000.grb2
>>>>>>>>
>>>>>>>> The numbers 492053148 21637412 should be the same.
>>>>>>>>
>>>>>>>>
>>>>>>>> On Tue, Apr 19, 2016 at 10:42 PM, Michelle Serino <
>>>>>>>> <mmserino@xxxxxxxx>mmserino@xxxxxxxx> wrote:
>>>>>>>>
>>>>>>>>> When I do 'wgrib ruc2anl_130_20090605_2200_000.grb,' I get, 
>>>>>>>>> '1:0:d=09060522:HGT:kpds5=7:kpds6=100:kpds7=1000:TR=1:P1=0:P2=0:TimeU=1:1000
>>>>>>>>> mb:anl:NAve=0,' and that is the only output.  I am not sure
>>>>>>>>> exactly how to read that output and if that indicates that there is 
>>>>>>>>> only
>>>>>>>>> one field.
>>>>>>>>>
>>>>>>>>> I got the length of the .grb file as only 228074 bytes: -rwxr-xr-x
>>>>>>>>> 1 mserino 30490 228074 Apr  7 17:39
>>>>>>>>> ruc2anl_130_20090605_2200_000.grb
>>>>>>>>>
>>>>>>>>> Michelle M. Serino
>>>>>>>>> M.S. Candidate
>>>>>>>>> Texas A&M University
>>>>>>>>> Atmospheric Sciences Dept.
>>>>>>>>> Eller O&M, Suite 1017
>>>>>>>>> College Station, TX 77843
>>>>>>>>> (484) 769-0949 <%28484%29%20769-0949>
>>>>>>>>>
>>>>>>>>> On Tue, Apr 19, 2016 at 6:00 PM, George Trojan - NOAA Federal <
>>>>>>>>> <george.trojan@xxxxxxxx>george.trojan@xxxxxxxx> wrote:
>>>>>>>>>
>>>>>>>>>> Does wgrib list only one field? I just ran convert on the same
>>>>>>>>>> file. There should be 317 data fields. What is the length of .grb 
>>>>>>>>>> file? I
>>>>>>>>>> got 65403248 bytes.
>>>>>>>>>>
>>>>>>>>>> George
>>>>>>>>>>
>>>>>>>>>> On Tue, Apr 19, 2016 at 9:31 PM, Michelle Serino <
>>>>>>>>>> <mmserino@xxxxxxxx>mmserino@xxxxxxxx> wrote:
>>>>>>>>>>
>>>>>>>>>>> Thank you everyone for getting back to me.
>>>>>>>>>>>
>>>>>>>>>>> My apologies for not including the location of my data.  I
>>>>>>>>>>> downloaded it from  <http://nomads.ncdc.noaa.gov/data/rucanl/>
>>>>>>>>>>> http://nomads.ncdc.noaa.gov/data/rucanl/ for the appropriate
>>>>>>>>>>> date and time.  Let me respond to everyone's suggestions.
>>>>>>>>>>>
>>>>>>>>>>> 1.  When I run:
>>>>>>>>>>>
>>>>>>>>>>> od -c ruc2anl_130_20090605_2200_000.grb | less
>>>>>>>>>>>
>>>>>>>>>>> I get output:
>>>>>>>>>>>
>>>>>>>>>>> 0000000 051107 041111 075003 000752 000000 001034 064407 100202
>>>>>>>>>>>
>>>>>>>>>>> 0000020 062007 164003 003011 013005 000400 000000 000001 000000
>>>>>>>>>>>
>>>>>>>>>>> 0000040 000025 000400 000000 000052 001777 141401 050401 037400
>>>>>>>>>>>
>>>>>>>>>>> 0000060 100631 135354 100410 014163 032000 000351 164464 040000,
>>>>>>>>>>> etc.
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> 2. When I run:
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> wgrib ruc2anl_130_20090605_2200_000.grb
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> I get output:
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> 1:0:d=09060522:HGT:kpds5=7:kpds6=100:kpds7=1000:TR=1:P1=0:P2=0:TimeU=1:1000
>>>>>>>>>>> mb:anl:NAve=0
>>>>>>>>>>>
>>>>>>>>>>> 3.  When I run:
>>>>>>>>>>>
>>>>>>>>>>> wgrib -v ruc2anl_130_20090605_2200_000.grb
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> I get similar output:
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> 1:0:D=2009060522:HGT:1000 mb:kpds=7,100,1000:anl:winds in grid
>>>>>>>>>>> direction:"Geopotential height [gpm]
>>>>>>>>>>>
>>>>>>>>>>> 4.  George, you mentioned that "It is possible that the program
>>>>>>>>>>> does not know about GRIB2 fields, specific to the office that 
>>>>>>>>>>> created the
>>>>>>>>>>> file."  By program, are you referring to the program I am using to 
>>>>>>>>>>> process
>>>>>>>>>>> these data?  Or are you referring to another program?  I am not 
>>>>>>>>>>> able to
>>>>>>>>>>> test the wgrib2 command at the moment because I do not have the 
>>>>>>>>>>> permissions
>>>>>>>>>>> to install it (my advisor will have to do that).
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> It appears that wgrib at least recognizes the *.grb file.  Are
>>>>>>>>>>> the lists of the grids as they should be?  Perhaps something small 
>>>>>>>>>>> is
>>>>>>>>>>> getting lost in the conversion process that my processing code 
>>>>>>>>>>> (using
>>>>>>>>>>> Warning Decision Support System - Integrated Information 
>>>>>>>>>>> algorithms) cannot
>>>>>>>>>>> reconcile?
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> Thank you for the continued help!
>>>>>>>>>>>
>>>>>>>>>>> Michelle
>>>>>>>>>>>
>>>>>>>>>>> Michelle M. Serino
>>>>>>>>>>> M.S. Candidate
>>>>>>>>>>> Texas A&M University
>>>>>>>>>>> Atmospheric Sciences Dept.
>>>>>>>>>>> Eller O&M, Suite 1017
>>>>>>>>>>> College Station, TX 77843
>>>>>>>>>>> (484) 769-0949 <%28484%29%20769-0949>
>>>>>>>>>>>
>>>>>>>>>>> On Mon, Apr 18, 2016 at 1:52 AM, Michael Dross <
>>>>>>>>>>> <mdross@xxxxxxxxxxxxxxxxxx>mdross@xxxxxxxxxxxxxxxxxx> wrote:
>>>>>>>>>>>
>>>>>>>>>>>> If you have wgrib installed do a
>>>>>>>>>>>>
>>>>>>>>>>>>  wgrib -v ruc2anl_130_20090605_2200_000.grb
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> If it converted it correctly you should get a listing of the
>>>>>>>>>>>> grids. If not,  something is amiss with the cnvgrib you have.
>>>>>>>>>>>>
>>>>>>>>>>>> - Mike
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> Sent from my iPad
>>>>>>>>>>>>
>>>>>>>>>>>> On Apr 17, 2016, at 9:11 PM, Michelle Serino <
>>>>>>>>>>>> <mmserino@xxxxxxxx>mmserino@xxxxxxxx> wrote:
>>>>>>>>>>>>
>>>>>>>>>>>> Hi all,
>>>>>>>>>>>>
>>>>>>>>>>>> I am using NCAR's cnvgrib utility to convert grib2 RUC-Analysis
>>>>>>>>>>>> data to grib1.  An example of one of these data files is below:
>>>>>>>>>>>>
>>>>>>>>>>>> ruc2anl_130_20090605_2200_000.grb2
>>>>>>>>>>>>
>>>>>>>>>>>> When I run the command,
>>>>>>>>>>>>
>>>>>>>>>>>> cnvgrib
>>>>>>>>>>>> -g21 ruc2anl_130_20090605_2200_000.grb2 
>>>>>>>>>>>> ruc2anl_130_20090605_2200_000.grb
>>>>>>>>>>>>
>>>>>>>>>>>> the converting process seems to work.  I get a file with an
>>>>>>>>>>>> extension of "grb."  However, while the file type is listed as a 
>>>>>>>>>>>> data file,
>>>>>>>>>>>> it appears green, as an executable file.  In addition, the code I 
>>>>>>>>>>>> am using
>>>>>>>>>>>> does not recognize the file as a grb1 file.  (The code only 
>>>>>>>>>>>> recognizes grb1
>>>>>>>>>>>> files.)  The website to which I referred to use this utility (
>>>>>>>>>>>> <http://blog.nssl.noaa.gov/wdssii/>
>>>>>>>>>>>> http://blog.nssl.noaa.gov/wdssii/) did not list any additional
>>>>>>>>>>>> options to use besides the required '-g21.'  Am I missing 
>>>>>>>>>>>> something?  This
>>>>>>>>>>>> is my first implementation of the cnvgrib utility, so I apologize 
>>>>>>>>>>>> if I have
>>>>>>>>>>>> made a naive mistake.  I appreciate any help.
>>>>>>>>>>>>
>>>>>>>>>>>> Best regards,
>>>>>>>>>>>>
>>>>>>>>>>>> Michelle Serino
>>>>>>>>>>>>
>>>>>>>>>>>> Michelle M. Serino
>>>>>>>>>>>> M.S. Candidate
>>>>>>>>>>>> Texas A&M University
>>>>>>>>>>>> Atmospheric Sciences Dept.
>>>>>>>>>>>> Eller O&M, Suite 1017
>>>>>>>>>>>> College Station, TX 77843
>>>>>>>>>>>> (484) 769-0949 <%28484%29%20769-0949>
>>>>>>>>>>>>
>>>>>>>>>>>> _______________________________________________
>>>>>>>>>>>> ldm-users mailing list
>>>>>>>>>>>> <ldm-users@xxxxxxxxxxxxxxxx>ldm-users@xxxxxxxxxxxxxxxx
>>>>>>>>>>>> For list information or to unsubscribe,  visit:
>>>>>>>>>>>> <http://www.unidata.ucar.edu/mailing_lists/>
>>>>>>>>>>>> http://www.unidata.ucar.edu/mailing_lists/
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>
>>>>>
>>>>
>>>>
>>>
>>>
>>
>
  • 2016 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the ldm-users archives: