I have this https://echange-fichiers.inra.fr/get?k=6TdTdezNeZwAqJtpwVm grib file which is a regular lat-lon 0.25x0.25 degrees and contains 4 fields . I tried to open it using : grib <- readGDAL("C:\\Users\\aalyaari\\Desktop\\Vol_025_H14_2010060700.grib") 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? -- View this message in context: http://r.789695.n4.nabble.com/How-to-open-grib-file-in-R-tp4655497.html Sent from the R help mailing list archive at Nabble.com.
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
Your question should have been posted to the R-sig-geo mailing list. FWIW I have no direct experience with the files or functions you are using, but I have to say the error message seems pretty clear to me: latitude values are normally limited to [-90,90], but your file appears to have data outside this range. Thus, the file appears to have invalid data. --------------------------------------------------------------------------- Jeff Newmiller The ..... ..... Go Live... DCN:<jdnewmil at dcn.davis.ca.us> Basics: ##.#. ##.#. Live Go... Live: OO#.. Dead: OO#.. Playing Research Engineer (Solar/Batteries O.O#. #.O#. with /Software/Embedded Controllers) .OO#. .OO#. rocks...1k --------------------------------------------------------------------------- Sent from my phone. Please excuse my brevity. Jonsson <amen.alyaari at Bordeaux.inra.fr> wrote:>I have this >https://echange-fichiers.inra.fr/get?k=6TdTdezNeZwAqJtpwVm >grib file which is a regular lat-lon 0.25x0.25 degrees and contains 4 >fields >. >I tried to open it using : > grib <- >readGDAL("C:\\Users\\aalyaari\\Desktop\\Vol_025_H14_2010060700.grib") > >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? > > > > >-- >View this message in context: >http://r.789695.n4.nabble.com/How-to-open-grib-file-in-R-tp4655497.html >Sent from the R help mailing list archive at Nabble.com. > >______________________________________________ >R-help at r-project.org mailing list >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.
I have just contacted the sources and I am told that he checked min/max lat/lon for the file and it was right. He is using Linux while I am using Windows, would that be problematic? -- View this message in context: http://r.789695.n4.nabble.com/How-to-open-grib-file-in-R-tp4655497p4655517.html Sent from the R help mailing list archive at Nabble.com.
On Mon, Jan 14, 2013 at 6:26 PM, Jonsson <amen.alyaari at bordeaux.inra.fr> wrote:> I have just contacted the sources and I am told that he checked min/max > lat/lon for the file and it was right. He is using Linux while I am using > Windows, would that be problematic?gdalinfo on a Linux box says it has the same problem: $ gdalinfo 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. Driver: GRIB/GRIdded Binary (.grb) Files: Vol_025_H14_2010060700.grib Size is 1440, 721 Coordinate System is: GEOGCS["Coordinate System imported from GRIB file", DATUM["unknown", SPHEROID["Sphere",6367470,0]], PRIMEM["Greenwich",0], UNIT["degree",0.0174532925199433]] Origin = (-0.125000000000000,90.125000000000000) Pixel Size = (0.250000000000000,-0.250000000000000) Corner Coordinates: Upper Left ( -0.1250000, 90.1250000) ( 0d 7'30.00"W, 90d 7'30.00"N) Lower Left ( -0.1250000, -90.1250000) ( 0d 7'30.00"W, 90d 7'30.00"S) Upper Right ( 359.875, 90.125) (359d52'30.00"E, 90d 7'30.00"N) Lower Right ( 359.875, -90.125) (359d52'30.00"E, 90d 7'30.00"S) Center ( 179.8750000, 0.0000000) (179d52'30.00"E, 0d 0' 0.01"N) Now go ask your source why they are using 721 pixels from N to S... I don't have anything else that can read grib files, so I can't say any more, and as a binary file format its hard to tell if gdalinfo is correct or not, but its usually pretty good.