On Mon, Apr 2, 2012 at 1:54 AM, Yogesh Tiwari <yogesh....@googlemail.com> wrote:

> How  to read netcdf files in R ?
> Which packeges do we need to install for this,
> and what commands are used for reading netcdf files.

Typical code would look something like this:

library('ncdf'')

filename <- 'data.nc'
varname <- 'Temperature'

ncid <- open.ncdf( filename )
data <- get.var.ncdf( ncid, varname )

If you need to see what variables the file contains to get the
variable names, just do a "print(ncid)" after you open it.

If it is a very large file, too large for the data to fit in memory
all at once, you can step through and read each timestep in the file
separately using the "start=" and "count=" arguments to the
get.var.ncdf() call.

Regards,

--Dave

-- 
David W. Pierce
Division of Climate, Atmospheric Science, and Physical Oceanography
Scripps Institution of Oceanography, La Jolla, California, USA
(858) 534-8276 (voice)  /  (858) 534-8561 (fax)    dpie...@ucsd.edu

______________________________________________
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