[R] How to read a grib2 file

Michael Sumner mdsumner at gmail.com
Tue Sep 13 13:26:10 CEST 2016


What is your computer system? What is the output of this?

sessionInfo()

If you point to a file I'll try it so I can tell you the minimum system
requirements.

Cheers, Mike

On Tue, 13 Sep 2016, 08:56 Debasish Pai Mazumder <pai1981 at gmail.com> wrote:

> Thanks for your suggestion. I have checked and I don't have JPEG2000 in
> ggdalDrivers()). I am pretty new in R. I don't understand how to do I
> implement JPEG2000 (JP2OpenJPEG driver) in gdalDrivers() so that I can
> read grib2 files
>
> with regards
> -Deb
>
> On Sat, Sep 10, 2016 at 2:33 AM, Michael Sumner <mdsumner at gmail.com>
> wrote:
>
>>
>>
>> On Sat, 10 Sep 2016 at 07:12 Debasish Pai Mazumder <pai1981 at gmail.com>
>> wrote:
>>
>>> 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
>>
>> rgdal::gdalDrivers()$name
>>
>> You are looking for one starting with "JP2" as per the list next to the
>> "JPEG2000" rows here:
>>
>> http://gdal.org/formats_list.html
>>
>> 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.
>>
>> https://hub.docker.com/u/rocker/
>>
>> 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
>>
>>
> --
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