Re: convert grib to netcdf

From: David Brown <dbrown_at_nyahnyahspammersnyahnyah>
Date: Thu Nov 14 2013 - 15:37:06 MST

Hi Yonghui,
I looked at this file with wgrib, an NCEP tool for parsing GRIB files record by record, and it definitely agrees with NCL. Here is the verbose output for the first record in the file:

rec 1:0:date 2006070100 WIND kpds5=32 kpds6=1 kpds7=1 levels=(0,1) grid=104 sfc anl:
  WIND=Wind speed [m/s]
  timerange 0 P1 0 P2 0 TimeU 1 nx 157 ny 103 GDS grid 0 num_in_ave 0 missing 0
  center 7 subcenter 0 process 10 Table 0 scan: WE:NS winds(N/S)
  latlon: lat 58.900000 to 48.700000 by 0.100000 nxny 16171
          long -1.200000 to 14.400000 by 0.100000, (157 x 103) scan 0 mode 128 bdsgrid 1
  min/max data -999.9 10.18 num bits 17 BDS_Ref -99990 DecScale 2 BinScale 0

You can see that the top line says the grid is 104. It also says it is GDS grid 0 in the 3rd line. Pre-defined grid 104 is documented as
"16170-point (147x110) N. Hemisphere polar stereographic grid oriented 105W; pole at (75.5,109.5). (NGM Super C grid)". (picture:

But GDS grid 0 means a cylindrical equidistant lat/lon grid. It is 157 x 103 --- not 147 x 110. It looks like it covers Great Britain although I have not plotted it. I would say that unless something looks out of place or obviously wrong in some way, NCL is handling it as well as can be expected and there is some kind of error in the file (although it amounts to only 1 byte in each record).


On Nov 14, 2013, at 3:02 PM, wrote:

> Hi Dave,
> Thank you very much for your suggestion. As I mentioned that the files are
> a little too large so that
> I didn't upload it. But you can reach them under Yellowstone machine
> /glade/scratch/yonghuiw/WW3_314_RUNS_2006070100/gribfile_grid1_2006070100.grb
> Thanks again for your kind help.
> Yonghui
>> Hi Yonghui,
>> These are just warnings, so the output is probably okay. You definitely do
>> not need to worry about the message about string types. It merely means
>> that the string version of the time variable (which is not the actual
>> coordinate variable -- only a supplementary convenience variable that
>> helps make the time coordinate more decipherable for humans) must be
>> converted to a 2d character array variable in order to fit into a
>> supported NetCDF3 type. The other message suggests that there may be an
>> error in the original GRIB file -- it has contradictory information
>> concerning a grid that is specified using the pre-defined grid number 104
>> in the Grid Description Section (GDS). When this occurs, NCL lets the GDS
>> information prevail because it is more likely to be correct. If you still
>> have doubts about NCL's interpretation you can upload a sample file that
>> produces this message and we can check to see whether NCL's behavior is
>> correct in this instance.
>> -dave
>> On Nov 12, 2013, at 4:11 PM, wrote:
>>> Hi,
>>> I want to convert some data of grib to netcdf format so that I can use
>>> it
>>> for NCL plot. However, during the conversion. I got the following
>>> warning
>>> ncl_convert2nc gribfile_grid1_2006070100.grb
>>> Processing file: gribfile_grid1_2006070100.grb...
>>> Copyright (C) 1995-2013 - All Rights Reserved
>>> University Corporation for Atmospheric Research
>>> NCAR Command Language Version 6.1.2
>>> The use of this software is governed by a License Agreement.
>>> See for more details.
>>> warning:GribOpenFile: Grid Description Section not consistent with NCEP
>>> documention of grid 104; using GDS values for variables with this grid
>>> Classic model NetCDF does not support string types, converting
>>> initial_time0 to a character array
>>> Dimension 'ncl_strlen_0' will be added
>>> I use ncdump to view the variables of the converted netcdf file and it
>>> looks OK. However, I'm still
>>> wonder if the conversion is correct.
>>> Since the grib file is too large, I didn't upload it here.
>>> Best wishes,
>>> Yonghui
>>> _______________________________________________
>>> ncl-talk mailing list
>>> List instructions, subscriber options, unsubscribe:

ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
Received on Thu Nov 14 15:37:15 2013

This archive was generated by hypermail 2.1.8 : Fri Nov 22 2013 - 09:36:32 MST