Skip to content

How to open grib file in R?

1 message · Barry Rowlingson

#
On Mon, Jan 14, 2013 at 4:36 PM, Jonsson <amen.alyaari at bordeaux.inra.fr> wrote:

            
At a guess, and this is just a guess, I'd say the system tried to
give a Geographical CRS to non-conformant data...

 So, what's a Geographical CRS? One with latitude and longitude.
What's "non-conformant data"? Data that can't conform to latitude and
longitude. Why is -90.125 not conformable to latitude-longitude?
Because it's further south than the south pole.

 Why have you got data that goes further south than the south pole and
further north than the north pole? I don't know. I suspect you have
points at the poles and the software thinks these are grid cells that
are 0.250 lat-long degrees wide. Ask your source.

For what its worth, the raster package will ignore the error, but
reveals another:

  > g=raster("Vol_025_H14_2010060700.grib")
Warning: Inside GRIB2Inventory, Message # 5
ERROR: Ran out of file reading SECT0
There were 76 trailing bytes in the file.
  > g
class       : RasterLayer
band        : 1
dimensions  : 721, 1440, 1038240  (nrow, ncol, ncell)
resolution  : 0.25, 0.25  (x, y)
extent      : -0.125, 359.875, -90.125, 90.125  (xmin, xmax, ymin, ymax)
coord. ref. : +proj=longlat +a=6367470 +b=6367470 +no_defs
data source : /nobackup/rowlings/Downloads/Vol_025_H14_2010060700.grib
names       : Vol_025_H14_2010060700

I suspect there's an off-by-one error in the code that created this.
Remember there are only three possible mistakes in computing - off by
one errors and divide by zero errors.

Barry