Search code examples
rrgdal

Install JPEG2000 driver in R, rgdal


Major Edit: with the upcoming deprecation of rgdal and GDAL deprecating functionality with JPEG2000 this is no longer necessary. Further this work can be done with rNOMADS.

Good Afternoon;

I am currently working with .grib and .grib2 file formats as found here. I would like to analyse this data within R and through using the rgdal package I "should" be able to. When I run:

readGDAL("test.grib2")

I get the following error:

dec_jpeg2000: Unable to open JPEG2000 image within GRIB file.
Is the JPEG2000 driver available?test.grib2 has GDAL driver GRIB 
and has 751 rows and 1500 columns
Error in validityMethod(as(object, superClass)) : 
  Geographical CRS given to non-conformant data: 539.88 -90.12  90.12

This leads me to believe the JPEG200 driver is my issue, it does not appear within gdalDrivers() and I am curious if there is a way to manually install this driver.

Noted on the GDAL site the JPEG2000 driver depends on libjasper, and has downloads to source driver files. How do I incorporate those drivers into my rgdal package for use?

Cheers


Solution

  • This issue can be dealt with using rNOMADS and these instructions to install wgrib2. Together this allows for the use of GRIB files.