Hi, I'm using the "ncdf" library for creating ncdf files. But I need to create about 100 variables per file (e.g. single rivers), So I do not like to create each variable separately.
Unfortunately I found no way to make this work, as I'm unable to create a correct list of class "var.ncdf". ###code piece river=list(mode='var.ncdf', length=nriv) #class(river)="var.ncdf" for ( iriv in 1:nriv) { nam=paste('r',iriv, collapse=NULL,sep="") riv= var.def.ncdf(nam,"m**3/s",d1,msvf,longname=names[iriv],prec="single") #class(river[iriv]) ="var.ncdf" river[iriv] = riv } ncw=create.ncdf(wfile,list(river)) ###This is failing by warning first (which I do not understand): 1: In river[iriv] = riv : number of items to replace is not a multiple of replacement length 2: In river[iriv] = riv : number of items to replace is not a multiple of replacement length ... ###And finally with following error: Error in var.add.ncdf(nc, vars[[ivar]], verbose = verbose, indefine = TRUE) : var.add.ncdf: passed var NOT of class var.ncdf! The second arg to var.add.ncdf must be the return value from a call to var.def.ncdf ### Or folling error if class(river)="var.ncdf" is not commented: Error in 1:nd : argument of length 0 Does anybody know how to achieve this correct (how to create a correct list of class "var.ncdf"?) that would be understood by create.ncdf (I really tried many different things) Thanks for any hints, Adolf ------------------------------------------------ Adolf Stips (new email: adolf.st...@jrc.ec.europa.eu) Global Environment Monitoring unit CEC Joint Research Centre, TP 272 I-21027 Ispra, Italy Tel: +39-0332-789876 Fax: +39-0332-789034 I know that I do not know, but even that not for sure! ------------------------------------------------ "The views expressed are purely those of the writer and may not in any circumstances be regarded as stating an official position of the European Commission." ______________________________________________ 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.