Skip to content
Prev 247174 / 398503 Next

RNetCDF: retrieving variable names and units

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:
-------------------------------------------------------------------
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