[R] RNetCDF: retrieving variable names and units

David Pierce dpierce at ucsd.edu
Wed Jan 12 23:20:56 CET 2011


Hi Jannis,

although I don't know how you'd do that with RNetCDF, with the ncdf
package it's pretty easy:

ncid = open.ncdf( 'file.nc' )
nvars = ncid$nvars
for( ivar in 1:nvars )
    print(paste("var number",ivar,"is named", ncid$var[[ivar]]$name, "and
has units", ncid$var[[ivar]]$units ))

Regards,

--Dave

Jannis 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 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.
>
>


-------------------------------------------------------------------
David W. Pierce
Division of Climate, Atmospheric Science, and Physical Oceanography
Scripps Institution of Oceanography
(858) 534-8276 (voice)  /  (858) 534-8561 (fax)    dpierce at ucsd.edu



More information about the R-help mailing list