[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Help with using "get( )" function needed please



Hi Alion,

> I am having some trouble using the "get" function. Could someone help me out
> and explain to me how I am suppose to use it? (Since I am obvisouly not
> using correctly)
> 
> This is the only thing I found in the documentation, but it isn't helping me
> much:
> [ NcBool NcVar::get(int*, long int, long int, long int, long int, long int)

This is a good question to send to our support email address at
"address@hidden".

The documentation at 

  
http://www.unidata.ucar.edu/software/netcdf/docs/netcdf-cxx/Class-NcVar.html#Class-NcVar

says

 NcBool get(ncbyte* vals, long c0, long c1, long c2, long c3, long c4) const
 NcBool get(char* vals, long c0, long c1, long c2, long c3, long c4) const
 NcBool get(short* vals, long c0, long c1, long c2, long c3, long c4) const
 NcBool get(int* vals, long c0, long c1, long c2, long c3, long c4) const
 NcBool get(long* vals, long c0, long c1, long c2, long c3, long c4) const
 NcBool get(float* vals, long c0, long c1, long c2, long c3, long c4) const
 NcBool get(double* vals, long c0, long c1, long c2, long c3, long c4) const
     Get scalar or 1 to 5 dimensional arrays by providing enough
     arguments. Arguments are edge lengths, and their number must not
     exceed variable's dimensionality. Start corner is [0,0,..., 0] by
     default, but may be reset using the set_cur() member
     function. FALSE is returned if type of values does not match type
     for variable. 

So if you are getting the [0][0][0] value of a 3-dimensional integer
variable, you could invoke

  int value;
  var.get(&value, 1, 1, 1);

but if instead you want all 20 values of a 2-dimensional integer
variable that's declared to be of shape 4 by 5, you would use
something like

  int vals[4][5];
  var.get(&vars, 4, 5);

If you wanted to get a slice of the array starting somewhere else
besides the [0][0][0]... (origin) of the variable, you would first use
the set_cur() member function to "set the cursor" to another origin
point within the variable.

We need some good C++ interface example programs, and hope to make
some available this summer.

--Russ

_____________________________________________________________________

Russ Rew                                         UCAR Unidata Program
address@hidden                     http://www.unidata.ucar.edu