VAPoR  0.1
Classes | Public Member Functions | Protected Member Functions | Friends | List of all members
VAPoR::NetCDFCollection Class Reference

Wrapper for a collection of netCDF files. More...

#include <NetCDFCollection.h>

Inheritance diagram for VAPoR::NetCDFCollection:
VetsUtil::MyBase VAPoR::NetCDFCFCollection

Classes

class  DerivedVar
 
class  TimeVaryingVar
 

Public Member Functions

 NetCDFCollection ()
 
virtual ~NetCDFCollection ()
 
virtual int Initialize (const std::vector< string > &files, const std::vector< string > &time_dimnames, const std::vector< string > &time_coordvar)
 
virtual bool VariableExists (string varname) const
 
virtual bool VariableExists (size_t ts, string varname) const
 
virtual bool IsDerivedVar (string varname) const
 
virtual bool IsStaggeredVar (string varname) const
 
virtual bool IsStaggeredDim (string dimname) const
 
virtual std::vector< string > GetVariableNames (int ndim, bool spatial) const
 
virtual std::vector< size_t > GetSpatialDims (string varname) const
 
virtual std::vector< string > GetSpatialDimNames (string varname) const
 
virtual size_t GetTimeDim (string varname) const
 
virtual string GetTimeDimName (string varname) const
 
virtual std::vector< size_t > GetDims (string varname) const
 
virtual std::vector< string > GetDimNames (string varname) const
 
virtual bool IsTimeVarying (string varname) const
 
std::vector< string > GetAttNames (string varname) const
 
int GetAttType (string varname, string attname) const
 
void GetAtt (string varname, string attname, std::vector< double > &values) const
 
void GetAtt (string varname, string attname, std::vector< long > &values) const
 
void GetAtt (string varname, string attname, string &values) const
 
virtual std::vector< string > GetDimNames () const
 
virtual std::vector< size_t > GetDims () const
 
virtual size_t GetNumTimeSteps () const
 
virtual size_t GetNumTimeSteps (string varname) const
 
virtual int GetTime (size_t ts, double &time) const
 
virtual int GetTimes (string varname, std::vector< double > &times) const
 
virtual std::vector< double > GetTimes () const
 
virtual int GetFile (size_t ts, string varname, string &file, size_t &local_ts) const
 
virtual int GetVariableInfo (string varname, NetCDFSimple::Variable &varinfo) const
 
virtual bool GetMissingValue (string varname, double &mv) const
 
virtual int OpenRead (size_t ts, string varname)
 
virtual int Read (size_t start[], size_t count[], float *data, int fd=0)
 
virtual int Read (size_t start[], size_t count[], int *data, int fd=0)
 
virtual int Read (float *data, int fd=0)
 
virtual int Read (char *data, int fd=0)
 
virtual int ReadNative (size_t start[], size_t count[], float *data, int fd=0)
 
virtual int ReadNative (size_t start[], size_t count[], int *data, int fd=0)
 
virtual int ReadNative (size_t start[], size_t count[], char *data, int fd=0)
 
virtual int ReadNative (float *data, int fd=0)
 
virtual int ReadNative (int *data, int fd=0)
 
virtual int ReadSlice (float *data, int fd=0)
 
virtual int ReadSliceNative (float *data, int fd=0)
 
virtual int SeekSlice (int offset, int whence, int fd=0)
 
virtual int Close (int fd=0)
 
virtual void SetStaggeredDims (const std::vector< string > dimnames)
 
virtual void SetMissingValueAttName (string attname)
 
virtual std::vector< string > GetFailedVars () const
 
void InstallDerivedVar (string varname, DerivedVar *derivedVar)
 
void RemoveDerivedVar (string varname)
 
- Public Member Functions inherited from VetsUtil::MyBase
 MyBase ()
 
const string & getClassName () const
 

Protected Member Functions

bool _GetVariableInfo (string varname, NetCDFSimple::Variable &variable) const
 
- Protected Member Functions inherited from VetsUtil::MyBase
void SetClassName (const string &name)
 

Friends

std::ostream & operator<< (std::ostream &o, const NetCDFCollection &ncdfc)
 

