[R] How to read a grib2 file

Michael Sumner mdsumner at gmail.com
Sat Sep 10 10:33:53 CEST 2016

On Sat, 10 Sep 2016 at 07:12 Debasish Pai Mazumder <pai1981 at gmail.com>

> Hi
> I am trying to read a grib2 file in R.
> Here is my script
> library(rgdal)
> library(sp)
> library(rNOMADS)
> gribfile<-"tmax.01.2011040100.daily.grb2"
> grib <- readGDAL(gribfile)
> I am getting following error :
> dec_jpeg2000: Unable to open JPEG2000 image within GRIB file.
> Is the JPEG2000 driver available?tmax.01.2011040100.daily.grb2 has GDAL
> driver GRIB
> and has 190 rows and 384 columns
> dec_jpeg2000: Unable to open JPEG2000 image within GRIB file.
> Is the JPEG2000 driver available?dec_jpeg2000: Unable to open JPEG2000
> image within GRIB file.
Hi there, please check if JPEG2000 is in the gdalDrivers() list, i.e.  in


You are looking for one starting with "JP2" as per the list next to the
"JPEG2000" rows here:


I have  JP2OpenJPEG on one system, but not (for example) on the Windows
CRAN binary for rgdal, which is the only readily available Windows build
for this package.

I you don't have it, you might try on a system that has the JP2OpenJPEG driver,
or ask someone to try on your behalf. You'd want to find out if that will
enable this read for you before investing time in the Linux configuration.

It's not too hard to set up a Linux system for this, but does assume a bit
of experience on your part. Some of the docker images in the rockerverse
have this all sorted I believe, but it's been a while since I used them.


Cheers, Mike.

> Cheers
> -Deb
>         [[alternative HTML version deleted]]
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
Dr. Michael Sumner
Software and Database Engineer
Australian Antarctic Division
203 Channel Highway
Kingston Tasmania 7050 Australia

	[[alternative HTML version deleted]]

More information about the R-help mailing list