[ncl-talk] reading GRIB2 files

Adam Phillips asphilli at ucar.edu
Tue Sep 8 10:54:39 MDT 2015


Hi Matt,
A NCL software engineer will have to step in as I'm not sure what else to
suggest beyond upgrading to v6.3.0. It is strange that v6.2.1 here is fine
with the file but 6.1.2 on your machine is not.
Adam


On Tue, Sep 8, 2015 at 10:29 AM, Matt Flournoy <mflournoy37 at gmail.com>
wrote:

> Hi all,
>
> Adam, thank you for helping with this. First, I entered the setfileoption
> line that you sent, but that didn't fix the problem or change the warning
> that I get:
>
> "warning:getfilevarnames: rap_130_20150706_0000_000 contains no variables
> readable by NCL".
>
> Then, I redownloaded the data file and worked with that, but still do not
> get any variable names from the file. As before, when I read the file in
> the exact same way that you do, I only get a missing value for varnames.
>
> Do you, or anyone else, have any ideas about where to go from here?
>
> Thanks again,
> Matt
>
> On Fri, Sep 4, 2015 at 10:18 AM, Adam Phillips <asphilli at ucar.edu> wrote:
>
>> Hi Matt,
>> Thanks for sending your complete code along with a pointer to the file. I
>> was able to read your file into NCL v6.2.1 and v6.3.0 here, so I would
>> suggest making sure you downloaded the entire file and/or redownload the
>> file. Here's what I did:
>>
>> a = addfile("Downloads/rap_130_20150706_0000_000.grb2","r")
>> varnames = getfilevarnames(a)
>> print(varnames)
>>
>> Variable: varnames
>> Type: string
>> Total Size: 816 bytes
>>             102 values
>> Number of Dimensions: 1
>> Dimensions and sizes: [102]
>> Coordinates:
>> (0) TMP_P0_L1_GLC0
>> (1) TMP_P0_L7_GLC0
>> (2) TMP_P0_L100_GLC0
>> (3) TMP_P0_L103_GLC0
>> (4) TMP_P0_2L108_GLC0
>> (5) POT_P0_L7_GLC0
>> (6) POT_P0_L103_GLC0
>> (7) EPOT_P0_L1_GLC0
>> (8) DPT_P0_L103_GLC0
>> (9) DEPR_P0_L103_GLC0
>> (10) SPFH_P0_L103_GLC0
>> (11) RH_P0_L4_GLC0
>> .....
>>
>>
>> I searched the NCL website for "RUC" and got pointed to skewt example #6
>> here:
>> http://www.ncl.ucar.edu/Applications/skewt.shtml#ex6
>>
>> Looking at that code, they add a setfileoption:
>>
>> setfileoption("grb","SingleElementDimensions","Initial_time")
>>
>>
>> As you can see I did not need that setfileoption to open the file correctly, but perhaps for some reason your set up does?
>>
>> Hope that helps, if you continue to have trouble with the file let the ncl-talk email list know.
>>
>> Adam
>>
>>
>>
>>
>>
>>
>> On Fri, Sep 4, 2015 at 8:56 AM, Matt Flournoy <mflournoy37 at gmail.com>
>> wrote:
>>
>>> Hi all,
>>>
>>> Does anyone have experience reading RUC GRIB2 files? I'm trying to read
>>> GRIB2 output from 13km RUC model data, which is available on the NOMADS
>>> site (http://nomads.ncdc.noaa.gov/data.php#hires_weather_datasets).
>>> Specifically, I am trying to read files from 06 July 2015, but I suspect
>>> this problem is universal among at least all of the 13km RUC GRIB2 output
>>> files.
>>>
>>> I've tried a couple ways to read the GRIB2 data, including reading the
>>> GRIB2 file and also trying to convert the GRIB2 file to netcdf. When I try
>>> to read the GRIB2 data directly (specifically
>>> "rap_130_20150706_0000_000.grb2"), I get the following warning message:
>>>
>>> warning:getfilevarnames: rap_130_20150706_0000_000 contains no variables
>>> readable by NCL
>>>
>>> I've pasted my NCL script that yields this warning at the bottom of my
>>> message.
>>>
>>> Second, when I try to convert the GRIB2 file to netcdf using
>>> "ncl_convert2nc" in the command line, I get this similar warning:
>>>
>>> warning:getfilevarnames: rap_130_20150706_0000_000 contains no variables
>>> readable by NCL
>>> ./rap_130_20150706_0000_000.grb2 contains no variables readable by NCL:
>>> converting global attributes only
>>>
>>> Then, when I "ncl_filedump" the created netcdf file, I get this:
>>>
>>> Variable: f
>>> Type: file
>>> filename: rap_130_20150706_0000_000
>>> path: rap_130_20150706_0000_000.nc
>>>    file global attributes:
>>>       creation_date : Fri Sep  4 09:52:47 CDT 2015
>>>       NCL_Version : 6.2.1
>>>       system : Linux bigbang.protect.nssl 2.6.32-504.12.2.el6.x86_64 #1
>>> SMP Sun Feb 1 12:14:02 EST 2015 x86_64 x86_64 x86_64 GNU/Linux
>>>       Conventions : None
>>>       grib_source : rap_130_20150706_0000_000.grb2
>>>       title : NCL: convert-GRIB-to-netCDF
>>>    dimensions:
>>>    variables:
>>>
>>> Do you know how to address this issue? I am currently using NCL version
>>> 6.2.1 on bigbang, and this problem also appears in other NCL versions.
>>>
>>> Thank you,
>>> Matt
>>>
>>>
>>>
>>> ------------ begin NCL script ---------------
>>>
>>>
>>> ;******************************************************************************;
>>> ; Load libraries.
>>>
>>> ;******************************************************************************;
>>>
>>> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
>>> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
>>> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
>>> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"
>>>
>>>
>>> ;-----------------------------------------------------------------------------;
>>> ; Synoptic overview plots of the July 06 2015 case from the RUC.
>>>
>>> ;-----------------------------------------------------------------------------;
>>>
>>> begin
>>>
>>>   ruc_filepath =
>>> ("/home/matt.flournoy/PECAN/overview/data/RUC_data/rap_130_20150706_0000_000.grb2")
>>>   ruc_file     = addfile(ruc_filepath,"r")
>>>
>>>   varnames = getfilevarnames(ruc_file)
>>>
>>>   if(.not.any(ismissing(varnames))) then
>>>
>>>     do i=0,dimsizes(varnames)-1
>>>
>>>       printFileVarSummary(ruc_file,varnames(i))
>>>
>>>     end do
>>>
>>>   end if
>>>
>>> end
>>>
>>> --------------- end NCL script ----------------
>>>
>>> --
>>> Matthew Flournoy
>>> M.S. Meteorology Candidate, University of Oklahoma
>>> B.S. Meteorology, Penn State University
>>>
>>> _______________________________________________
>>> ncl-talk mailing list
>>> ncl-talk at ucar.edu
>>> List instructions, subscriber options, unsubscribe:
>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>
>>>
>>
>>
>> --
>> Adam Phillips
>> Associate Scientist,  Climate and Global Dynamics Laboratory, NCAR
>> www.cgd.ucar.edu/staff/asphilli/   303-497-1726
>>
>> <http://www.cgd.ucar.edu/staff/asphilli>
>>
>
>
>
> --
> Matthew Flournoy
> M.S. Meteorology Candidate, University of Oklahoma
> B.S. Meteorology, Penn State University
>



-- 
Adam Phillips
Associate Scientist,  Climate and Global Dynamics Laboratory, NCAR
www.cgd.ucar.edu/staff/asphilli/   303-497-1726

<http://www.cgd.ucar.edu/staff/asphilli>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20150908/4d25c4d2/attachment.html 


More information about the ncl-talk mailing list