[R-sig-Geo] rgdal - problem with reading grib files
Santiago Beguería Portugués
santiago.begueria at csic.es
Wed Jan 25 00:37:33 CET 2012
Hi,
I am stuck when trying to read data from certain grib files with GDAL. When I try to read the data I get the following error:
> tmp <- readGDAL('./data/ghcn_cams/ghcn_cams_1948_cur.grb')
...
Error in `proj4string<-`(`*tmp*`, value = <S4 object of class "CRS">) :
Geographical CRS given to non-conformant data
I read on this mail list that this might be caused by data being outside the valid range for the CRS. And so it seems:
> GDALinfo('./data/ghcn_cams/ghcn_cams_1948_cur.grb')
rows 360
columns 720
bands 768
origin.x 0.25
origin.y -90.25
res.x 0.5
res.y 0.5
ysign -1
oblique.x 0
oblique.y 0
driver GRIB
projection +proj=longlat +a=6371200 +b=6371200 +no_defs
file ./data/ghcn_cams/ghcn_cams_1948_cur.grb
Since the origin.y coordinate is -90.25. However, according to the metadata provided in an accompanying file the lowest y coordinate should be -89.75:
dset ^ghcn_cams_1948_cur.grb
index ^ghcn_cams_1948_cur.grb.idx
undef 9.999E+20
title ghcn_cams_1948_cur.grb
* produced by grib2ctl v0.9.12.5p39a
dtype grib 255
options yrev
ydef 360 linear -89.750000 0.5
xdef 720 linear 0.250000 0.500000
tdef 768 linear jan1948 1mo
zdef 1 linear 1 1
vars 1
TMP2m 0 11,105,2 ** 2 m above ground Temp. [K]
ENDVARS
I need to find a workaround to solve this problem, but I'm new to grib files (mostly used netCDF before) and I don't know how to proceed. Would appreciate any help.
Thank you in advance,
Santiago Beguería
More information about the R-sig-Geo
mailing list