|
LRAUV
revA
|
A very compact, very simple netCDF reader with a minimal feature set. More...
#include <NetCdfReader.h>


Public Member Functions | |
| virtual | ~NetCdfReader () |
| Destructor. More... | |
| bool | isOk () const |
| Indicates intialization success. More... | |
| bool | read (void *assignTo, const NetCdfType assignType, const NetCdfVar &var, const size_t indices[]) |
| Reads the value of the variable at the indices as the indicated type Returns true if no error. More... | |
| bool | read1D (void *assignTo, const NetCdfType assignType, const NetCdfVar &var, const unsigned long index1) |
| Reads the value of the variable at the 1D index as the specified type Returns true if no error. More... | |
| bool | read2D (void *assignTo, const NetCdfType assignType, const NetCdfVar &var, const unsigned long index1, const unsigned long index2) |
| Reads the value of the variable at the 2D index as the specified type Returns true if no error. More... | |
| bool | read3D (void *assignTo, const NetCdfType assignType, const NetCdfVar &var, const unsigned long index1, const unsigned long index2, const unsigned long index3) |
| Reads the value of the variable at the 3D index as the specified type Returns true if no error. More... | |
| bool | read4D (void *assignTo, const NetCdfType assignType, const NetCdfVar &var, const unsigned long index1, const unsigned long index2, const unsigned long index3, const unsigned long index4) |
| Reads the value of the variable at the 4D index as the specified type Returns true if no error. More... | |
| bool | read1DArray (void *assignTo, const NetCdfType assignType, const NetCdfVar &var, const unsigned long index1a, const unsigned long index1b) |
| Reads a 1D range of the variable between a pair of indices (a <= index <= b) into an existing 1D array of the specified type Returns true if no error. More... | |
| bool | read2DArray (void *assignTo, const NetCdfType assignType, const NetCdfVar &var, const unsigned long index1a, const unsigned long index1b, const unsigned long index2a, const unsigned long index2b) |
| Reads a 2D range of the variable between 2 pairs of indices (a <= index <= b) into an existing 2D array of the specified type Returns true if no error. More... | |
| bool | read3DArray (void *assignTo, const NetCdfType assignType, const NetCdfVar &var, const unsigned long index1a, const unsigned long index1b, const unsigned long index2a, const unsigned long index2b, const unsigned long index3a, const unsigned long index3b) |
| Reads a 3D range of the variable between 3 pairs of indices (a <= index <= b) into an existing 3D array of the specified type Returns true if no error. More... | |
| bool | read4DArray (void *assignTo, const NetCdfType assignType, const NetCdfVar &var, const unsigned long index1a, const unsigned long index1b, const unsigned long index2a, const unsigned long index2b, const unsigned long index3a, const unsigned long index3b, const unsigned long index4a, const unsigned long index4b) |
| Reads a 4D range of the variable between 4 pairs of indices (a <= index <= b) into an existing 3D array of the specified type Returns true if no error. More... | |
| bool | readStr (Str &assignTo, const NetCdfAtt &att) |
| Reads the value of the attribute as a Str Returns true if no error. More... | |
Public Member Functions inherited from NetCdf | |
| virtual | ~NetCdf () |
| Destructor. More... | |
| const NetCdfDimArray & | getDimArray () |
| Returns the dimensions. More... | |
| const NetCdfAtts & | getGlobalAtts () |
| Returns the global attributes. More... | |
| const NetCdfVars & | getVars () |
| Returns the variables. More... | |
| NetCdfDim * | findDim (const Str &name) |
| Finds a dimension by name Returns NULL if error. More... | |
| NetCdfAtt * | findAtt (const Str &name) |
| Finds a global attribute by name NetCdfAtt* invalidValue_;. More... | |
| NetCdfVar * | findVar (const Str &name) |
| Finds a variable by name Returns NULL if error. More... | |
| NetCdfAtt * | findAtt (NetCdfVar &var, const Str &name) |
| Finds a variable's attribute by name Returns NULL if error. More... | |
| const char * | status () |
Static Public Member Functions | |
| static NetCdfReader * | NewNetCdfReader (const char *fileName) |
| Returns an newNetCdfReader of a NetCdfReader for a file. More... | |
Protected Member Functions | |
| NetCdfReader (const char *fileName) | |
| Protected Constructor. More... | |
| bool | initialize (const char *fileName) |
| Opens a NetCdfReader for a file Returns true if no error. More... | |
Protected Member Functions inherited from NetCdf | |
| NetCdf () | |
| Protected constructor. More... | |
| NetCdfDim * | findDim (NetCdfDims &dims, const Str &name) |
| Finds a dimension by name in the set of NetCdfDims Returns NULL if error. More... | |
| NetCdfAtt * | findAtt (NetCdfAtts &atts, const Str &name) |
| Finds a global attribute by name in the set of NetCdfAtts Returns NULL if error. More... | |
| NetCdfVar * | findVar (NetCdfVars &vars, const Str &name) |
| Finds a variable by name in the set of NetCdfVars Returns NULL if error. More... | |
Protected Attributes | |
| bool | ok_ |
Protected Attributes inherited from NetCdf | |
| int | status_ |
| int | ncId_ |
| NetCdfDimArray | dimArray_ |
| NetCdfDims | dims_ |
| NetCdfAtts | gatts_ |
| NetCdfVarArray | varArray_ |
| NetCdfVars | vars_ |
Additional Inherited Members | |
Public Types inherited from NetCdf | |
| enum | NetCdfType { NC_ABSENT_TYPE = 0, NC_BYTE_TYPE = NC_BYTE, NC_CHAR_TYPE = NC_CHAR, NC_SHORT_TYPE = NC_SHORT, NC_INT_TYPE = NC_INT, NC_FLOAT_TYPE = NC_FLOAT, NC_DOUBLE_TYPE = NC_DOUBLE, NC_UBYTE_TYPE = NC_UBYTE, NC_USHORT_TYPE = NC_USHORT, NC_UINT_TYPE = NC_UINT, NC_INT64_TYPE = NC_INT64, NC_UINT64_TYPE = NC_UINT64, NC_STRING_TYPE = NC_STRING } |
| typedef FastMap< const Str, NetCdfDim * > | NetCdfDims |
| typedef FlexArray< NetCdfDim * > | NetCdfDimArray |
| typedef FastMap< const Str, NetCdfAtt * > | NetCdfAtts |
| typedef FastMap< const Str, NetCdfVar * > | NetCdfVars |
| typedef FlexArray< NetCdfVar * > | NetCdfVarArray |
Static Public Attributes inherited from NetCdf | |
| static unsigned int | NetCdfTypeSize_ [NC_DOUBLE_TYPE+1] = {0, 1, 1, 2, 4, 4, 8 } |
A very compact, very simple netCDF reader with a minimal feature set.
|
virtual |
Destructor.
References NetCdf::ncId_.
|
protected |
|
protected |
Opens a NetCdfReader for a file Returns true if no error.
Opens a NetCdfReader for a file.
References NetCdf::NetCdfAtt::attId_, NetCdf::NetCdfVar::atts_, NetCdf::dimArray_, NetCdf::NetCdfDim::dimId_, NetCdf::NetCdfVar::dimIds_, NetCdf::dims_, NetCdf::NetCdfDim::dimSize_, NetCdf::gatts_, NetCdf::NetCdfAtt::name_, NC_MAX_NAME, NetCdf::ncId_, NetCdf::NetCdfVar::nDims_, NetCdf::NetCdfAtt::nelems_, NetCdf::NetCdfAtt::netCdfType_, NetCdf::NetCdfVar::netCdfType_, ok_, FastMap< S, T >::put(), FlexArray< T >::set(), NetCdf::status_, NetCdf::varArray_, NetCdf::NetCdfAtt::varId_, NetCdf::NetCdfVar::varId_, and NetCdf::vars_.
Referenced by NetCdfReader().
|
inline |
|
static |
Returns an newNetCdfReader of a NetCdfReader for a file.
References isOk(), and NetCdfReader().
Referenced by EnvSimulator::configureSensors(), NetCdfReader_Test::testConstructorDestructor(), NetCdfReader_Test::testFindAttsDimsVars(), NetCdfReader_Test::testReadFloatVar1D(), NetCdfReader_Test::testReadFloatVar1DRange(), NetCdfReader_Test::testReadFloatVar2D(), NetCdfReader_Test::testReadFloatVar2DRange(), and NetCdfReader_Test::testReadStringAtt().
| bool NetCdfReader::read | ( | void * | assignTo, |
| const NetCdfType | assignType, | ||
| const NetCdfVar & | var, | ||
| const size_t | indices[] | ||
| ) |
Reads the value of the variable at the indices as the indicated type Returns true if no error.
References NetCdf::NC_BYTE_TYPE, NetCdf::NC_CHAR_TYPE, NetCdf::NC_DOUBLE_TYPE, NetCdf::NC_FLOAT_TYPE, NetCdf::NC_INT64_TYPE, NetCdf::NC_INT_TYPE, NetCdf::NC_SHORT_TYPE, NetCdf::NC_STRING_TYPE, NetCdf::NC_UBYTE_TYPE, NetCdf::NC_UINT64_TYPE, NetCdf::NC_UINT_TYPE, NetCdf::NC_USHORT_TYPE, NetCdf::ncId_, NetCdf::status_, and NetCdf::NetCdfVar::varId_.
| bool NetCdfReader::read1D | ( | void * | assignTo, |
| const NetCdfType | assignType, | ||
| const NetCdfVar & | var, | ||
| const unsigned long | index1 | ||
| ) |
Reads the value of the variable at the 1D index as the specified type Returns true if no error.
Reads the value of the variable at the 1D index as the indicated type Returns true if no error.
References read().
Referenced by read1DArray(), and read2D().
| bool NetCdfReader::read1DArray | ( | void * | assignTo, |
| const NetCdfType | assignType, | ||
| const NetCdfVar & | var, | ||
| const unsigned long | index1a, | ||
| const unsigned long | index1b | ||
| ) |
Reads a 1D range of the variable between a pair of indices (a <= index <= b) into an existing 1D array of the specified type Returns true if no error.
Reads a 1D range of the variable between a pair of indices (a <= index <= b) into an existing 1D array of the indicated type Returns true if no error.
References NetCdf::NetCdfTypeSize_, and read1D().
Referenced by EnvSimulator::configureSensors().
| bool NetCdfReader::read2D | ( | void * | assignTo, |
| const NetCdfType | assignType, | ||
| const NetCdfVar & | var, | ||
| const unsigned long | index1, | ||
| const unsigned long | index2 | ||
| ) |
Reads the value of the variable at the 2D index as the specified type Returns true if no error.
Reads the value of the variable at the 2D index as the indicated type Returns true if no error.
References NetCdf::NetCdfVar::nDims_, read(), and read1D().
Referenced by read2DArray(), and read3D().
| bool NetCdfReader::read2DArray | ( | void * | assignTo, |
| const NetCdfType | assignType, | ||
| const NetCdfVar & | var, | ||
| const unsigned long | index1a, | ||
| const unsigned long | index1b, | ||
| const unsigned long | index2a, | ||
| const unsigned long | index2b | ||
| ) |
Reads a 2D range of the variable between 2 pairs of indices (a <= index <= b) into an existing 2D array of the specified type Returns true if no error.
Reads a 2D range of the variable between 2 pairs of indices (a <= index <= b) into an existing 2D array of the indicated type Returns true if no error.
References NetCdf::NetCdfTypeSize_, and read2D().
Referenced by NetCdfReader_Test::testReadFloatVar2DRange().
| bool NetCdfReader::read3D | ( | void * | assignTo, |
| const NetCdfType | assignType, | ||
| const NetCdfVar & | var, | ||
| const unsigned long | index1, | ||
| const unsigned long | index2, | ||
| const unsigned long | index3 | ||
| ) |
Reads the value of the variable at the 3D index as the specified type Returns true if no error.
Reads the value of the variable at the 3D index as the indicated type Returns true if no error.
References NetCdf::NetCdfVar::nDims_, read(), and read2D().
Referenced by read3DArray(), and read4D().
| bool NetCdfReader::read3DArray | ( | void * | assignTo, |
| const NetCdfType | assignType, | ||
| const NetCdfVar & | var, | ||
| const unsigned long | index1a, | ||
| const unsigned long | index1b, | ||
| const unsigned long | index2a, | ||
| const unsigned long | index2b, | ||
| const unsigned long | index3a, | ||
| const unsigned long | index3b | ||
| ) |
Reads a 3D range of the variable between 3 pairs of indices (a <= index <= b) into an existing 3D array of the specified type Returns true if no error.
Reads a 3D range of the variable between 3 pairs of indices (a <= index <= b) into an existing 3D array of the indicated type Returns true if no error.
References NetCdf::NetCdfTypeSize_, and read3D().
| bool NetCdfReader::read4D | ( | void * | assignTo, |
| const NetCdfType | assignType, | ||
| const NetCdfVar & | var, | ||
| const unsigned long | index1, | ||
| const unsigned long | index2, | ||
| const unsigned long | index3, | ||
| const unsigned long | index4 | ||
| ) |
Reads the value of the variable at the 4D index as the specified type Returns true if no error.
Reads the value of the variable at the 4D index as the indicated type Returns true if no error.
References NetCdf::NetCdfVar::nDims_, read(), and read3D().
Referenced by read4DArray().
| bool NetCdfReader::read4DArray | ( | void * | assignTo, |
| const NetCdfType | assignType, | ||
| const NetCdfVar & | var, | ||
| const unsigned long | index1a, | ||
| const unsigned long | index1b, | ||
| const unsigned long | index2a, | ||
| const unsigned long | index2b, | ||
| const unsigned long | index3a, | ||
| const unsigned long | index3b, | ||
| const unsigned long | index4a, | ||
| const unsigned long | index4b | ||
| ) |
Reads a 4D range of the variable between 4 pairs of indices (a <= index <= b) into an existing 3D array of the specified type Returns true if no error.
Reads a 4D range of the variable between 4 pairs of indices (a <= index <= b) into an existing 4D array of the indicated type Returns true if no error.
References NetCdf::NetCdfTypeSize_, and read4D().
Referenced by EnvSimulator::interpolate().
Reads the value of the attribute as a Str Returns true if no error.
References Str::cStr(), NetCdf::NetCdfAtt::name_, NetCdf::ncId_, NetCdf::NetCdfAtt::nelems_, NetCdf::status_, and NetCdf::NetCdfAtt::varId_.
|
protected |
Referenced by initialize(), isOk(), and NetCdfReader().