[R-sig-Geo] Working with GRIB2 files

Roger Bivand Roger.Bivand at nhh.no
Mon Oct 3 10:42:29 CEST 2011


On Mon, 3 Oct 2011, Paul Hiemstra wrote:

> Hi,
>
> GRIB2 is mentioned on the GDAL website as one of the supported file
> types. This is the WMO GRIB2 type, not really sure if that is what your
> files are. You'll probably need to rebuild GDAL to get this support, but
> check it out. In addition, I think the route from GRIB2 to NetCDF to R
> is also ok in my view. Especially when you convert all the data to
> NetCDF once and than do your additional analyses. There are also tools
> to work with grib2 files, googling for wgrib2 will get you a lot of
> information.

With reference to the GDAL driver, please also note:

http://grass.osgeo.org/wiki/GRIB#GDAL_bug_workaround

for correct positioning. Going via NetCDF may avoid this - check with 
wgrib2 for safety's sake.

Roger

>
> good luck,
> Paul
>
> On 09/30/2011 05:21 PM, Matthew Landis wrote:
>> Ezra,
>>
>> I've been messing around with GRIB2 myself, but as of July,  I hadn't
>> had any luck finding ways to do it in R.  I ended up using NCL (NCAR
>> command language) to convert the Grib2's to NetCDF, which various R
>> packages can handle (notably raster).  I did figure out how to pass
>> arguments from R to the NCL script (through Bash), which was a major
>> achievement for me.   This only works on Linux though, as I haven't
>> worked it out for the Cygwin version of NCL.
>>
>> I would *love* to hear about ways of dealing with GRIB2 natively in
>> R.  Barring that, I'm happy to share NCL code.
>>
>> Matt
>>
>> On 9/30/2011 12:41 PM, Ezra Boyd wrote:
>>> Hello,
>>>
>>> I am trying to use the Real Time Ocean Forecasting System
>>> (http://polar.ncep.noaa.gov/ofs/download.shtml?) archival data which
>>> is in the GRIB2 format using a hybrid model-based coordinate system.
>>> The data can be downloaded from here:
>>> http://data.nodc.noaa.gov/opendap/ncep/rtofs/contents.html
>>>
>>> Has anyone had any experience using GRIB2 in R?  If so, please let me
>>> know how it worked out.  In particular, I need to get forecast data
>>> into a format where I can overlay a shapefile, but the wqgrib2 program
>>> won't work because hybrid coordinate system.
>>>
>>> Thanks,
>>> Ezra
>>
>
>
>

-- 
Roger Bivand
Department of Economics, NHH Norwegian School of Economics,
Helleveien 30, N-5045 Bergen, Norway.
voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: Roger.Bivand at nhh.no



More information about the R-sig-Geo mailing list