De rien. You're welcome.
Pascal
Le 12/08/29 5:23, Tom Roche a écrit :
Pascal Oettli: MERCI BEAUCOUP! (though I would have thanked you
earlier if I hadn't had to dig through the r-help digest first :-)
Tom Roche Mon, 27 Aug 2012 23:31:23 -0400
summary: I can successfully ncvar_put(...) data to a file, but when
I try to ncvar_get(...) the same data I get
Error in if (nc$var[[li]]$hasAddOffset) addOffset = nc$var[[li]]$addOffset else
addOffset = 0 :
argument is of length zero
https://stat.ethz.ch/pipermail/r-help/2012-August/322576.html
The following works fine for me:
* > nc <- nc_open("~/GEIA_N2O_oceanic.nc")
emi_n2o <- ncvar_get(nc, 'emi_n2o', start=c(1,1,1), count=c(-1,-1,1))
And that appears to have been the problem, since when I
-nc_open(netcdf.fp,
- write=FALSE,
- readunlim=TRUE)
+netcdf.file <- nc_open(netcdf.fp,
+ write=FALSE,
+ readunlim=TRUE)
I don't get the error when I subsequently ncvar_get, and the code @
https://github.com/TomRoche/GEIA_to_NetCDF
now works.
Dave Pierce: I assert that the current error is waaay too subtle:
- I don't get an error when I nc_open without assigning.
- I don't get an error when I ncvar_put to that file's datavar.
- I only get an error when I ncvar_get from the datavar.
- Nothing about the error text (IMHO) would lead one to the fix.
(Note also that neither ncvar_put or nc_close appear to require
assignment, which is probably what made me think I could nc_open
without assignment.)
Can ncdf4 be made to fail more helpfully? E.g., to fail immediately on
nc_open without assignment?
thanks again! Tom Roche <Tom_Roche@xxxxxxxxx>