Additional Inherited Members

- Public Types inherited from VetsUtil::MyBase
typedef void(* ErrMsgCB_T )(const char *msg, int err_code)
 
typedef void(* DiagMsgCB_T )(const char *msg)
 
- Static Public Member Functions inherited from VetsUtil::MyBase
static void SetErrMsg (const char *format,...)
 Record a formatted error message. More...
 
static void SetErrMsg (int errcode, const char *format,...)
 Record a formatted error message and an error code. More...
 
static const char * GetErrMsg ()
 
static void SetErrCode (int err_code)
 Record an error code. More...
 
static int GetErrCode ()
 Retrieve the current error code. More...
 
static void SetErrMsgCB (ErrMsgCB_T cb)
 
static ErrMsgCB_T GetErrMsgCB ()
 
static void SetErrMsgFilePtr (FILE *fp)
 
static const FILE * SetErrMsgFilePtr ()
 
static void SetDiagMsg (const char *format,...)
 Record a formatted diagnostic message. More...
 
static const char * GetDiagMsg ()
 
static void SetDiagMsgCB (DiagMsgCB_T cb)
 
static DiagMsgCB_T GetDiagMsgCB ()
 
static void SetDiagMsgFilePtr (FILE *fp)
 
static bool EnableErrMsg (bool enable)
 
- Static Public Attributes inherited from VetsUtil::MyBase
static char * ErrMsg
 
static int ErrCode
 
static int ErrMsgSize
 
static FILE * ErrMsgFilePtr
 
static ErrMsgCB_T ErrMsgCB
 
static char * DiagMsg
 
static int DiagMsgSize
 
static FILE * DiagMsgFilePtr
 
static DiagMsgCB_T DiagMsgCB
 
static bool Enabled
 

Detailed Description

Wrapper for a collection of netCDF files.

Author
John Clyne
Version
Revision
1.7
Date
Date
2013/05/16 21:39:38

This class treats a collection of netCDF files as a single, time-varying data set, providing a unified interface for accessing named 0D, 1D, 2D, and 3D spatial variables at a specified timestep, independent of which netCDF file contains the data.

The netCDF variables may be "explicitly" time-varying: the slowest varying dimension may correspond to time, while the remaining dimensions correspond to space. Or the variables may be implicitly time-varying, possessing no explicit time dimension, in which case the time index of a variable is determined by file ordering. For example, if the variable "v" is found in the files "a.nc" and "b.nc" and nowhere else, and "a.nc" preceeds "b.nc" in the list of files provided to the class constructor, then a.nc is assumed to contain "v" at time step 0, and "b.nc" contains "v" at time step 1.

The class understands the Arakawa C-Grid ("staggered" variables), and can interpolate them onto a common (unstaggered) grid.

Note
The specification of dimensions and coordinates in this class follows the netCDF API convention of ordering from slowest varying dimension to fastest varying dimension. For example, if 'dims' is a vector of dimensions, then dims[0] is the slowest varying dimension, dim[1] is the next slowest, and so on. This ordering is the opposite of the ordering used by most of the VAPoR API.

Several file organizations are supported and discussed below. To ease discussion we introduce the terminology:

define TD : Time Dimension
define TCV : Time Coordinate Variable
define TVV : an explicitly Time Varying Variable (it has a time dimension)
define ITVV : an Implicit Time Varying Variable (has no time dimension, but has multiple occurences => order determines time)
define CV: Constant Variable (has no TD, occurs only once). CV variables are define for all time steps

Four file organizations are supported as described below:

case 1: No TD specified (therefore no TCV):

case 2: TD specified, but no TCV:

case 3a: TD & TCV specified, TCV appears in only file:

case 3b: TD & TCV specified, TCV appears in every file with TVV:

Definition at line 96 of file NetCDFCollection.h.

Constructor & Destructor Documentation

VAPoR::NetCDFCollection::NetCDFCollection ( )
virtual VAPoR::NetCDFCollection::~NetCDFCollection ( )
virtual

Member Function Documentation

bool VAPoR::NetCDFCollection::_GetVariableInfo ( string  varname,
NetCDFSimple::Variable variable 
) const
protected
virtual int VAPoR::NetCDFCollection::Close ( int  fd = 0)
virtual

