[R-sig-Geo] Working with GRIB2 files

Paul Hiemstra paul.hiemstra at knmi.nl
Wed Oct 5 09:54:13 CEST 2011


Hi Ezra,

Please keep the mailing list included, in this way the answers are saved
for posterity :).

By rebuild I mean recompiling, building the gdal libraries and
executables from source. This is relatively straightforward under Linux,
and a little less under windows. I'm not sure if the precompiled version
from OSGeo4W supports GRIB out of the box. Just fire up R, load rgdal
and run the gdalDrivers() command to get a list of the drivers that your
version of gdal supports.

good luck,
Paul

On 10/04/2011 03:55 PM, Ezra Boyd wrote:
> Hi Paul,
>
> I'm a novice with programming, but determined to figure this out.
> What exactly do you mean by rebuild?  I use the OSGeo4W package to
> update gdal every few months, so I think I have the most recent
> version.
>
> Thanks,
> Ezra
>
>
>
> On Mon, Oct 3, 2011 at 3:21 AM, Paul Hiemstra <paul.hiemstra at knmi.nl> 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 you
>> 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.
>>
>> 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
>>
>> --
>> Paul Hiemstra, Ph.D.
>> Global Climate Division
>> Royal Netherlands Meteorological Institute (KNMI)
>> Wilhelminalaan 10 | 3732 GK | De Bilt | Kamer B 3.39
>> P.O. Box 201 | 3730 AE | De Bilt
>> tel: +31 30 2206 494
>>
>> http://intamap.geo.uu.nl/~paul
>> http://nl.linkedin.com/pub/paul-hiemstra/20/30b/770
>>
>>


-- 
Paul Hiemstra, Ph.D.
Global Climate Division
Royal Netherlands Meteorological Institute (KNMI)
Wilhelminalaan 10 | 3732 GK | De Bilt | Kamer B 3.39
P.O. Box 201 | 3730 AE | De Bilt
tel: +31 30 2206 494

http://intamap.geo.uu.nl/~paul
http://nl.linkedin.com/pub/paul-hiemstra/20/30b/770



More information about the R-sig-Geo mailing list