[R] How to read a grib2 file

Debasish Pai Mazumder pai1981 at gmail.com
Tue Sep 13 16:49:50 CEST 2016


Hi Mike,
Thanks again. I am using Mac OS

Here is the required info

> sessionInfo()
R version 3.2.4 (2016-03-10)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: OS X 10.11.6 (El Capitan)

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

other attached packages:
[1] rNOMADS_2.3.0 rvest_0.3.2   xml2_1.0.0    rgdal_1.1-10  raster_2.5-8
sp_1.2-3

loaded via a namespace (and not attached):
[1] httr_1.1.0      magrittr_1.5    R6_2.1.2        rsconnect_0.4.3
tools_3.2.4
[6] Rcpp_0.12.4     grid_3.2.4      lattice_0.20-33

I am trying to read " tmax.01.2011040100.daily.grb2" from
http://nomads.ncdc.noaa.gov/modeldata/cfsv2_forecast_ts_9mon/2011/201104/20110401/2011040100/

with regards
-Deb


On Tue, Sep 13, 2016 at 5:26 AM, Michael Sumner <mdsumner at gmail.com> wrote:

> 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