Close the currently opened variable

Parameters
[in]fdA currently opened file descriptor returned by OpenRead().
See also
OpenRead()
void VAPoR::NetCDFCollection::GetAtt ( string  varname,
string  attname,
std::vector< double > &  values 
) const

Return attribute values for attribute of type float

Return the values of the named attribute converted to type float.

Note
Attributes of type int are cast to float
All attributes with floating point representation of any precision are returned by this method. Attributes that do not have floating point internal representations can not be returned.
Parameters
[in]attnameName of the attribute
[out]valuesA vector of attribute values
void VAPoR::NetCDFCollection::GetAtt ( string  varname,
string  attname,
std::vector< long > &  values 
) const
void VAPoR::NetCDFCollection::GetAtt ( string  varname,
string  attname,
string &  values 
) const
std::vector<string> VAPoR::NetCDFCollection::GetAttNames ( string  varname) const

Return a list of available attribute's names

Returns a vector of all attribute names for the variable, varname. If varname is the empty string the names of all of the global attributes are returned. If varname is not defined an empty vector is returned.

Parameters
[in]varnameThe name of the variable to query, or the empty string if the names of global attributes are desired.
Return values
attnamesA vector of returned attribute names
int VAPoR::NetCDFCollection::GetAttType ( string  varname,
string  attname 
) const

Return the netCDF external data type for an attribute

Returns the nc_type of the named variable attribute.

Parameters
[in]varnameThe name of the variable to query, or the empty string if the names of global attributes are desired.
[in]nameName of the attribute.
Return values
Ifan attribute named by name does not exist, a negative value is returned.
virtual std::vector<string> VAPoR::NetCDFCollection::GetDimNames ( string  varname) const
virtual

Return a variable's temporal and spatial dimension names

Returns the ordered list of temporal and spatial dimension names of the named variable.

Note
The order follows the netCDF convention (slowest varying dimension is the first vector element returned), not the VDC convention.
Parameters
[in]varnameName of variable
Return values
dimnamesAn ordered vector containing the variable's temporal and spatial dimension names. If varname is not defined an empty list is returned.
virtual std::vector<string> VAPoR::NetCDFCollection::GetDimNames ( ) const
inlinevirtual

Return the names of all the dimensions.

Returns a list of all dimension names defined by all netCDF files in the entire collection. The ordering of the returned list coresponds to the ordering of the list of dimenension lengths returned by GetDims(). I.e. the length of the dimension with name GetDimNames()[i] is GetDims[i].

Return values
dimnamesA vector containing all dimension names.
See also
GetDims()

Definition at line 383 of file NetCDFCollection.h.

virtual std::vector<size_t> VAPoR::NetCDFCollection::GetDims ( string  varname) const
virtual

Return a variable's temporal and spatial dimensions

Returns the ordered list of temporal and spatial dimensions of the named variable.

Note
The order follows the netCDF convention (slowest varying dimension is the first vector element returned), not the VDC convention.
Parameters
[in]varnameName of variable
Return values
dimsAn ordered vector containing the variables temporal and spatial dimensions. If varname is not defined a zero length vector is returned
virtual std::vector<size_t> VAPoR::NetCDFCollection::GetDims ( ) const
inlinevirtual

Return the lengths of all the dimensions.

Returns a list of all dimension lengths defined by all netCDF files in the entire collection. The ordering of the returned list coresponds to the ordering of the list of dimenension names returned by GetDimNames(). I.e. the length of the dimension with name GetDimNames()[i] is GetDims[i].

Return values
dimlensA vector containing all dimension lengths.
See also
GetDimNames()

Definition at line 398 of file NetCDFCollection.h.

virtual std::vector<string> VAPoR::NetCDFCollection::GetFailedVars ( ) const
inlinevirtual

Return a list of variables that are not available for access

This method returns a list of variables that were detected in the collection of netCDF files but are not accessible from the NetCDFCollection class.

Definition at line 698 of file NetCDFCollection.h.

