I could read and open .nc file in R, but now how to plot a simple filled
Data and variables of .nc after reading in R are as below. Data have time
steps of 99 (monthly mean data for 8 years).
If I want to fill / plot co2 variable at time=1 then how to do it. Also,
how can select lat lon
over a particular region. For example, fill co2 [lat=0:40, lon=50:90,
time=1] and then overplot a continental map.
how to write this fill command in R,
package �ncdf� was built under R version 2.14.2
 "file AIRS_2002_10_added-all-years.nc has 3 dimensions:"
 "time Size: 99"
 "lat Size: 91"
 "lon Size: 144"
 "file AIRS_2002_10_added-all-years.nc has 1 variables:"
 "float co2[lon,lat,time] Longname:co2 Missval:1e+30"
On Mon, Apr 2, 2012 at 9:20 PM, David William Pierce wrote:
On Mon, Apr 2, 2012 at 1:54 AM, Yogesh Tiwari 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:
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
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) email@example.com
Yogesh K. Tiwari (Dr.rer.nat),
Centre for Climate Change Research,
Indian Institute of Tropical Meteorology,
Homi Bhabha Road,
Phone: 0091-99 2273 9513 (Cell)
: 0091-20-25904452 (O)
Fax : 0091-20-258 93 825