[ncl-talk] Fw: read grib data

guozfruit guozfruit at aliyun.com
Thu Jul 31 19:38:44 MDT 2014


Hi Dave,Many thanks for sharing the python script and the table. It's really cool that you solved the problem so fast. Best,
-Guo
------------------------------------------------------------------
From:David Brown <dbrown at ucar.edu>
Send time:Friday, August 1, 2014 04:29
To:guozfruit <guozfruit at aliyun.com>
Cc:NCL <ncl-talk at ucar.edu>
Subject:Re: [ncl-talk] Fw: read grib data

Hi Guo,I am pretty sure your problem is that you tried to use the gribtab_GLDAS2_NOAH.gtb as is. NCL uses a slightly different format for its text file GRIB tables than the wgrib-type format used for the file you sent me. Basically the difference is that NCL uses four colon-separated fields instead of 3. The units, which follow the descriptor field inside square brackets in your file, are the third field in an NCL grib table file.

I have converted your table file into an NCL-compliant file and am attaching it here. Also I am attaching a short Python script that does the conversion for anyone who might need it. Note it just writes to standard output so you need to redirect it to a file. Also you need to manually add the header line (the line that starts with -1). 
You can use either-1:-1:-1:-1
or more specifically for this file:-1:173 :4 :130


Run it like this:python wgrib2ncltxt.py GLDAS2_NOAH.gtb > ncl_GLDAS2_NOAH.gtb


That said, I will also be adding more validation into the NCL code, to prevent it from crashing when it gets an invalid grib table text file.



On Wed, Jul 30, 2014 at 8:48 PM, guozfruit <guozfruit at aliyun.com> wrote:

Thanks, Dave.When I set gribtable for GLDAS_v1 as the same way, it works. But when it comes to GLDAS_V2(they have different grib tables), error occurs. Maybe there is something wrong with the table?
-Guo

------------------------------------------------------------------
From:David Brown <dbrown at ucar.edu>

Send time:Thursday, July 31, 2014 09:11
To:guozfruit <guozfruit at aliyun.com>
Cc:NCL <ncl-talk at ucar.edu>

Subject:Re: [ncl-talk] Fw: read grib data

Hi Guo,
I am looking into this.  -dave


On Wed, Jul 30, 2014 at 5:36 PM, guozfruit <guozfruit at aliyun.com> wrote:






------------------------------------------------------------------
From:guozfruit <guozfruit at aliyun.com>
Send time:Thursday, July 31, 2014 07:14


To:NCL <ncl-talk at ucar.edu>
Subject: read grib data

Hi all,



Recently I've been processing GLDAS (Global Land Data Assimilation System Version 2 Products) grib data. After I set the parameter table, I have error message as below:


grib_in  = addfile("./GLDAS_NOAH025SUBP_3H.A2008001.2100.001.2008197115723.grb","r")Segmentation fault (core dumped)
I'm using NCAR Command Language Version 6.2.0, I'm not sure if there is something wrong with the ncl version. I also attached the parameter table. Could you please help me find out what the problem is. Thanks.


Best,
Guo 


_______________________________________________

ncl-talk mailing list

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/20140801/77a03e17/attachment.html 


More information about the ncl-talk mailing list