virtual int VAPoR::NetCDFCollection::GetFile ( size_t  ts,
string  varname,
string &  file,
size_t &  local_ts 
) const
virtual

Return the path to the netCDF file containing a variable

This method returns the path to the netCDF file containing the variable varname, at the time step ts.

Parameters
[in]tstime step of variable
[in]varnameName of variable
[out]fileThe netCDF file path
[out]local_tslocal time index of variable within file
Return values
retvalA negative int is returned on failure.
virtual bool VAPoR::NetCDFCollection::GetMissingValue ( string  varname,
double &  mv 
) const
virtual

Return the missing value, if any, for a variable

This method returns the value of the missing data value marker, if defined, for the variable named by varname.

Parameters
[in]varnameThe variable name
[out]mvThe missing value for the variabled name by varname
Return values
boolThe boolean true is returned if a missing value is defined. If no missing variable is defined the return value is false and the value of mv is not defined.

Reimplemented in VAPoR::NetCDFCFCollection.

virtual size_t VAPoR::NetCDFCollection::GetNumTimeSteps ( ) const
inlinevirtual

Return the number of time steps in the data collection all variables

Return the number of time steps present. The number of time steps returned is the number of unique times present, and

Note
Not all variables in a collection need have the same number of time steps
Parameters
[in]varnameName of variable
Return values
valueThe number of time steps

Definition at line 413 of file NetCDFCollection.h.

virtual size_t VAPoR::NetCDFCollection::GetNumTimeSteps ( string  varname) const
inlinevirtual

Return the number of time available for the named variable

Return the number of time steps present for the variable named by varname.

Note
Not all variables in a collection need have the same number of time steps
Parameters
[in]varnameName of variable
Return values
valueThe number of time steps. If varname is either not defined, or is defined but not time varying, 0 is returned.

Definition at line 428 of file NetCDFCollection.h.

References GetTimeDim().

virtual std::vector<string> VAPoR::NetCDFCollection::GetSpatialDimNames ( string  varname) const
virtual

Return a variable's spatial dimension names

Returns the ordered list of spatial dimension names of the named variable.

Note
The order follows the netCDF convention (slowest varying dimension is the first vector element returned), not the VDC convention.
Parameters
[in]varnameName of variable
Return values
dimnamesAn ordered vector containing the variable's spatial dimension names. If varname is not defined an empty list is returned.
virtual std::vector<size_t> VAPoR::NetCDFCollection::GetSpatialDims ( string  varname) const
virtual

Return a variable's spatial dimensions

Returns the ordered list of spatial dimensions of the named variable.

Note
The order follows the netCDF convention (slowest varying dimension is the first vector element returned), not the VDC convention.
Parameters
[in]varnameName of variable
Return values
dimsAn ordered vector containing the variables spatial dimensions. If varname is not defined a zero length vector is returned
virtual int VAPoR::NetCDFCollection::GetTime ( size_t  ts,
double &  time 
) const
virtual

Return the user time associated with a time step

This method returns the time, in user-defined coordinates, associated with the time step, ts. If no time coordinate variable was specified the user time is equivalent to the time step, ts.

Parameters
[in]tsA valid data set time step in the range from zero to GetNumTimeSteps() - 1.
[out]timeThe user time
Return values
retvalA negative int is returned on failure.
virtual size_t VAPoR::NetCDFCollection::GetTimeDim ( string  varname) const
virtual

Return a variable's time dimension

Returns time dimension of the named variable.

Parameters
[in]varnameName of variable
Return values
dimNumber of time steps (time dimension) If varname is invalid or varname is not time varying 0 is returned.

Referenced by GetNumTimeSteps().

virtual string VAPoR::NetCDFCollection::GetTimeDimName ( string  varname) const
virtual

Return a variable's time dimension name

Returns the time dimension name of the named variable.

Parameters
[in]varnameName of variable
Return values
nameA string containing the variable's time dimension name. If varname is invalid or varname is not time varying the empty string is returned.
virtual int VAPoR::NetCDFCollection::GetTimes ( string  varname,
std::vector< double > &  times 
) const
virtual

Return all the user times associated with a variable

This method returns the times, in user-defined coordinates, associated with the the variable, varname.

