There are a number of functions in the package to inquire about the
file contents. See library(help = RNetCDF).

For example:

library(RNetCDF)

nc <- open.nc("file.nc")

var.inq.nc(nc, 0)
$id
[1] 0

$name
[1] "longitude_U"

$type
[1] "NC_DOUBLE"

$ndims
[1] 1

$dimids
[1] 1

$natts
[1] 0

You can then read from the file with something like this:

obj0 <- var.inq.nc(nc, 0)
dat <- var.get.nc(nc, obj0$name, start = ...)

Going with ncdf or ncdf4 package is probably better ( I just happen to
be more familiar with RNetCDF.)

Cheers, Mike.

On Thu, Jan 13, 2011 at 9:00 AM, Jannis <bt_jan...@yahoo.de> wrote:
> Dear List,
>
>
> does anybody has experience with the RNetCDF package? I manage to open a 
> connection and copy data from a ncdf file but would need a way to 
> automatically retrieve variable names (ideally all of them from one file) and 
> units from the file.
>
>
> Any ideas?
> Jannis
>
>
>
> ______________________________________________
> R-help@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.
>



-- 
Michael Sumner
Institute for Marine and Antarctic Studies, University of Tasmania
Hobart, Australia
e-mail: mdsum...@gmail.com

______________________________________________
R-help@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.

Reply via email to