Hi List,

I'm not sure what I'm doing wrong here and would appreciate some help. I
create a NetCDF dataset as follows:

library(ncdf)
combined.ncdf <- with(new.env(), {
    nLat <- 7
    nLon <- 8
    nTime <- 9
    missing.val <- -999
    filename <- file.path(tempdir(), 'combined_d6fg4s64s6g4l.nc')
    lat.dim <- dim.def.ncdf('lat', 'degrees', 1:nLat)
    lon.dim <- dim.def.ncdf('lon', 'degrees', 1:nLon)
    time.dim <- dim.def.ncdf("time", "days since 1970-01-01",
as.integer(1:nTime), unlim=T)
    var.def <- var.def.ncdf('Data', 'mm', list(lon.dim, lat.dim, time.dim),
missing.val, prec='single')
    nc <- create.ncdf(filename, var.def)
    for(i in 1:nLon)
        for(j in 1:nLat)
            for(k in 1:nTime)
                put.var.ncdf(nc, var.def, i + j*10 + k*100, c(i, j, k),
rep(1, 3))
    nc
})


the following do not work:
get.var.ncdf(combined.ncdf)
get.var.ncdf(combined.ncdf, varid='Data')
get.var.ncdf(combined.ncdf, varid=4)

all of which I thought would be equivalent and would give me the same as:
get.var.ncdf(combined.ncdf, forcevarid=4)

Could someone please point out the error of my ways.

Thanx in advance,
Simon Knapp

R version: 2.14.1,
ncdf built with version: 2.14.2
os: windows 7

        [[alternative HTML version deleted]]

______________________________________________
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