Parameters
[in]varnameName of variable
times]time A vector of user times ordered by time step
Return values
retvalA negative int is returned on failure.
virtual std::vector<double> VAPoR::NetCDFCollection::GetTimes ( ) const
inlinevirtual

Return all the user times for this collection

This method returns the times, in user-defined coordinates, for this data collection.

Return values
retvaltimes A vector of user times.
See also
Initialize()

Definition at line 474 of file NetCDFCollection.h.

virtual int VAPoR::NetCDFCollection::GetVariableInfo ( string  varname,
NetCDFSimple::Variable varinfo 
) const
virtual

Return the NetCDFSimple::Variable for the named variable

This method copies the contents of the NetCDFSimple::Variable class for the named variable into varinfo

Parameters
[in]varnameName of variable
Return values
retvalA negative int is returned on failure.
virtual std::vector<string> VAPoR::NetCDFCollection::GetVariableNames ( int  ndim,
bool  spatial 
) const
virtual

Return a list of variables with a given rank

Returns a list of variables having a dimension rank of ndim. If spatial is true only the variable's spatial dimension rank is examined. Thus if spatial is true, and the named variable is explicitly time varying, the time-varying dimension is not counted. For example, if a variable named 'v' is defined with 4 dimensions in the netCDF file, and the slowest varying dimension name matches a named dimension specified in Initialize() by time_dimnames, then the variable 'v' would be returned by a query with ndim==3 and spatial==true.

Parameters
[in]ndimRank of dimensions
[in]spatialOnly compare spatial dimensions against ndim
virtual int VAPoR::NetCDFCollection::Initialize ( const std::vector< string > &  files,
const std::vector< string > &  time_dimnames,
const std::vector< string > &  time_coordvar 
)
virtual

Initialze a new collection

Variables contained in the netCDF files may be explicitly time-varying (i.e. have a time dimension defined), or their time step may be determined implicitly by which file they are contained in.

The time ordering of time-varying variables is determined by:

  1. A 1D time coordinate variable, if it exists
  2. A time dimension, if it exists
  3. The ordering of the files in files in which the variable occurs
Parameters
[in]filesA list of file containing time-varying 1D, 2D, and 3D variables. In the absense of an explicit time dimension, or time coordinate variable, the ordering of the files determines the the time steps of the variables contained therein.
[in]time_dimnamesA list of netCDF time dimensions. A variable whose slowest varying dimension name matches a name in time_dimnames is an explict time-varying variable with a time dimension.
[in]time_coordvarThe name of a coordinate variable containing time data. If a 1D variable with a name given by time_coordvar exists, this variable will be used to determine the time associated with each time step of a variable.
void VAPoR::NetCDFCollection::InstallDerivedVar ( string  varname,
DerivedVar derivedVar 
)
inline

Definition at line 779 of file NetCDFCollection.h.

virtual bool VAPoR::NetCDFCollection::IsDerivedVar ( string  varname) const
inlinevirtual

Returns true if the named variable is a derived variable.

This method returns true if the variable named by varname is derived from other variables in the data collection.

Parameters
[in]varnameA variable name
Return values
boolReturns true if varname is a derived variable.

Definition at line 184 of file NetCDFCollection.h.

virtual bool VAPoR::NetCDFCollection::IsStaggeredDim ( string  dimname) const
virtual

Returns true if the specified dimension is staggered

If the dimension named by dimname is a staggered dimension, true is returned

Parameters
[in]dimnameName of dimension
See also
SetStaggeredDims()
virtual bool VAPoR::NetCDFCollection::IsStaggeredVar ( string  varname) const
virtual

Returns true if the specified variable has any staggered dimensions

If the variabled named by varname has any staggered dimensions, true is returned

Parameters
[in]varnameName of variable
Return values
booleanindicating where variable varname has any staggered dimensions.
See also
SetStaggeredDims()
virtual bool VAPoR::NetCDFCollection::IsTimeVarying ( string  varname) const
virtual

Return true if variable is time varying

Returns true if the variable named by varname has a time varying coordinate

