13 #ifndef INC_netcdf_NcUtil_h
14 #define INC_netcdf_NcUtil_h
52 typename TNCT::value_type
const initValue = 0)
57 typedef typename TNCT::value_type T;
58 T* ca =
new T [ size ];
59 for ( T* pCA = ca; pCA != ca + size; ++pCA )
65 template<
class TSrc,
class TDest >
69 std::vector<TDest> & dest)
72 for ( TSrc
const * i = srcBegin; i != srcEnd; ++i )
73 dest.push_back( TDest(*i) );
77 template<
class TSrc,
class TDest >
80 std::vector<TDest> & dest,
81 std::size_t
const count)
86 typename std::vector<TDest>::iterator iDest = dest.begin();
87 for ( ; iDest != dest.end(); ++iSrc, ++iDest )
94 std::vector<T>
const & src)
96 T* dest =
new T [ src.size() ];
97 std::copy( src.begin(), src.end(), dest );
103 char**
ToCStringArray ( std::vector< std::string >
const & strVec );
108 int const groupID,
int const varID,
109 std::vector<NcDim> & ncDims);
119 std::size_t
GetTotalSize(
int const groupID,
int const varID );
120 std::size_t
GetTotalSize(
int const groupID,
int const varID,
121 std::vector< std::size_t >
const & count );
126 NcGroup
const & group,
128 std::string & name );
131 NcGroup
GetGroup ( NcFile
const & ncFile,
int const groupID );
132 NcVar
GetVar ( NcFile
const & ncFile,
int const groupID,
int const varID );
133 std::string
GetVarName(
int const groupID,
int const varID );
148 #endif // INC_netcdf_NcUtil_h
TNCT::value_type * MakeCArray(TNCT const &ncType, int const size, typename TNCT::value_type const initValue=0)
Create an empty C-ptr array from the NcType object and size.
Definition: NcUtil.h:49
ncType
Definition: NcType.h:56
T * FromVector(std::vector< T > const &src)
Create a C-array from a std::vector.
Definition: NcUtil.h:93
void GetNcDims(int const groupID, int const varID, std::vector< NcDim > &ncDims)
Get the dimensions for a variable as vector of NcDim objects.
Definition: NcUtil.cpp:159
NcVar GetVar(NcFile const &ncFile, int const groupID, int const varID)
Definition: NcUtil.cpp:152
bool IsRecordVariable(int const groupID, int const varID)
Definition: NcUtil.cpp:75
char ** MakeCStringArray(int const numStrings, short const size)
Allocates array and copies strings.
Definition: NcUtil.cpp:35
char ** ToCStringArray(std::vector< std::string > const &strVec)
Definition: NcUtil.cpp:47
"NcEnum type"
Definition: NcType.h:73
void FreeCStringArray(char **&cStrArray, std::size_t const numStrings)
Definition: NcUtil.cpp:66
"NcVlen type"
Definition: NcType.h:71
bool IsAtomicType(NcType::ncType const typeClass)
true if is a netCDF atomic type
Definition: NcUtil.h:30
void GetTypeName(NcGroup const &group, NcType::ncType const typeID, std::string &name)
Gets the netCDF name of existing type object from the type ID.
Definition: NcUtil.cpp:125
std::size_t GetDimSize(int const groupID, int const varID, int const dimIndex)
Get the size of a variable's dimension.
Definition: NcUtil.cpp:177
NcGroup GetGroup(NcFile const &ncFile, int const groupID)
Get item info from netCDF ID numbers.
Definition: NcUtil.cpp:135
#define NcEXCEPTION(a_)
Definition: NcException.h:67
bool IsUserDefinedType(NcType::ncType const typeClass)
true if is a netCDF user-defined type
Definition: NcUtil.h:36
std::string GetVarName(int const groupID, int const varID)
Definition: NcUtil.cpp:143
std::size_t GetTotalSize(NcVar const &var)
Get total number of elements of data from the dimensions of a variable. throws error if netcdf error...
Definition: NcUtil.cpp:82
void ToVector(TSrc const srcBegin, TSrc const srcEnd, std::vector< TDest > &dest)
Copy a C-ptr array to a std::vector.
Definition: NcUtil.h:66
"NcCompound type"
Definition: NcType.h:74
"NcOpaque type"
Definition: NcType.h:72