[R] ncdf - writing variable to a file

Peter Ehlers ehlers at ucalgary.ca
Tue Aug 21 21:02:44 CEST 2012


On 2012-08-21 11:02, m p wrote:
> Hello,
> I have a problem writing a variable to an existing file.
> Below is a part of my script and how it fails.
> I can't find "create.var.ncdf" in help

You probably want 'create.ncdf'.

Peter Ehlers

> Thanks for any help.
> Mark
>
> nc <- open.ncdf(ncname, readunlim=FALSE, write=TRUE )
>
> missing <- 1.e+30
>
> xdim <- nc$dim[["west_east"]]
> ydim <- nc$dim[["south_north"]]
> tdim <- nc$dim[["Time"]]
>
>
> lscalevar <- var.def.ncdf(scalenames[ivar],
> 'gpoints', list(xdim,ydim,tdim), missing )
>
> nc <- var.add.ncdf( nc, lscalevar )
>
> for( i in 1:nt)
> put.var.ncdf(nc,lscalevar,scale,verbose=TRUE )
>
> #scale is an array dimensioned (nx,ny)
>
> [1] "Hint: make SURE the variable was not only defined with a call to
> def.var.ncdf, but also included in the list passed to create.var.ncdf"
> Error in vobjtovarid(nc, varid, verbose = verbose) : stopping
> In addition: Warning message:
> In is.na(vals) : is.na() applied to non-(list or vector) of type 'closure'
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> 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.
>




More information about the R-help mailing list