Parameters
[in]varnameName of variable
virtual int VAPoR::NetCDFCollection::OpenRead ( size_t  ts,
string  varname 
)
virtual

Open the named variable for reading

This method prepares a netCDF variable, indicated by a variable name and time step pair, for subsequent read operations by methods of this class. A small, non-negative integer for use in subsequent read operations is returned. The file descriptor returned by a successful call will be the lowest-numbered file descriptor not currently open for the process, starting with zero.

Parameters
[in]tsTime step of the variable to read
[in]varnameName of the variable to read
Return values
statusReturns a non-negative file descriptor on success
See also
Read(), ReadNative(), ReadSliceNative() ReadSlice()

Reimplemented in VAPoR::NetCDFCFCollection.

virtual int VAPoR::NetCDFCollection::Read ( size_t  start[],
size_t  count[],
float *  data,
int  fd = 0 
)
virtual

Read data from the currently opened variable on an unstaggered grid

Read the hyperslice defined by start and count from the currently opened variable into the buffer pointed to by data.

This method is identical in functionality to the netCDF function, nc_get_var_float, with the following two exceptions:

  1. If the opened variable has staggered dimensions, the data are resampled onto the non-staggered grid. Moreover, the region coordinates (start and count) should be specified in the non-staggered coordinates.
  2. If the currently opened variable is explicitly time-varying (has a time-varying dimension), only the spatial dimensions should be provied by start and count. I.e. if the variable contains n dimensions in the netCDF file, only the n-1 fastest-varying (spatial) dimensions should be specified.
Parameters
[in]startStart vector with one element for each dimension
[in]countCount vector with one element for each dimension
[in]fdA currently opened file descriptor returned by OpenRead().
Return values
retvalA negative int is returned on failure.
See also
SetStaggeredDims(), ReadNative(), NetCDFSimple::Read(), SetMissingValueAttName(), SetMissingValueAttName()
virtual int VAPoR::NetCDFCollection::Read ( size_t  start[],
size_t  count[],
int *  data,
int  fd = 0 
)
virtual
virtual int VAPoR::NetCDFCollection::Read ( float *  data,
int  fd = 0 
)
virtual
virtual int VAPoR::NetCDFCollection::Read ( char *  data,
int  fd = 0 
)
virtual
virtual int VAPoR::NetCDFCollection::ReadNative ( size_t  start[],
size_t  count[],
float *  data,
int  fd = 0 
)
virtual

Read data from the currently opened variable on the native grid

This method is identical to the Read() method except that staggered variables are not interpolated to the non-staggered grid. Hence, start and count should be specified in staggered coordinates if the variable is staggered, and non-staggerd coordinates if the variable is not staggered.

Parameters
[in]startStart vector with one element for each dimension
[in]countCount vector with one element for each dimension
[in]fdA currently opened file descriptor returned by OpenRead().
Return values
retvalA negative int is returned on failure.
See also
SetStaggeredDims(), NetCDFSimple::Read()
virtual int VAPoR::NetCDFCollection::ReadNative ( size_t  start[],
size_t  count[],
int *  data,
int  fd = 0 
)
virtual
virtual int VAPoR::NetCDFCollection::ReadNative ( size_t  start[],
size_t  count[],
char *  data,
int  fd = 0 
)
virtual
virtual int VAPoR::NetCDFCollection::ReadNative ( float *  data,
int  fd = 0 
)
virtual
virtual int VAPoR::NetCDFCollection::ReadNative ( int *  data,
int  fd = 0 
)
virtual
virtual int VAPoR::NetCDFCollection::ReadSlice ( float *  data,
int  fd = 0 
)
virtual

Read a 2D slice from a 2D or 3D variable

The method will read 2D slices from a 2D or 3D variable until all slices have been processed. If the variable is staggered the slices will be interpolated onto the non-staggered grid for the currently opened variable. For 3D data each call to ReadSlice() will return a subsequent slice until all slices have been processed. The total number of slices is the value of the slowest varying dimension.

