On Mon, Sep 12, 2011 at 1:32 PM, Claudia Stocker <cstoc...@climate.unibe.ch> wrote: > Dear all, > > I have a problem in writing a variable to a NetCDF-File. > My code works pretty well until the step put.var.ncdf(): > > [...code omitted...] > R prints the following error: > #--------------------- > > Error in put.var.ncdf(spi, var.spi.24.03.me, spi24.me) : NA/NaN/Inf in > foreign function call (arg 5) > > I can exclude an error in length (dim.time.spi and spi24.me have the same > length) or NA (there are no NA in the spi24.me vector). Where is the > error?? The code seems so simple..
Hi Claudia, could you put the following code in right before the put.var.ncdf call and see what it prints: print(paste('num of NAs in time:", sum(is.na(dim.time)) )) print(paste("length of time:", length(dim.time) )) print(paste("num of NAs in spi24.me:", sum(is.na(spi24.me)) )) print(paste("length of spi24.me:", length(spi24.me) )) If that doesn't show anything wrong, you can email me the data and your code and I can give it a try. Or, you can try the newest version of the ncdf/ncdf4 packages, which you can download from: http://cirrus.ucsd.edu/~pierce/ncdf/ it may be a bug that I've already fixed. Regards, --Dave -- David W. Pierce Division of Climate, Atmospheric Science, and Physical Oceanography Scripps Institution of Oceanography (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.