[R] NaN, ncdf

Sashi Challa challa at ohsu.edu
Fri Nov 5 06:09:23 CET 2010

Dear All,

Can anyone please let me know how exactly ncdf deals with NaN.

I am trying to pass in a vector of data that has some NaN in it, into a variable in NetCDF.

dimX <- dim.def.ncdf("X","count",(1:6))
dimY <- dim.def.ncdf("Y","count",(1:3))
var1 <- var.def.ncdf("genotype","freq",list(dimX,dimY),missval=-9999,prec="single")
nc <- create.ncdf("/home/challar/testunix6.nc",list(var1))

genovals <- c("0.0","3",NaN,NaN,"-4","99")

[1] "put.var.ncdf: entering with filename /home/challar/testunix6.nc  and varid:"
[1] "genotype"
[1] "Checking to see if passed varid is ACTUALLY a dimension"
[1] "entering vobjtodimname with varid= genotype"
[1] "vobjtodimname: is a character type varid.  This file has 2 dims"
[1] "vobjtodimname: no cases found, returning FALSE"
[1] "...NO, passed obj was NOT a dimension"
[1] "put.var.ncdf: about to call vobjtovarid"
[1] "vobjtovarid: entering with varid=genotype"
[1] "Variable named genotype found in file with varid= 3"
[1] "vobjtovarid: returning with varid deduced from name; varid= 3"
[1] "put.var.ncdf: vobjtovarid returned: > 3 <"
[1] "put.var.ncdf: ending up using varid= 3"
[1] "about to change NAs to variables missing value"
[1] "Putting var of type 3  (1=short, 2=int, 3=float, 4=double, 5=char, 6=byte)"
[1] "put.var.ncdf: calling C routines with C-style count="
[1] 1 6
[1] "and C-style start="
[1] 0 0
Error in put.var.ncdf(nc, "genotype", genovals, start = c(1, 1), count = c(6,  :
  NA/NaN/Inf in foreign function call (arg 5)

Thanks for your time,


More information about the R-help mailing list