Parameters
[in]fdA currently opened file descriptor returned by OpenRead().
[out]dataThe possibly resampled 2D data slice. It is the caller's responsibility to ensure that data points to sufficient space.
Return values
statusReturns 1 if successful, 0 if there are no more slices to read, and a negative integer on error.
See also
OpenRead(), Read(), SetStaggeredDims(), SetMissingValueAttName(), SetMissingValueAttName()
virtual int VAPoR::NetCDFCollection::ReadSliceNative ( float *  data,
int  fd = 0 
)
virtual

Read a 2D slice from a 2D or 3D variable on the native grid

This method is identical to ReadSlice() with the exception that if the currently opened variable is staggered, the variable will not be resampled to a non-staggered grid.

Parameters
[in]fdA currently opened file descriptor returned by OpenRead().
[out]dataThe possibly resampled 2D data slice. It is the caller's responsibility to ensure that data points to sufficient space.
Return values
statusReturns 1 if successful, 0 if there are no more slices to read, and a negative integer on error.
See also
OpenRead(), Read(), SetStaggeredDims()
void VAPoR::NetCDFCollection::RemoveDerivedVar ( string  varname)
inline

Definition at line 783 of file NetCDFCollection.h.

virtual int VAPoR::NetCDFCollection::SeekSlice ( int  offset,
int  whence,
int  fd = 0 
)
virtual

Set the variable slice position indicator

This method changes the position of the slice indicator for an open variable. Subsequent reads with ReadSlice() or ReadSliceNative() will position the slice offset based on offset. If whence is 0 then offset is added to the first variable slice. If whence is one then offset is added to the current slice position. If whence is 2 then offset is added to the last slice. If the resulting slice position, after adding offset, lies outside of the variable the offset will be mapped to the closest valid value (i.e. the first or last slice).

Parameters
[in]offsetinteger slice offset
[in]whenceone of 0, 1, 2
[in]fdA currently opened file descriptor returned by OpenRead().
Return values
Anegative int is returned if fd is not valid (an open file descriptor) or if whence is not one of 0, 1, or 2.
virtual void VAPoR::NetCDFCollection::SetMissingValueAttName ( string  attname)
inlinevirtual

Identify missing value variable attribute name

This method informs the class instance of the name of a netCDF variable attribute, if one exists, that contains the missing value for the variable. During interpolation of staggered variables the missing value is needed for correct processing

Parameters
attnameName of netCDF variable attribute specifying the missing value

Definition at line 688 of file NetCDFCollection.h.

virtual void VAPoR::NetCDFCollection::SetStaggeredDims ( const std::vector< string >  dimnames)
inlinevirtual

Identify staggered dimensions

This method informs the class instance of any staggered dimensions. Class methods that read variable data will use the staggered dimension list to identify staggered variables and may interpolate the data to a non staggered grid

Parameters
dimnamesA list of staggered netCDF dimension names

Definition at line 674 of file NetCDFCollection.h.

virtual bool VAPoR::NetCDFCollection::VariableExists ( string  varname) const
virtual

Return a boolean indicating whether a variable exists in the data collection.

This method returns true if the variable named by varname is contained in the data collection. The variable may be present inside of a netCDF file, or may be a variable derived the the NetCDFCFCollection class. In the latter case all native variables used to construct varname must also be present.

Parameters
[in]varnameA netCDF variable name
Return values
boolReturns true if varname is contained any one of the netCDF files used to instantiate the class, or if varname is a derived variable.
See also
GetTimes(), GetVariables()
virtual bool VAPoR::NetCDFCollection::VariableExists ( size_t  ts,
string  varname 
) const
virtual

Return a boolean indicating whether a variable is defined for a particular time step.

This method returns true if the variable named by varname is contained in the data collection and defined for time step ts. The variable may be present inside of a netCDF file, or may be a variable derived the the NetCDFCFCollection class. In the latter case all native variables used to construct varname must also be present.

Parameters
[in]tsA valid data set time step in the range from zero to GetNumTimeSteps() - 1.
[in]varnameA netCDF variable name
Return values
boolReturns true if varname is contained any one of the netCDF files used to instantiate the class, or if varname is a derived variable.
See also
GetTimes(), GetNumTimeSteps(), GetVariables()

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  o,
const NetCDFCollection ncdfc 
)
friend

The documentation for this class was generated from the following file: