[ncl-talk] Write grib2 to netcdf
john koudelka
john.koudelka at gmail.com
Wed Oct 8 11:24:50 MDT 2014
I'll do my best to answer, Dennis, Alan, and Rick helped me through a
similar question several months back when I was first learning.
First, I get an error when trying to read your file, maybe it got corrupted
when I downloaded? Try the following and see if you get the error.
ncl 0> grib_in=addfile("aod.2014100400.grb","r")
getpdstemplate: PDS Template 4.48 not defined.
warning:Error unpacking GRIB record section 4.
fatal:Could not open (aod.2014100400.grb)
ncl 1>
Secondly,
reading a grib and writing to netcdf can be as simple as:
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
grib_in=addfile("myFile.grb","r")
var=grib_in->VARIABLE
ncdfOut=addfile("out.nc","c")
ncdfOut->VARIABLE_OUT=var
Where:
myfile.grb is your grib file
VARIABLE is the variable in the file you wish to output
out.nc is the name of the netcdf file you desire
VARIABLE_OUT is the name that you want to show up as the variable in the
netcdf file you're outputting.
john
On Wed, Oct 8, 2014 at 10:41 AM, Partha Bhattacharjee <pbhatta2 at jhu.edu>
wrote:
> Forgot to add information about my earlier question. I am using NCL
> 6.2.1.
>
>
> Partha
> ------------------------------
> *From:* ncl-talk-bounces at ucar.edu <ncl-talk-bounces at ucar.edu> on behalf
> of Partha Bhattacharjee <pbhatta2 at jhu.edu>
> *Sent:* Wednesday, October 8, 2014 11:39 AM
> *To:* ncl-talk at ucar.edu
> *Subject:* [ncl-talk] Write grib2 to netcdf
>
>
> I was using slightly modified form of an example in NCL page
> https://www.ncl.ucar.edu/Applications/gribeff.shtml to convert grib2 file
> to netcdf. However, ncl cannot read the time information from input grib2
> file and stops where "initial_time" is mentioned. Grib2 file and ncl code
> are attached. Any help is appreciated.
>
>
> Thanks.
>
> Partha
>
> _______________________________________________
> 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/20141008/8fa8e7b7/attachment.html
More information about the ncl-talk
mailing list