[R-sig-Geo] problem reading netcdf file with readGDAL: "no bands in dataset"

ElenaC E.Couce.07 at bristol.ac.uk
Wed Nov 25 14:34:31 CET 2009


Hi all,

I'm trying to open a netcdf file using the rgdal library, but readGDAL and
GDALinfo don't seem to be able to correctly access the information in the
file. It is probably a stupid mistake because I don't understand what I'm
doing, but I have already spent a long time trying to sort it out and I
could really use some help with it. 

When I try readGDAL, it fails with the error that there are "no bands in
dataset". This is the output I get from GDALinfo:

> GDALinfo(fname)
rows        512 
columns     512 
bands       0 
origin.x        0 
origin.y        1 
res.x       1 
res.y       1 
oblique.x   0 
oblique.y   0 
driver      netCDF 
projection  NA 

Warning messages:
1: In dim(x) : no bands in dataset
2: In GDALinfo(fname) : no bands in dataset



But from opening the file with Panoply, it seems it actually contains four
variables, two of them 360*180 matrices with the geographical info I'm
trying to access (global data with 1 degree spatial resolution), and the two
others called "lat" and "lon" with the latitude and longitude values.

I don't understand why GDALinfo is telling me that the file has 512 rows and
512 columns and that there are "no bands". What can I do to access the
variables I want?

Any help would be greatly appreciated!
Elena
-- 
View this message in context: http://n2.nabble.com/problem-reading-netcdf-file-with-readGDAL-no-bands-in-dataset-tp4064987p4064987.html
Sent from the R-sig-geo mailing list archive at Nabble.com.



More information about the R-sig-Geo mailing list