Steve Oncley oncley@atd.ucar.edu
Fri, 1 Jan 1999 22:46:18 -0700 (MST)

Happy 1999!

I've been celebrating the holidays by (finally) getting to the port of our 
S+ NetCDF routines to R, which I'm trying to make into a library.  At the 
moment, there are two issues I'd appreciate advice on:

1. Is support for mode "single" data planned anytime soon in R?  A lot of
our NetCDF files contain "single" data and having to coerce into "double"
will increase the use of R memory drastically (and slow things down).

2. Is there support for "pointer to pointer" arguments to .C?  NetCDF files
contain the data attributes, which aren't known until the files are read.
Our S+ code defines a dummy variable for the data dimensions, which are 
redefined (calling "S_alloc") and set within the C code once they are known.
The appended example works in S+ using the pointers= argument in .C.  
Is there a way to do this in R?

Thanks...Steve Oncley


void inquire_varid(
  int *ncid_p,          /* NetCDF file id. File is left open  */
  int *var_id_p,        /* variable id */
  long **varlen,        /* Length of variable, along each dimension */
  long *ndims_r,        /* number of dimensions in variable */
			/* This argument is created automatically by S+'s
			   .C for pointers=T variables */
  char **vartype)       /* character string describing S object type */
  *varlen = dimval = (long *)S_alloc(ndims,sizeof(long));

S+ call:
      vardims <- integer(0)             # Length of each dimension
      vartype <- ""                     # "integer","single","double" etc
      # get info about variable
      cdf <- .C("inquire_varid",
        cdfid = cdfid,
        varid = varid,
        vardims = vardims,
        vartype = vartype,pointers=c(F,F,T,F))

P.S. I'm using R 0.64 under Redhat Linux 5.2.
r-devel 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-devel-request@stat.math.ethz.ch