Next: Class NcAtt, Previous: Class NcTypedComponent, Up: NetCDF Classes
NcVar is derived from NcTypedComponent, and represents a netCDF
variable. A netCDF variable has a name, a type, a shape, zero or more
attributes, and a block of values associated with it. Because variables
are only associated with open netCDF files, there are no public
constructors for this class. Use member functions of NcFile to
get variables or add new variables.
NcToken name( void ) constNcType type( void ) constncByte, ncChar, ncShort, ncInt,
ncFloat, or ncDouble.
int num_dims( void ) constNcDim* get_dim( int n ) constlong* edges( void ) constint num_atts( void ) constNcAtt* get_att( NcToken attname ) constNcAtt* get_att( int n ) constNcBool is_valid( void ) constTRUE if the variable is valid, FALSE otherwise.
long num_vals( void ) constNcValues* values( void ) constget member function instead, to get single
values or selected cross-sections of values.
NcBool put(const ncbyte* vals, long c0, long c1, long c2, long c3, long c4)NcBool put(const char* vals, long c0, long c1, long c2, long c3, long c4)NcBool put(const short* vals, long c0, long c1, long c2, long c3, long c4)NcBool put(const int* vals, long c0, long c1, long c2, long c3, long c4)NcBool put(const long* vals, long c0, long c1, long c2, long c3, long c4)NcBool put(const float* vals, long c0, long c1, long c2, long c3, long c4)NcBool put(const double* vals, long c0, long c1, long c2, long c3, long c4)[0,0,..., 0] by default, but may
be reset using the set_cur() member function for this variable.
FALSE is returned if type of values is not convertible to
external netCDF type for
variable. For more than 5 dimensions, use the overloaded n-dimensional
form of the put member function.
NcBool put(const ncbyte* vals, const long* counts)NcBool put(const char* vals, const long* counts)NcBool put(const short* vals, const long* counts)NcBool put(const int* vals, const long* counts)NcBool put(const long* vals, const long* counts)NcBool put(const float* vals, const long* counts)NcBool put(const double* vals, const long* counts)[0, 0, ..., 0] by
default, may be reset with set_cur(). FALSE is returned
if type of values is not convertible to
external netCDF type for variable.
NcBool get(ncbyte* vals, long c0, long c1, long c2, long c3, long c4) constNcBool get(char* vals, long c0, long c1, long c2, long c3, long c4) constNcBool get(short* vals, long c0, long c1, long c2, long c3, long c4) constNcBool get(int* vals, long c0, long c1, long c2, long c3, long c4) constNcBool get(long* vals, long c0, long c1, long c2, long c3, long c4) constNcBool get(float* vals, long c0, long c1, long c2, long c3, long c4) constNcBool get(double* vals, long c0, long c1, long c2, long c3, long c4) const[0,0,..., 0] by default, but may
be reset using the set_cur() member function. FALSE is
returned if type of values is not convertible from
external netCDF type for variable.
NcBool get(ncbyte* vals, const long* counts) constNcBool get(char* vals, const long* counts) constNcBool get(short* vals, const long* counts) constNcBool get(int* vals, const long* counts) constNcBool get(long* vals, const long* counts) constNcBool get(float* vals, const long* counts) constNcBool get(double* vals, const long* counts) const[0, 0, ..., 0] by default,
may be reset with set_cur() member function. FALSE is
returned if type of values is not convertible from
external netCDF type for variable.
NcBool set_cur(long c0=-1, long c1=-1, long c2=-1, long c3=-1, long c4=-1)NcBool set_cur(long* cur)NcBool add_att( NcToken, char )NcBool add_att( NcToken, ncbyte )NcBool add_att( NcToken, short )NcBool add_att( NcToken, int )NcBool add_att( NcToken, long )NcBool add_att( NcToken, float )NcBool add_att( NcToken, double )NcBool add_att( NcToken, const char* )NcBool add_att( NcToken, int, const char* )NcBool add_att( NcToken, int, const ncbyte* )NcBool add_att( NcToken, int, const short* )NcBool add_att( NcToken, int, const int* )NcBool add_att( NcToken, int, const long* )NcBool add_att( NcToken, int, const float* )NcBool add_att( NcToken, int, const double* )NcBool rename( NcToken newname )ncbyte as_ncbyte( int n ) constchar as_char( int n ) constshort as_short( int n ) constint as_int( int n ) constnclong as_nclong( int n ) const // deprecatedlong as_long( int n ) constfloat as_float( int n ) constdouble as_double( int n ) constchar* as_string( int n ) constas_string method.
int id( void ) constNcBool sync( void )~NcVar( void )The following member functions are intended for record variables. They will also work for non-record variables, if the first dimension is interpreted as the record dimension.
long rec_size( void )long rec_size( NcDim* )NcValues* get_rec( void )NcValues* get_rec( long n )NcValues* get_rec( NcDim* )NcValues* get_rec( NcDim*, long n )NcBool put_rec( const ncbyte* vals )NcBool put_rec( const char* vals )NcBool put_rec( const short* vals )NcBool put_rec( const int* vals )NcBool put_rec( const long* vals )NcBool put_rec( const float* vals )NcBool put_rec( const double* vals )NcBool put_rec( NcDim*, const ncbyte* vals )NcBool put_rec( NcDim*, const char* vals )NcBool put_rec( NcDim*, const short* vals )NcBool put_rec( NcDim*, const int* vals )NcBool put_rec( NcDim*, const long* vals )NcBool put_rec( NcDim*, const float* vals )NcBool put_rec( NcDim*, const double* vals )NcBool put_rec( const ncbyte* vals, long rec )NcBool put_rec( const char* vals, long rec )NcBool put_rec( const short* vals, long rec )NcBool put_rec( const int* vals, long rec )NcBool put_rec( const long* vals, long rec )NcBool put_rec( const float* vals, long rec )NcBool put_rec( const double* vals, long rec )NcBool put_rec( NcDim*, const ncbyte* vals, long slice )NcBool put_rec( NcDim*, const char* vals, long slice )NcBool put_rec( NcDim*, const short* vals, long slice )NcBool put_rec( NcDim*, const int* vals, long slice )NcBool put_rec( NcDim*, const long* vals, long slice )NcBool put_rec( NcDim*, const float* vals, long slice )NcBool put_rec( NcDim*, const double* vals, long slice )long get_index( const ncbyte* vals )long get_index( const char* vals )long get_index( const short* vals )long get_index( const int* vals )long get_index( const long* vals )long get_index( const float* vals )long get_index( const double* vals )long get_index( NcDim*, const ncbyte* vals )long get_index( NcDim*, const char* vals )long get_index( NcDim*, const short* vals )long get_index( NcDim*, const int* vals )long get_index( NcDim*, const long* vals )long get_index( NcDim*, const float* vals )long get_index( NcDim*, const double* vals )void set_rec ( long rec )void set_rec ( NcDim*, long rec )