[R] How to open grib file in R?
Barry Rowlingson
b.rowlingson at lancaster.ac.uk
Mon Jan 14 17:52:50 CET 2013
On Mon, Jan 14, 2013 at 4:36 PM, Jonsson <amen.alyaari at bordeaux.inra.fr> wrote:
> but I got this error:
> C:\Users\aalyaari\Desktop\Vol_025_H14_2010060700.grib has GDAL driver GRIB
> and has 721 rows and 1440 columns Error in validityMethod(as(object,
> superClass)) :
> Geographical CRS given to non-conformant data: -90.125 90.125
>
> Any idea why I am getting this error?
>
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
More information about the R-help
mailing list