[R] Re: netCDF

Agustin Lobo alobo at ija.csic.es
Thu Feb 14 18:20:26 CET 2002


After modifying the code and recompiling,
I get :

> library(netCDF)
> a <- read.netCDF(npp)
Error: attempt to set an attribute on NULL
In addition: Warning message:
Can't handle NC_CHAR yet

Which I do not understand, as attributes can be set
to NULL:

>  x <- cbind(a=1:3, pi=pi)
> attributes(x)
$dim
[1] 3 2

$dimnames
$dimnames[[1]]
NULL

$dimnames[[2]]
[1] "a"  "pi"

and then:

> attributes(x) <- NULL
> attributes(x)
NULL

or

> attributes(x)$dimnames <- NULL
> attributes(x)
$dim
[1] 3 2

Agus


Dr. Agustin Lobo
Instituto de Ciencias de la Tierra (CSIC)
Lluis Sole Sabaris s/n
08028 Barcelona SPAIN
tel 34 93409 5410
fax 34 93411 0012
alobo at ija.csic.es


On Thu, 14 Feb 2002, Thomas Lumley wrote:

> >
> > Now, at using it, I've found the following problem:
> >
> > > npp <- open.netCDF("npp.nc")
> > > a <- read.netCDF(npp)
> > Error: Can't handle NC_CHAR yet
> > > summary.netCDF(npp)
> > netCDF file npp.nc is open
> > $types
> > [1] "single" "single" "single" "single" "single" "char"   "single"
> > "single"
> > [9] "single"
> >
> > $dims
> > etc.
> >
> > Do you plan to release a version supporting NC_CHAR soon?
> > If not, would it be possible to modify the code so that the
> > char variables were discarded as currently but the non-char variables
> > could be read in?
> 
> I believe you should be able to just change
> 
>   case NC_CHAR:
>         error("Can't handle NC_CHAR yet");
>         break;
> 
> in Rreadnetcdf.c, line 234-6 to
> 
>   case NC_CHAR:
>         warning("Can't handle NC_CHAR yet");
> 	return R_NilValue;
>         break;
> 
> which would return NULL instead of the requested data.
> 
> 
> 	-thomas
> 
> 
> 

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list