diff --git a/cxx4/ncAtt.cpp_keep b/cxx4/ncAtt.cpp_keep deleted file mode 100644 index 4fd73ca..0000000 --- a/cxx4/ncAtt.cpp_keep +++ /dev/null @@ -1,158 +0,0 @@ -#include "ncAtt.h" -#include "ncGroup.h" -#include "ncCheck.h" -#include -#include - -using namespace std; -using namespace netCDF; - - -// destructor (defined even though it is virtual) -NcAtt::~NcAtt() {} - -// assignment operator -NcAtt& NcAtt::operator=(const NcAtt& rhs) -{ - if (&rhs != this) { - nullObject = rhs.nullObject; - myName = rhs.myName; - groupId = rhs.groupId; - varId =rhs.varId; - } - return *this; -} - -// Constructor generates a null object. -NcAtt::NcAtt() : - nullObject(true) -{} - -// Constructor for non-null instances. -NcAtt::NcAtt(bool nullObject): - nullObject(nullObject) -{} - -// The copy constructor. -NcAtt::NcAtt(const NcAtt& rhs): - nullObject(rhs.nullObject), - myName(rhs.myName), - groupId(rhs.groupId), - varId(rhs.varId) -{} - - -// equivalence operator -bool NcAtt::operator==(const NcAtt & rhs) const -{ - if(nullObject) - return nullObject == rhs.nullObject; - else - return myName == rhs.myName && groupId == rhs.groupId && varId == rhs.varId; -} - -// != operator -bool NcAtt::operator!=(const NcAtt & rhs) const -{ - return !(*this == rhs); -} - -// Gets parent group. -netCDF::NcGroup NcAtt::getParentGroup() const { - return netCDF::NcGroup(groupId); -} - - -// Returns the attribute type. -NcType NcAtt::getNcType() const{ - // get the attribute type identifier - // create an NcType called ncTmpwith this identifier - // get the NcType called ncTmp from a parent or current group. - - // Gets the NcType object with a given name, searching up the tree until the object is found. - groupId; - cout <<"groupID ="< -using namespace std; -using namespace netCDF::exceptions; - -namespace netCDF { - // Global comparator operator ============== - // comparator operator - bool operator<(const NcVar& lhs,const NcVar& rhs) - { - return false; - } - - // comparator operator - bool operator>(const NcVar& lhs,const NcVar& rhs) - { - return true; - } -} - -using namespace netCDF; - -// assignment operator -NcVar& NcVar::operator=(const NcVar & rhs) -{ - nullObject = rhs.nullObject; - myId = rhs.myId; - groupId = rhs.groupId; - return *this; -} - -// The copy constructor. -NcVar::NcVar(const NcVar& rhs) : - nullObject(rhs.nullObject), - myId(rhs.myId), - groupId(rhs.groupId) -{} - - -// equivalence operator -bool NcVar::operator==(const NcVar & rhs) const -{ - // simply check the netCDF id. - return (myId == rhs.myId); -} - -// != operator -bool NcVar::operator!=(const NcVar & rhs) const -{ - return !(*this == rhs); -} - -///////////////// - -// Constructors and intialization - -///////////////// - -// Constructor generates a null object. -NcVar::NcVar() : nullObject(true) {} - -// Constructor for a variable (must already exist in the netCDF file.) -NcVar::NcVar (const NcGroup& grp, const int& varId) : - nullObject (false), - myId (varId), - groupId(grp.getId()) -{} - - - -// Gets parent group. -NcGroup NcVar::getParentGroup() const { - return NcGroup(groupId); -} - - -// Get the variable id. -int NcVar::getId() const {return myId;} - -////////////////////// - -// Information about the variable type - -///////////////////// - - -// Gets the NcType object with a given name. -NcType NcVar::getType() const { - - // if this variable has not been defined, return a NULL type - if(isNull()) return NcType(); - - // first get the typeid - nc_type xtypep; - ncCheck(nc_inq_vartype(groupId,myId,&xtypep),__FILE__,__LINE__,__FUNCTION__); - - if(xtypep == ncByte.getId() ) return ncByte; - if(xtypep == ncUbyte.getId() ) return ncUbyte; - if(xtypep == ncChar.getId() ) return ncChar; - if(xtypep == ncShort.getId() ) return ncShort; - if(xtypep == ncUshort.getId() ) return ncUshort; - if(xtypep == ncInt.getId() ) return ncInt; - if(xtypep == ncUint.getId() ) return ncUint; - if(xtypep == ncInt64.getId() ) return ncInt64; - if(xtypep == ncUint64.getId() ) return ncUint64; - if(xtypep == ncFloat.getId() ) return ncFloat; - if(xtypep == ncDouble.getId() ) return ncDouble; - if(xtypep == ncString.getId() ) return ncString; - - multimap::const_iterator it; - multimap types(NcGroup(groupId).getTypes(NcGroup::ParentsAndCurrent)); - for(it=types.begin(); it!=types.end(); it++) { - if(it->second.getId() == xtypep) return it->second; - } - // we will never reach here - return true; -} - - - - - - - - -///////////////// - -// Information about Dimensions - -///////////////// - - -// Gets the number of dimensions. -int NcVar::getDimCount() const -{ - // get the number of dimensions - int dimCount; - ncCheck(nc_inq_varndims(groupId,myId, &dimCount),__FILE__,__LINE__,__FUNCTION__); - return dimCount; -} - -// Gets the set of Ncdim objects. -vector NcVar::getDims() const -{ - // get the number of dimensions - int dimCount = getDimCount(); - // create a vector of dimensions. - vector ncDims; - vector dimids(dimCount); - ncCheck(nc_inq_vardimid(groupId,myId, &dimids[0]),__FILE__,__LINE__,__FUNCTION__); - ncDims.reserve(dimCount); - for (int i=0; i ncDims = getDims(); - if((size_t)i >= ncDims.size() | i < 0) throw NcException("NcException","Index out of range",__FILE__,__LINE__,__FUNCTION__); - return ncDims[i]; -} - - -///////////////// - -// Information about Attributes - -///////////////// - - -// Gets the number of attributes. -int NcVar::getAttCount() const -{ - // get the number of attributes - int attCount; - ncCheck(nc_inq_varnatts(groupId,myId, &attCount),__FILE__,__LINE__,__FUNCTION__); - return attCount; -} - -// Gets the set of attributes. -map NcVar::getAtts() const -{ - // get the number of attributes - int attCount = getAttCount(); - // create a container of attributes. - map ncAtts; - for (int i=0; i(tmpAtt.getName(),tmpAtt)); - } - return ncAtts; -} - - -// Gets attribute by name. -NcVarAtt NcVar::getAtt(const string& name) const -{ - map attributeList = getAtts(); - map::iterator myIter; - myIter = attributeList.find(name); - if(myIter == attributeList.end()) - throw NcException("NcException","attribute '"+name+"' not found",__FILE__,__LINE__,__FUNCTION__); - return NcVarAtt(myIter->second); -} - - - -///////////////////////// - - -// Creates a new NetCDF variable attribute or if already exisiting replaces it. -NcVarAtt NcVar::putAtt(const string& name, const string& dataValues) const { - ncCheck(nc_put_att_text(groupId,myId,name.c_str(),dataValues.size(),dataValues.c_str()),__FILE__,__LINE__,__FUNCTION__); - // finally instantiate this attribute and return - return getAtt(name); -} - -// Creates a new NetCDF variable attribute or if already exisiting replaces it. -NcVarAtt NcVar::putAtt(const string& name, const NcType& type, size_t len, const unsigned char* dataValues) const { - NcType::ncType typeClass(type.getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_put_att(groupId,myId,name.c_str(),type.getId(),len,dataValues),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_put_att_uchar(groupId,myId,name.c_str(),type.getId(),len,dataValues),__FILE__,__LINE__,__FUNCTION__); - // finally instantiate this attribute and return - return getAtt(name); -} - - -// Creates a new NetCDF variable attribute or if already exisiting replaces it. -NcVarAtt NcVar::putAtt(const string& name, const NcType& type, size_t len, const signed char* dataValues) const { - NcType::ncType typeClass(type.getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_put_att(groupId,myId,name.c_str(),type.getId(),len,dataValues),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_put_att_schar(groupId,myId,name.c_str(),type.getId(),len,dataValues),__FILE__,__LINE__,__FUNCTION__); - // finally instantiate this attribute and return - return getAtt(name); -} - - - -///////////////////////////////// -// Creates a new NetCDF variable attribute or if already exisiting replaces it. -NcVarAtt NcVar::putAtt(const string& name, const NcType& type, short datumValue) const { - NcType::ncType typeClass(type.getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_put_att(groupId,myId,name.c_str(),type.getId(),1,&datumValue),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_put_att_short(groupId,myId,name.c_str(),type.getId(),1,&datumValue),__FILE__,__LINE__,__FUNCTION__); - // finally instantiate this attribute and return - return getAtt(name); -} - - -// Creates a new NetCDF variable attribute or if already exisiting replaces it. -NcVarAtt NcVar::putAtt(const string& name, const NcType& type, int datumValue) const { - NcType::ncType typeClass(type.getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_put_att(groupId,myId,name.c_str(),type.getId(),1,&datumValue),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_put_att_int(groupId,myId,name.c_str(),type.getId(),1,&datumValue),__FILE__,__LINE__,__FUNCTION__); - // finally instantiate this attribute and return - return getAtt(name); -} - -// Creates a new NetCDF variable attribute or if already exisiting replaces it. -NcVarAtt NcVar::putAtt(const string& name, const NcType& type, long datumValue) const { - NcType::ncType typeClass(type.getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_put_att(groupId,myId,name.c_str(),type.getId(),1,&datumValue),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_put_att_long(groupId,myId,name.c_str(),type.getId(),1,&datumValue),__FILE__,__LINE__,__FUNCTION__); - // finally instantiate this attribute and return - return getAtt(name); -} - -// Creates a new NetCDF variable attribute or if already exisiting replaces it. -NcVarAtt NcVar::putAtt(const string& name, const NcType& type, float datumValue) const { - NcType::ncType typeClass(type.getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_put_att(groupId,myId,name.c_str(),type.getId(),1,&datumValue),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_put_att_float(groupId,myId,name.c_str(),type.getId(),1,&datumValue),__FILE__,__LINE__,__FUNCTION__); - // finally instantiate this attribute and return - return getAtt(name); -} - - -// Creates a new NetCDF variable attribute or if already exisiting replaces it. -NcVarAtt NcVar::putAtt(const string& name, const NcType& type, double datumValue) const { - NcType::ncType typeClass(type.getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_put_att(groupId,myId,name.c_str(),type.getId(),1,&datumValue),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_put_att_double(groupId,myId,name.c_str(),type.getId(),1,&datumValue),__FILE__,__LINE__,__FUNCTION__); - // finally instantiate this attribute and return - return getAtt(name); -} - - -// Creates a new NetCDF variable attribute or if already exisiting replaces it. -NcVarAtt NcVar::putAtt(const string& name, const NcType& type, unsigned short datumValue) const { - NcType::ncType typeClass(type.getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_put_att(groupId,myId,name.c_str(),type.getId(),1,&datumValue),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_put_att_ushort(groupId,myId,name.c_str(),type.getId(),1,&datumValue),__FILE__,__LINE__,__FUNCTION__); - // finally instantiate this attribute and return - return getAtt(name); -} - -// Creates a new NetCDF variable attribute or if already exisiting replaces it. -NcVarAtt NcVar::putAtt(const string& name, const NcType& type, unsigned int datumValue) const { - NcType::ncType typeClass(type.getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_put_att(groupId,myId,name.c_str(),type.getId(),1,&datumValue),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_put_att_uint(groupId,myId,name.c_str(),type.getId(),1,&datumValue),__FILE__,__LINE__,__FUNCTION__); - // finally instantiate this attribute and return - return getAtt(name); -} - -// Creates a new NetCDF variable attribute or if already exisiting replaces it. -NcVarAtt NcVar::putAtt(const string& name, const NcType& type, long long datumValue) const { - NcType::ncType typeClass(type.getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_put_att(groupId,myId,name.c_str(),type.getId(),1,&datumValue),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_put_att_longlong(groupId,myId,name.c_str(),type.getId(),1,&datumValue),__FILE__,__LINE__,__FUNCTION__); - // finally instantiate this attribute and return - return getAtt(name); -} - - -// Creates a new NetCDF variable attribute or if already exisiting replaces it. -NcVarAtt NcVar::putAtt(const string& name, const NcType& type, unsigned long long datumValue) const { - NcType::ncType typeClass(type.getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_put_att(groupId,myId,name.c_str(),type.getId(),1,&datumValue),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_put_att_ulonglong(groupId,myId,name.c_str(),type.getId(),1,&datumValue),__FILE__,__LINE__,__FUNCTION__); - // finally instantiate this attribute and return - return getAtt(name); -} - - -///////////////////////////////// - - - - - - - - - - - -// Creates a new NetCDF variable attribute or if already exisiting replaces it. -NcVarAtt NcVar::putAtt(const string& name, const NcType& type, size_t len, const short* dataValues) const { - NcType::ncType typeClass(type.getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_put_att(groupId,myId,name.c_str(),type.getId(),len,dataValues),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_put_att_short(groupId,myId,name.c_str(),type.getId(),len,dataValues),__FILE__,__LINE__,__FUNCTION__); - // finally instantiate this attribute and return - return getAtt(name); -} - - -// Creates a new NetCDF variable attribute or if already exisiting replaces it. -NcVarAtt NcVar::putAtt(const string& name, const NcType& type, size_t len, const int* dataValues) const { - NcType::ncType typeClass(type.getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_put_att(groupId,myId,name.c_str(),type.getId(),len,dataValues),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_put_att_int(groupId,myId,name.c_str(),type.getId(),len,dataValues),__FILE__,__LINE__,__FUNCTION__); - // finally instantiate this attribute and return - return getAtt(name); -} - -// Creates a new NetCDF variable attribute or if already exisiting replaces it. -NcVarAtt NcVar::putAtt(const string& name, const NcType& type, size_t len, const long* dataValues) const { - NcType::ncType typeClass(type.getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_put_att(groupId,myId,name.c_str(),type.getId(),len,dataValues),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_put_att_long(groupId,myId,name.c_str(),type.getId(),len,dataValues),__FILE__,__LINE__,__FUNCTION__); - // finally instantiate this attribute and return - return getAtt(name); -} - -// Creates a new NetCDF variable attribute or if already exisiting replaces it. -NcVarAtt NcVar::putAtt(const string& name, const NcType& type, size_t len, const float* dataValues) const { - NcType::ncType typeClass(type.getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_put_att(groupId,myId,name.c_str(),type.getId(),len,dataValues),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_put_att_float(groupId,myId,name.c_str(),type.getId(),len,dataValues),__FILE__,__LINE__,__FUNCTION__); - // finally instantiate this attribute and return - return getAtt(name); -} - - -// Creates a new NetCDF variable attribute or if already exisiting replaces it. -NcVarAtt NcVar::putAtt(const string& name, const NcType& type, size_t len, const double* dataValues) const { - NcType::ncType typeClass(type.getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_put_att(groupId,myId,name.c_str(),type.getId(),len,dataValues),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_put_att_double(groupId,myId,name.c_str(),type.getId(),len,dataValues),__FILE__,__LINE__,__FUNCTION__); - // finally instantiate this attribute and return - return getAtt(name); -} - - -// Creates a new NetCDF variable attribute or if already exisiting replaces it. -NcVarAtt NcVar::putAtt(const string& name, const NcType& type, size_t len, const unsigned short* dataValues) const { - NcType::ncType typeClass(type.getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_put_att(groupId,myId,name.c_str(),type.getId(),len,dataValues),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_put_att_ushort(groupId,myId,name.c_str(),type.getId(),len,dataValues),__FILE__,__LINE__,__FUNCTION__); - // finally instantiate this attribute and return - return getAtt(name); -} - -// Creates a new NetCDF variable attribute or if already exisiting replaces it. -NcVarAtt NcVar::putAtt(const string& name, const NcType& type, size_t len, const unsigned int* dataValues) const { - NcType::ncType typeClass(type.getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_put_att(groupId,myId,name.c_str(),type.getId(),len,dataValues),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_put_att_uint(groupId,myId,name.c_str(),type.getId(),len,dataValues),__FILE__,__LINE__,__FUNCTION__); - // finally instantiate this attribute and return - return getAtt(name); -} - -// Creates a new NetCDF variable attribute or if already exisiting replaces it. -NcVarAtt NcVar::putAtt(const string& name, const NcType& type, size_t len, const long long* dataValues) const { - NcType::ncType typeClass(type.getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_put_att(groupId,myId,name.c_str(),type.getId(),len,dataValues),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_put_att_longlong(groupId,myId,name.c_str(),type.getId(),len,dataValues),__FILE__,__LINE__,__FUNCTION__); - // finally instantiate this attribute and return - return getAtt(name); -} - - -// Creates a new NetCDF variable attribute or if already exisiting replaces it. -NcVarAtt NcVar::putAtt(const string& name, const NcType& type, size_t len, const unsigned long long* dataValues) const { - NcType::ncType typeClass(type.getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_put_att(groupId,myId,name.c_str(),type.getId(),len,dataValues),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_put_att_ulonglong(groupId,myId,name.c_str(),type.getId(),len,dataValues),__FILE__,__LINE__,__FUNCTION__); - // finally instantiate this attribute and return - return getAtt(name); -} - - -// Creates a new NetCDF variable attribute or if already exisiting replaces it. -NcVarAtt NcVar::putAtt(const string& name, size_t len, const char** dataValues) const { - ncCheck(nc_put_att_string(groupId,myId,name.c_str(),len,dataValues),__FILE__,__LINE__,__FUNCTION__); - // finally instantiate this attribute and return - return getAtt(name); -} - -// Creates a new NetCDF variable attribute or if already exisiting replaces it. -NcVarAtt NcVar::putAtt(const string& name, const NcType& type, size_t len, const void* dataValues) const { - ncCheck(nc_put_att(groupId,myId ,name.c_str(),type.getId(),len,dataValues),__FILE__,__LINE__,__FUNCTION__); - // finally instantiate this attribute and return - return getAtt(name); -} - - - - -//////////////////// - -// Other Basic variable info - -//////////////////// - -// The name of this variable. -string NcVar::getName() const{ - char charName[NC_MAX_NAME+1]; - ncCheck(nc_inq_varname(groupId, myId, charName),__FILE__,__LINE__,__FUNCTION__); - return string(charName); -} - - -//////////////////// - -// Chunking details - -//////////////////// - - -// Sets chunking parameters. -void NcVar::setChunking(ChunkMode chunkMode, vector& chunksizes) const { - ncCheck(nc_def_var_chunking(groupId,myId,static_cast (chunkMode), &chunksizes[0]),__FILE__,__LINE__,__FUNCTION__); -} - - -// Gets the chunking parameters -void NcVar::getChunkingParameters(ChunkMode& chunkMode, vector& chunkSizes) const { - int chunkModeInt; - chunkSizes.reserve(getDimCount()); - - ncCheck(nc_inq_var_chunking(groupId,myId,&chunkModeInt, &chunkSizes[0]),__FILE__,__LINE__,__FUNCTION__); - chunkMode = static_cast (chunkModeInt); -} - - - - -//////////////////// - -// Fill details - -//////////////////// - - -// Sets the fill parameters -void NcVar::setFill(bool fillMode, void* fillValue) const { - // If fillMode is enabled, check that fillValue has a legal pointer. - if(fillMode && fillValue == NULL) - throw NcException("NcException","FillMode was set to zero but fillValue has invalid pointer",__FILE__,__LINE__,__FUNCTION__); - - ncCheck(nc_def_var_fill(groupId,myId,static_cast (!fillMode),fillValue),__FILE__,__LINE__,__FUNCTION__); -} - -// Sets the fill parameters -void NcVar::setFill(bool fillMode,const void* fillValue) const { - setFill(fillMode,const_cast(fillValue)); -} - - - -// Gets the fill parameters -void NcVar::getFillModeParameters(bool& fillMode, void* fillValue)const{ - - int fillModeInt; - ncCheck(nc_inq_var_fill(groupId,myId,&fillModeInt,fillValue),__FILE__,__LINE__,__FUNCTION__); - fillMode= static_cast (fillModeInt == 0); -} - - -//////////////////// - -// Compression details - -//////////////////// - - -// Sets the compression parameters -void NcVar::setCompression(bool enableShuffleFilter, bool enableDeflateFilter, int deflateLevel) const { - - // Check that the deflate level is legal - if(enableDeflateFilter & (deflateLevel < 0 | deflateLevel >9)) - throw NcException("NcException","The deflateLevel must be set between 0 and 9.",__FILE__,__LINE__,__FUNCTION__); - - ncCheck(nc_def_var_deflate(groupId,myId, - static_cast (enableShuffleFilter), - static_cast (enableDeflateFilter), - deflateLevel),__FILE__,__LINE__,__FUNCTION__); -} - - -// Gets the compression parameters -void NcVar::getCompressionParameters(bool& shuffleFilterEnabled, bool& deflateFilterEnabled, int& deflateLevel) const { - - int enableShuffleFilterInt; - int enableDeflateFilterInt; - ncCheck(nc_inq_var_deflate(groupId,myId, - &enableShuffleFilterInt, - &enableDeflateFilterInt, - &deflateLevel),__FILE__,__LINE__,__FUNCTION__); - shuffleFilterEnabled = static_cast (enableShuffleFilterInt); - deflateFilterEnabled = static_cast (enableDeflateFilterInt); -} - - - -//////////////////// - -// Endianness details - -//////////////////// - - -// Sets the endianness of the variable. -void NcVar::setEndianness(EndianMode endianMode) const { - - ncCheck(nc_def_var_endian(groupId,myId,static_cast (endianMode)),__FILE__,__LINE__,__FUNCTION__); -} - - -// Gets the endianness of the variable. -NcVar::EndianMode NcVar::getEndianness() const { - - int endianInt; - ncCheck(nc_inq_var_endian(groupId,myId,&endianInt),__FILE__,__LINE__,__FUNCTION__); - return static_cast (endianInt); -} - - - -//////////////////// - -// Checksum details - -//////////////////// - - -// Sets the checksum parameters of a variable. -void NcVar::setChecksum(ChecksumMode checksumMode) const { - ncCheck(nc_def_var_fletcher32(groupId,myId,static_cast (checksumMode)),__FILE__,__LINE__,__FUNCTION__); -} - - -// Gets the checksum parameters of the variable. -NcVar::ChecksumMode NcVar::getChecksum() const { - int checksumInt; - ncCheck(nc_inq_var_fletcher32(groupId,myId,&checksumInt),__FILE__,__LINE__,__FUNCTION__); - return static_cast (checksumInt); -} - - - - -//////////////////// - -// renaming the variable - -//////////////////// - -void NcVar::rename( const string& newname ) const -{ - ncCheck(nc_rename_var(groupId,myId,newname.c_str()),__FILE__,__LINE__,__FUNCTION__); -} - - - - - -//////////////////// - -// data writing - -//////////////////// - -// Writes the entire data into the netCDF variable. -void NcVar::putVar(const char* dataValues) const { - NcType::ncType typeClass(getType().getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_put_var(groupId, myId,dataValues),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_put_var_text(groupId, myId,dataValues),__FILE__,__LINE__,__FUNCTION__); -} -// Writes the entire data into the netCDF variable. -void NcVar::putVar(const unsigned char* dataValues) const { - NcType::ncType typeClass(getType().getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_put_var(groupId, myId,dataValues),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_put_var_uchar(groupId, myId,dataValues),__FILE__,__LINE__,__FUNCTION__); -} -// Writes the entire data into the netCDF variable. -void NcVar::putVar(const signed char* dataValues) const { - NcType::ncType typeClass(getType().getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_put_var(groupId, myId,dataValues),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_put_var_schar(groupId, myId,dataValues),__FILE__,__LINE__,__FUNCTION__); -} -// Writes the entire data into the netCDF variable. -void NcVar::putVar(const short* dataValues) const { - NcType::ncType typeClass(getType().getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_put_var(groupId, myId,dataValues),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_put_var_short(groupId, myId,dataValues),__FILE__,__LINE__,__FUNCTION__); -} -// Writes the entire data into the netCDF variable. -void NcVar::putVar(const int* dataValues) const { - NcType::ncType typeClass(getType().getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_put_var(groupId, myId,dataValues),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_put_var_int(groupId, myId,dataValues),__FILE__,__LINE__,__FUNCTION__); -} -// Writes the entire data into the netCDF variable. -void NcVar::putVar(const long* dataValues) const { - NcType::ncType typeClass(getType().getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_put_var(groupId, myId,dataValues),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_put_var_long(groupId, myId,dataValues),__FILE__,__LINE__,__FUNCTION__); -} -// Writes the entire data into the netCDF variable. -void NcVar::putVar(const float* dataValues) const { - NcType::ncType typeClass(getType().getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_put_var(groupId, myId,dataValues),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_put_var_float(groupId, myId,dataValues),__FILE__,__LINE__,__FUNCTION__); -} -// Writes the entire data into the netCDF variable. -void NcVar::putVar(const double* dataValues) const { - NcType::ncType typeClass(getType().getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_put_var(groupId, myId,dataValues),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_put_var_double(groupId, myId,dataValues),__FILE__,__LINE__,__FUNCTION__); -} -// Writes the entire data into the netCDF variable. -void NcVar::putVar(const unsigned short* dataValues) const { - NcType::ncType typeClass(getType().getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_put_var(groupId, myId,dataValues),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_put_var_ushort(groupId, myId,dataValues),__FILE__,__LINE__,__FUNCTION__); -} -// Writes the entire data into the netCDF variable. -void NcVar::putVar(const unsigned int* dataValues) const { - NcType::ncType typeClass(getType().getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_put_var(groupId, myId,dataValues),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_put_var_uint(groupId, myId,dataValues),__FILE__,__LINE__,__FUNCTION__); -} -// Writes the entire data into the netCDF variable. -void NcVar::putVar(const long long* dataValues) const { - NcType::ncType typeClass(getType().getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_put_var(groupId, myId,dataValues),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_put_var_longlong(groupId, myId,dataValues),__FILE__,__LINE__,__FUNCTION__); -} -// Writes the entire data into the netCDF variable. -void NcVar::putVar(const unsigned long long* dataValues) const { - NcType::ncType typeClass(getType().getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_put_var(groupId, myId,dataValues),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_put_var_ulonglong(groupId, myId,dataValues),__FILE__,__LINE__,__FUNCTION__); -} -// Writes the entire data into the netCDF variable. -void NcVar::putVar(const char** dataValues) const { - NcType::ncType typeClass(getType().getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_put_var(groupId, myId,dataValues),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_put_var_string(groupId, myId,dataValues),__FILE__,__LINE__,__FUNCTION__); -} -// Writes the entire data into the netCDF variable with no data conversion. -void NcVar::putVar(const void* dataValues) const { - ncCheck(nc_put_var(groupId, myId,dataValues),__FILE__,__LINE__,__FUNCTION__); -} - - -/////////////////// -// Writes a single datum value into the netCDF variable. -void NcVar::putVar(const vector& index, const char* datumValue) const { - NcType::ncType typeClass(getType().getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_put_var1(groupId, myId,&index[0],datumValue),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_put_var1_text(groupId, myId,&index[0],datumValue),__FILE__,__LINE__,__FUNCTION__); -} -// Writes a single datum value into the netCDF variable. -void NcVar::putVar(const vector& index, const unsigned char* datumValue) const { - NcType::ncType typeClass(getType().getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_put_var1(groupId, myId,&index[0],datumValue),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_put_var1_uchar(groupId, myId,&index[0],datumValue),__FILE__,__LINE__,__FUNCTION__); -} -// Writes a single datum value into the netCDF variable. -void NcVar::putVar(const vector& index, const signed char* datumValue) const { - NcType::ncType typeClass(getType().getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_put_var1(groupId, myId,&index[0],datumValue),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_put_var1_schar(groupId, myId,&index[0],datumValue),__FILE__,__LINE__,__FUNCTION__); -} -// Writes a single datum value into the netCDF variable. -void NcVar::putVar(const vector& index, const short* datumValue) const { - NcType::ncType typeClass(getType().getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_put_var1(groupId, myId,&index[0],datumValue),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_put_var1_short(groupId, myId,&index[0],datumValue),__FILE__,__LINE__,__FUNCTION__); -} -// Writes a single datum value into the netCDF variable. -void NcVar::putVar(const vector& index, const int* datumValue) const { - NcType::ncType typeClass(getType().getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_put_var1(groupId, myId,&index[0],datumValue),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_put_var1_int(groupId, myId,&index[0],datumValue),__FILE__,__LINE__,__FUNCTION__); -} -// Writes a single datum value into the netCDF variable. -void NcVar::putVar(const vector& index, const long* datumValue) const { - NcType::ncType typeClass(getType().getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_put_var1(groupId, myId,&index[0],datumValue),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_put_var1_long(groupId, myId,&index[0],datumValue),__FILE__,__LINE__,__FUNCTION__); -} -// Writes a single datum value into the netCDF variable. -void NcVar::putVar(const vector& index, const float* datumValue) const { - NcType::ncType typeClass(getType().getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_put_var1(groupId, myId,&index[0],datumValue),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_put_var1_float(groupId, myId,&index[0],datumValue),__FILE__,__LINE__,__FUNCTION__); -} -// Writes a single datum value into the netCDF variable. -void NcVar::putVar(const vector& index, const double* datumValue) const { - NcType::ncType typeClass(getType().getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_put_var1(groupId, myId,&index[0],datumValue),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_put_var1_double(groupId, myId,&index[0],datumValue),__FILE__,__LINE__,__FUNCTION__); -} -// Writes a single datum value into the netCDF variable. -void NcVar::putVar(const vector& index, const unsigned short* datumValue) const { - NcType::ncType typeClass(getType().getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_put_var1(groupId, myId,&index[0],datumValue),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_put_var1_ushort(groupId, myId,&index[0],datumValue),__FILE__,__LINE__,__FUNCTION__); -} -// Writes a single datum value into the netCDF variable. -void NcVar::putVar(const vector& index, const unsigned int* datumValue) const { - NcType::ncType typeClass(getType().getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_put_var1(groupId, myId,&index[0],datumValue),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_put_var1_uint(groupId, myId,&index[0],datumValue),__FILE__,__LINE__,__FUNCTION__); -} -// Writes a single datum value into the netCDF variable. -void NcVar::putVar(const vector& index, const long long* datumValue) const { - NcType::ncType typeClass(getType().getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_put_var1(groupId, myId,&index[0],datumValue),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_put_var1_longlong(groupId, myId,&index[0],datumValue),__FILE__,__LINE__,__FUNCTION__); -} -// Writes a single datum value into the netCDF variable. -void NcVar::putVar(const vector& index, const unsigned long long* datumValue) const { - NcType::ncType typeClass(getType().getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_put_var1(groupId, myId,&index[0],datumValue),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_put_var1_ulonglong(groupId, myId,&index[0],datumValue),__FILE__,__LINE__,__FUNCTION__); -} -// Writes a single datum value into the netCDF variable. -void NcVar::putVar(const vector& index, const char** datumValue) const { - NcType::ncType typeClass(getType().getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_put_var1(groupId, myId,&index[0],datumValue),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_put_var1_string(groupId, myId,&index[0],datumValue),__FILE__,__LINE__,__FUNCTION__); -} -// Writes a single datum value into the netCDF variable with no data conversion. -void NcVar::putVar(const vector& index, const void* datumValue) const { - ncCheck(nc_put_var1(groupId, myId,&index[0],datumValue),__FILE__,__LINE__,__FUNCTION__); -} - - -//////////////////// - -// Writes an array of values into the netCDF variable. -void NcVar::putVar(const vector& startp, const vector& countp, const char* dataValues) const { - NcType::ncType typeClass(getType().getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_put_vara(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_put_vara_text(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__,__FUNCTION__); -} -// Writes an array of values into the netCDF variable. -void NcVar::putVar(const vector& startp, const vector& countp, const unsigned char* dataValues) const { - NcType::ncType typeClass(getType().getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_put_vara(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_put_vara_uchar(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__,__FUNCTION__); -} -// Writes an array of values into the netCDF variable. -void NcVar::putVar(const vector& startp, const vector& countp, const signed char* dataValues) const { - NcType::ncType typeClass(getType().getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_put_vara(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_put_vara_schar(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__,__FUNCTION__); -} -// Writes an array of values into the netCDF variable. -void NcVar::putVar(const vector& startp, const vector& countp, const short* dataValues) const { - NcType::ncType typeClass(getType().getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_put_vara(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_put_vara_short(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__,__FUNCTION__); -} -// Writes an array of values into the netCDF variable. -void NcVar::putVar(const vector& startp, const vector& countp, const int* dataValues) const { - NcType::ncType typeClass(getType().getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_put_vara(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_put_vara_int(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__,__FUNCTION__); -} -// Writes an array of values into the netCDF variable. -void NcVar::putVar(const vector& startp, const vector& countp, const long* dataValues) const { - NcType::ncType typeClass(getType().getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_put_vara(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_put_vara_long(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__,__FUNCTION__); -} -// Writes an array of values into the netCDF variable. -void NcVar::putVar(const vector& startp, const vector& countp, const float* dataValues) const { - NcType::ncType typeClass(getType().getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_put_vara(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_put_vara_float(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__,__FUNCTION__); -} -// Writes an array of values into the netCDF variable. -void NcVar::putVar(const vector& startp, const vector& countp, const double* dataValues) const { - NcType::ncType typeClass(getType().getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_put_vara(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_put_vara_double(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__,__FUNCTION__); -} -// Writes an array of values into the netCDF variable. -void NcVar::putVar(const vector& startp, const vector& countp, const unsigned short* dataValues) const { - NcType::ncType typeClass(getType().getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_put_vara(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_put_vara_ushort(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__,__FUNCTION__); -} -// Writes an array of values into the netCDF variable. -void NcVar::putVar(const vector& startp, const vector& countp, const unsigned int* dataValues) const { - NcType::ncType typeClass(getType().getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_put_vara(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_put_vara_uint(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__,__FUNCTION__); -} -// Writes an array of values into the netCDF variable. -void NcVar::putVar(const vector& startp, const vector& countp, const long long* dataValues) const { - NcType::ncType typeClass(getType().getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_put_vara(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_put_vara_longlong(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__,__FUNCTION__); -} -// Writes an array of values into the netCDF variable. -void NcVar::putVar(const vector& startp, const vector& countp, const unsigned long long* dataValues) const { - NcType::ncType typeClass(getType().getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_put_vara(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_put_vara_ulonglong(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__,__FUNCTION__); -} -// Writes an array of values into the netCDF variable. -void NcVar::putVar(const vector& startp, const vector& countp, const char** dataValues) const { - NcType::ncType typeClass(getType().getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_put_vara(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_put_vara_string(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__,__FUNCTION__); -} -// Writes an array of values into the netCDF variable with no data conversion. -void NcVar::putVar(const vector& startp, const vector& countp, const void* dataValues) const { - ncCheck(nc_put_vara(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__,__FUNCTION__); -} - - - -//////////////////// - -// Writes a set of subsampled array values into the netCDF variable. -void NcVar::putVar(const vector& startp, const vector&countp, const vector& stridep, const char* dataValues) const { - NcType::ncType typeClass(getType().getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_put_vars(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_put_vars_text(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__,__FUNCTION__); -} -// Writes a set of subsampled array values into the netCDF variable. -void NcVar::putVar(const vector& startp, const vector&countp, const vector& stridep, const unsigned char* dataValues) const { - NcType::ncType typeClass(getType().getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_put_vars(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_put_vars_uchar(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__,__FUNCTION__); -} -// Writes a set of subsampled array values into the netCDF variable. -void NcVar::putVar(const vector& startp, const vector&countp, const vector& stridep, const signed char* dataValues) const { - NcType::ncType typeClass(getType().getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_put_vars(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_put_vars_schar(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__,__FUNCTION__); -} -// Writes a set of subsampled array values into the netCDF variable. -void NcVar::putVar(const vector& startp, const vector&countp, const vector& stridep, const short* dataValues) const { - NcType::ncType typeClass(getType().getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_put_vars(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_put_vars_short(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__,__FUNCTION__); -} -// Writes a set of subsampled array values into the netCDF variable. -void NcVar::putVar(const vector& startp, const vector&countp, const vector& stridep, const int* dataValues) const { - NcType::ncType typeClass(getType().getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_put_vars(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_put_vars_int(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__,__FUNCTION__); -} -// Writes a set of subsampled array values into the netCDF variable. -void NcVar::putVar(const vector& startp, const vector&countp, const vector& stridep, const long* dataValues) const { - NcType::ncType typeClass(getType().getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_put_vars(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_put_vars_long(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__,__FUNCTION__); -} -// Writes a set of subsampled array values into the netCDF variable. -void NcVar::putVar(const vector& startp, const vector&countp, const vector& stridep, const float* dataValues) const { - NcType::ncType typeClass(getType().getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_put_vars(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_put_vars_float(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__,__FUNCTION__); -} -// Writes a set of subsampled array values into the netCDF variable. -void NcVar::putVar(const vector& startp, const vector&countp, const vector& stridep, const double* dataValues) const { - NcType::ncType typeClass(getType().getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_put_vars(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_put_vars_double(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__,__FUNCTION__); -} -// Writes a set of subsampled array values into the netCDF variable. -void NcVar::putVar(const vector& startp, const vector&countp, const vector& stridep, const unsigned short* dataValues) const { - NcType::ncType typeClass(getType().getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_put_vars(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_put_vars_ushort(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__,__FUNCTION__); -} -// Writes a set of subsampled array values into the netCDF variable. -void NcVar::putVar(const vector& startp, const vector&countp, const vector& stridep, const unsigned int* dataValues) const { - NcType::ncType typeClass(getType().getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_put_vars(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_put_vars_uint(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__,__FUNCTION__); -} -// Writes a set of subsampled array values into the netCDF variable. -void NcVar::putVar(const vector& startp, const vector&countp, const vector& stridep, const long long* dataValues) const { - NcType::ncType typeClass(getType().getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_put_vars(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_put_vars_longlong(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__,__FUNCTION__); -} -// Writes a set of subsampled array values into the netCDF variable. -void NcVar::putVar(const vector& startp, const vector&countp, const vector& stridep, const unsigned long long* dataValues) const { - NcType::ncType typeClass(getType().getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_put_vars(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_put_vars_ulonglong(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__,__FUNCTION__); -} -// Writes a set of subsampled array values into the netCDF variable. -void NcVar::putVar(const vector& startp, const vector&countp, const vector& stridep, const char** dataValues) const { - NcType::ncType typeClass(getType().getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_put_vars(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_put_vars_string(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__,__FUNCTION__); -} -// Writes a set of subsampled array values into the netCDF variable with no data conversion. -void NcVar::putVar(const vector& startp, const vector&countp, const vector& stridep, const void* dataValues) const { - ncCheck(nc_put_vars(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__,__FUNCTION__); -} - - -//////////////////// -// Writes a mapped array section of values into the netCDF variable. -void NcVar::putVar(const vector& startp, const vector&countp, const vector& stridep, const vector& imapp, const char* dataValues) const { - NcType::ncType typeClass(getType().getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_put_varm(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_put_varm_text(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__,__FUNCTION__); -} -// Writes a mapped array section of values into the netCDF variable. -void NcVar::putVar(const vector& startp, const vector&countp, const vector& stridep, const vector& imapp, const unsigned char* dataValues) const { - NcType::ncType typeClass(getType().getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_put_varm(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_put_varm_uchar(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__,__FUNCTION__); -} -// Writes a mapped array section of values into the netCDF variable. -void NcVar::putVar(const vector& startp, const vector&countp, const vector& stridep, const vector& imapp, const signed char* dataValues) const { - NcType::ncType typeClass(getType().getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_put_varm(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_put_varm_schar(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__,__FUNCTION__); -} -// Writes a mapped array section of values into the netCDF variable. -void NcVar::putVar(const vector& startp, const vector&countp, const vector& stridep, const vector& imapp, const short* dataValues) const { - NcType::ncType typeClass(getType().getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_put_varm(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_put_varm_short(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__,__FUNCTION__); -} -// Writes a mapped array section of values into the netCDF variable. -void NcVar::putVar(const vector& startp, const vector&countp, const vector& stridep, const vector& imapp, const int* dataValues) const { - NcType::ncType typeClass(getType().getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_put_varm(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_put_varm_int(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__,__FUNCTION__); -} -// Writes a mapped array section of values into the netCDF variable. -void NcVar::putVar(const vector& startp, const vector&countp, const vector& stridep, const vector& imapp, const long* dataValues) const { - NcType::ncType typeClass(getType().getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_put_varm(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_put_varm_long(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__,__FUNCTION__); -} -// Writes a mapped array section of values into the netCDF variable. -void NcVar::putVar(const vector& startp, const vector&countp, const vector& stridep, const vector& imapp, const float* dataValues) const { - NcType::ncType typeClass(getType().getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_put_varm(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_put_varm_float(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__,__FUNCTION__); -} -// Writes a mapped array section of values into the netCDF variable. -void NcVar::putVar(const vector& startp, const vector&countp, const vector& stridep, const vector& imapp, const double* dataValues) const { - NcType::ncType typeClass(getType().getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_put_varm(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_put_varm_double(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__,__FUNCTION__); -} -// Writes a mapped array section of values into the netCDF variable. -void NcVar::putVar(const vector& startp, const vector&countp, const vector& stridep, const vector& imapp, const unsigned short* dataValues) const { - NcType::ncType typeClass(getType().getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_put_varm(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_put_varm_ushort(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__,__FUNCTION__); -} -// Writes a mapped array section of values into the netCDF variable. -void NcVar::putVar(const vector& startp, const vector&countp, const vector& stridep, const vector& imapp, const unsigned int* dataValues) const { - NcType::ncType typeClass(getType().getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_put_varm(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_put_varm_uint(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__,__FUNCTION__); -} -// Writes a mapped array section of values into the netCDF variable. -void NcVar::putVar(const vector& startp, const vector&countp, const vector& stridep, const vector& imapp, const long long* dataValues) const { - NcType::ncType typeClass(getType().getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_put_varm(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_put_varm_longlong(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__,__FUNCTION__); -} -// Writes a mapped array section of values into the netCDF variable. -void NcVar::putVar(const vector& startp, const vector&countp, const vector& stridep, const vector& imapp, const unsigned long long* dataValues) const { - NcType::ncType typeClass(getType().getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_put_varm(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_put_varm_ulonglong(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__,__FUNCTION__); -} -// Writes a mapped array section of values into the netCDF variable. -void NcVar::putVar(const vector& startp, const vector&countp, const vector& stridep, const vector& imapp, const char** dataValues) const { - NcType::ncType typeClass(getType().getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_put_varm(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_put_varm_string(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__,__FUNCTION__); -} -// Writes a mapped array section of values into the netCDF variable with no data conversion. -void NcVar::putVar(const vector& startp, const vector&countp, const vector& stridep, const vector& imapp, const void* dataValues) const { - ncCheck(nc_put_varm(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__,__FUNCTION__); -} - - - - - -// Data reading - - - -// Reads the entire data of the netCDF variable. -void NcVar::getVar(char* dataValues) const { - NcType::ncType typeClass(getType().getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_get_var(groupId, myId,dataValues),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_get_var_text(groupId, myId,dataValues),__FILE__,__LINE__,__FUNCTION__); -} -// Reads the entire data of the netCDF variable. -void NcVar::getVar(unsigned char* dataValues) const { - NcType::ncType typeClass(getType().getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_get_var(groupId, myId,dataValues),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_get_var_uchar(groupId, myId,dataValues),__FILE__,__LINE__,__FUNCTION__); -} -// Reads the entire data of the netCDF variable. -void NcVar::getVar(signed char* dataValues) const { - NcType::ncType typeClass(getType().getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_get_var(groupId, myId,dataValues),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_get_var_schar(groupId, myId,dataValues),__FILE__,__LINE__,__FUNCTION__); -} -// Reads the entire data of the netCDF variable. -void NcVar::getVar(short* dataValues) const { - NcType::ncType typeClass(getType().getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_get_var(groupId, myId,dataValues),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_get_var_short(groupId, myId,dataValues),__FILE__,__LINE__,__FUNCTION__); -} -// Reads the entire data of the netCDF variable. -void NcVar::getVar(int* dataValues) const { - NcType::ncType typeClass(getType().getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_get_var(groupId, myId,dataValues),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_get_var_int(groupId, myId,dataValues),__FILE__,__LINE__,__FUNCTION__); -} -// Reads the entire data of the netCDF variable. -void NcVar::getVar(long* dataValues) const { - NcType::ncType typeClass(getType().getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_get_var(groupId, myId,dataValues),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_get_var_long(groupId, myId,dataValues),__FILE__,__LINE__,__FUNCTION__); -} -// Reads the entire data of the netCDF variable. -void NcVar::getVar(float* dataValues) const { - NcType::ncType typeClass(getType().getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_get_var(groupId, myId,dataValues),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_get_var_float(groupId, myId,dataValues),__FILE__,__LINE__,__FUNCTION__); -} -// Reads the entire data of the netCDF variable. -void NcVar::getVar(double* dataValues) const { - NcType::ncType typeClass(getType().getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_get_var(groupId, myId,dataValues),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_get_var_double(groupId, myId,dataValues),__FILE__,__LINE__,__FUNCTION__); -} -// Reads the entire data of the netCDF variable. -void NcVar::getVar(unsigned short* dataValues) const { - NcType::ncType typeClass(getType().getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_get_var(groupId, myId,dataValues),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_get_var_ushort(groupId, myId,dataValues),__FILE__,__LINE__,__FUNCTION__); -} -// Reads the entire data of the netCDF variable. -void NcVar::getVar(unsigned int* dataValues) const { - NcType::ncType typeClass(getType().getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_get_var(groupId, myId,dataValues),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_get_var_uint(groupId, myId,dataValues),__FILE__,__LINE__,__FUNCTION__); -} -// Reads the entire data of the netCDF variable. -void NcVar::getVar(long long* dataValues) const { - NcType::ncType typeClass(getType().getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_get_var(groupId, myId,dataValues),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_get_var_longlong(groupId, myId,dataValues),__FILE__,__LINE__,__FUNCTION__); -} -// Reads the entire data of the netCDF variable. -void NcVar::getVar(unsigned long long* dataValues) const { - NcType::ncType typeClass(getType().getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_get_var(groupId, myId,dataValues),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_get_var_ulonglong(groupId, myId,dataValues),__FILE__,__LINE__,__FUNCTION__); -} -// Reads the entire data of the netCDF variable. -void NcVar::getVar(char** dataValues) const { - NcType::ncType typeClass(getType().getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_get_var(groupId, myId,dataValues),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_get_var_string(groupId, myId,dataValues),__FILE__,__LINE__,__FUNCTION__); -} -// Reads the entire data of the netCDF variable with no data conversion. -void NcVar::getVar(void* dataValues) const { - ncCheck(nc_get_var(groupId, myId,dataValues),__FILE__,__LINE__,__FUNCTION__); -} - - - -/////////// - -// Reads a single datum value of a netCDF variable. -void NcVar::getVar(const vector& index, char* datumValue) const { - NcType::ncType typeClass(getType().getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_get_var1(groupId, myId,&index[0],datumValue),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_get_var1_text(groupId, myId,&index[0],datumValue),__FILE__,__LINE__,__FUNCTION__); -} -// Reads a single datum value of a netCDF variable. -void NcVar::getVar(const vector& index, unsigned char* datumValue) const { - NcType::ncType typeClass(getType().getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_get_var1(groupId, myId,&index[0],datumValue),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_get_var1_uchar(groupId, myId,&index[0],datumValue),__FILE__,__LINE__,__FUNCTION__); -} -// Reads a single datum value of a netCDF variable. -void NcVar::getVar(const vector& index, signed char* datumValue) const { - NcType::ncType typeClass(getType().getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_get_var1(groupId, myId,&index[0],datumValue),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_get_var1_schar(groupId, myId,&index[0],datumValue),__FILE__,__LINE__,__FUNCTION__); -} -// Reads a single datum value of a netCDF variable. -void NcVar::getVar(const vector& index, short* datumValue) const { - NcType::ncType typeClass(getType().getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_get_var1(groupId, myId,&index[0],datumValue),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_get_var1_short(groupId, myId,&index[0],datumValue),__FILE__,__LINE__,__FUNCTION__); -} -// Reads a single datum value of a netCDF variable. -void NcVar::getVar(const vector& index, int* datumValue) const { - NcType::ncType typeClass(getType().getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_get_var1(groupId, myId,&index[0],datumValue),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_get_var1_int(groupId, myId,&index[0],datumValue),__FILE__,__LINE__,__FUNCTION__); -} -// Reads a single datum value of a netCDF variable. -void NcVar::getVar(const vector& index, long* datumValue) const { - NcType::ncType typeClass(getType().getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_get_var1(groupId, myId,&index[0],datumValue),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_get_var1_long(groupId, myId,&index[0],datumValue),__FILE__,__LINE__,__FUNCTION__); -} -// Reads a single datum value of a netCDF variable. -void NcVar::getVar(const vector& index, float* datumValue) const { - NcType::ncType typeClass(getType().getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_get_var1(groupId, myId,&index[0],datumValue),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_get_var1_float(groupId, myId,&index[0],datumValue),__FILE__,__LINE__,__FUNCTION__); -} -// Reads a single datum value of a netCDF variable. -void NcVar::getVar(const vector& index, double* datumValue) const { - NcType::ncType typeClass(getType().getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_get_var1(groupId, myId,&index[0],datumValue),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_get_var1_double(groupId, myId,&index[0],datumValue),__FILE__,__LINE__,__FUNCTION__); -} -// Reads a single datum value of a netCDF variable. -void NcVar::getVar(const vector& index, unsigned short* datumValue) const { - NcType::ncType typeClass(getType().getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_get_var1(groupId, myId,&index[0],datumValue),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_get_var1_ushort(groupId, myId,&index[0],datumValue),__FILE__,__LINE__,__FUNCTION__); -} -// Reads a single datum value of a netCDF variable. -void NcVar::getVar(const vector& index, unsigned int* datumValue) const { - NcType::ncType typeClass(getType().getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_get_var1(groupId, myId,&index[0],datumValue),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_get_var1_uint(groupId, myId,&index[0],datumValue),__FILE__,__LINE__,__FUNCTION__); -} -// Reads a single datum value of a netCDF variable. -void NcVar::getVar(const vector& index, long long* datumValue) const { - NcType::ncType typeClass(getType().getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_get_var1(groupId, myId,&index[0],datumValue),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_get_var1_longlong(groupId, myId,&index[0],datumValue),__FILE__,__LINE__,__FUNCTION__); -} -// Reads a single datum value of a netCDF variable -void NcVar::getVar(const vector& index, unsigned long long* datumValue) const { - NcType::ncType typeClass(getType().getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_get_var1(groupId, myId,&index[0],datumValue),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_get_var1_ulonglong(groupId, myId,&index[0],datumValue),__FILE__,__LINE__,__FUNCTION__); -} -// Reads a single datum value of a netCDF variable. -void NcVar::getVar(const vector& index, char** datumValue) const { - NcType::ncType typeClass(getType().getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_get_var1(groupId, myId,&index[0],datumValue),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_get_var1_string(groupId, myId,&index[0],datumValue),__FILE__,__LINE__,__FUNCTION__); -} -// Reads a single datum value of a netCDF variable with no data conversion. -void NcVar::getVar(const vector& index, void* datumValue) const { - ncCheck(nc_get_var1(groupId, myId,&index[0],datumValue),__FILE__,__LINE__,__FUNCTION__); -} - - - -/////////// - -// Reads an array of values from a netCDF variable. -void NcVar::getVar(const vector& startp, const vector& countp, char* dataValues) const { - NcType::ncType typeClass(getType().getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_get_vara(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_get_vara_text(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__,__FUNCTION__); -} -// Reads an array of values from a netCDF variable. -void NcVar::getVar(const vector& startp, const vector& countp, unsigned char* dataValues) const { - NcType::ncType typeClass(getType().getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_get_vara(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_get_vara_uchar(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__,__FUNCTION__); -} -// Reads an array of values from a netCDF variable. -void NcVar::getVar(const vector& startp, const vector& countp, signed char* dataValues) const { - NcType::ncType typeClass(getType().getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_get_vara(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_get_vara_schar(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__,__FUNCTION__); -} -// Reads an array of values from a netCDF variable. -void NcVar::getVar(const vector& startp, const vector& countp, short* dataValues) const { - NcType::ncType typeClass(getType().getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_get_vara(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_get_vara_short(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__,__FUNCTION__); -} -// Reads an array of values from a netCDF variable. -void NcVar::getVar(const vector& startp, const vector& countp, int* dataValues) const { - NcType::ncType typeClass(getType().getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_get_vara(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_get_vara_int(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__,__FUNCTION__); -} -// Reads an array of values from a netCDF variable. -void NcVar::getVar(const vector& startp, const vector& countp, long* dataValues) const { - NcType::ncType typeClass(getType().getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_get_vara(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_get_vara_long(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__,__FUNCTION__); -} -// Reads an array of values from a netCDF variable. -void NcVar::getVar(const vector& startp, const vector& countp, float* dataValues) const { - NcType::ncType typeClass(getType().getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_get_vara(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_get_vara_float(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__,__FUNCTION__); -} -// Reads an array of values from a netCDF variable. -void NcVar::getVar(const vector& startp, const vector& countp, double* dataValues) const { - NcType::ncType typeClass(getType().getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_get_vara(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_get_vara_double(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__,__FUNCTION__); -} -// Reads an array of values from a netCDF variable. -void NcVar::getVar(const vector& startp, const vector& countp, unsigned short* dataValues) const { - NcType::ncType typeClass(getType().getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_get_vara(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_get_vara_ushort(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__,__FUNCTION__); -} -// Reads an array of values from a netCDF variable. -void NcVar::getVar(const vector& startp, const vector& countp, unsigned int* dataValues) const { - NcType::ncType typeClass(getType().getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_get_vara(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_get_vara_uint(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__,__FUNCTION__); -} -// Reads an array of values from a netCDF variable. -void NcVar::getVar(const vector& startp, const vector& countp, long long* dataValues) const { - NcType::ncType typeClass(getType().getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_get_vara(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_get_vara_longlong(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__,__FUNCTION__); -} -// Reads an array of values from a netCDF variable -void NcVar::getVar(const vector& startp, const vector& countp, unsigned long long* dataValues) const { - NcType::ncType typeClass(getType().getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_get_vara(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_get_vara_ulonglong(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__,__FUNCTION__); -} -// Reads an array of values from a netCDF variable. -void NcVar::getVar(const vector& startp, const vector& countp, char** dataValues) const { - NcType::ncType typeClass(getType().getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_get_vara(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_get_vara_string(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__,__FUNCTION__); -} -// Reads an array of values from a netCDF variable with no data conversion. -void NcVar::getVar(const vector& startp, const vector& countp, void* dataValues) const { - ncCheck(nc_get_vara(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__,__FUNCTION__); -} - - -/////////// - -// Reads a subsampled (strided) array section of values from a netCDF variable. -void NcVar::getVar(const vector& startp, const vector& countp, const vector& stridep, char* dataValues) const { - NcType::ncType typeClass(getType().getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_get_vars(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_get_vars_text(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__,__FUNCTION__); -} -// Reads a subsampled (strided) array section of values from a netCDF variable. -void NcVar::getVar(const vector& startp, const vector& countp, const vector& stridep, unsigned char* dataValues) const { - NcType::ncType typeClass(getType().getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_get_vars(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_get_vars_uchar(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__,__FUNCTION__); -} -// Reads a subsampled (strided) array section of values from a netCDF variable. -void NcVar::getVar(const vector& startp, const vector& countp, const vector& stridep, signed char* dataValues) const { - NcType::ncType typeClass(getType().getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_get_vars(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_get_vars_schar(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__,__FUNCTION__); -} -// Reads a subsampled (strided) array section of values from a netCDF variable. -void NcVar::getVar(const vector& startp, const vector& countp, const vector& stridep, short* dataValues) const { - NcType::ncType typeClass(getType().getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_get_vars(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_get_vars_short(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__,__FUNCTION__); -} -// Reads a subsampled (strided) array section of values from a netCDF variable. -void NcVar::getVar(const vector& startp, const vector& countp, const vector& stridep, int* dataValues) const { - NcType::ncType typeClass(getType().getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_get_vars(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_get_vars_int(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__,__FUNCTION__); -} -// Reads a subsampled (strided) array section of values from a netCDF variable. -void NcVar::getVar(const vector& startp, const vector& countp, const vector& stridep, long* dataValues) const { - NcType::ncType typeClass(getType().getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_get_vars(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_get_vars_long(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__,__FUNCTION__); -} -// Reads a subsampled (strided) array section of values from a netCDF variable. -void NcVar::getVar(const vector& startp, const vector& countp, const vector& stridep, float* dataValues) const { - NcType::ncType typeClass(getType().getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_get_vars(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_get_vars_float(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__,__FUNCTION__); -} -// Reads a subsampled (strided) array section of values from a netCDF variable. -void NcVar::getVar(const vector& startp, const vector& countp, const vector& stridep, double* dataValues) const { - NcType::ncType typeClass(getType().getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_get_vars(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_get_vars_double(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__,__FUNCTION__); -} -// Reads a subsampled (strided) array section of values from a netCDF variable. -void NcVar::getVar(const vector& startp, const vector& countp, const vector& stridep, unsigned short* dataValues) const { - NcType::ncType typeClass(getType().getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_get_vars(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_get_vars_ushort(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__,__FUNCTION__); -} -// Reads a subsampled (strided) array section of values from a netCDF variable. -void NcVar::getVar(const vector& startp, const vector& countp, const vector& stridep, unsigned int* dataValues) const { - NcType::ncType typeClass(getType().getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_get_vars(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_get_vars_uint(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__,__FUNCTION__); -} -// Reads a subsampled (strided) array section of values from a netCDF variable. -void NcVar::getVar(const vector& startp, const vector& countp, const vector& stridep, long long* dataValues) const { - NcType::ncType typeClass(getType().getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_get_vars(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_get_vars_longlong(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__,__FUNCTION__); -} -// Reads a subsampled (strided) array section of values from a netCDF variable -void NcVar::getVar(const vector& startp, const vector& countp, const vector& stridep, unsigned long long* dataValues) const { - NcType::ncType typeClass(getType().getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_get_vars(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_get_vars_ulonglong(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__,__FUNCTION__); -} -// Reads a subsampled (strided) array section of values from a netCDF variable. -void NcVar::getVar(const vector& startp, const vector& countp, const vector& stridep, char** dataValues) const { - NcType::ncType typeClass(getType().getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_get_vars(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_get_vars_string(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__,__FUNCTION__); -} -// Reads a subsampled (strided) array section of values from a netCDF variable with no data conversion. -void NcVar::getVar(const vector& startp, const vector& countp, const vector& stridep, void* dataValues) const { - ncCheck(nc_get_vars(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__,__FUNCTION__); -} - - -/////////// - -// Reads a mapped array section of values from a netCDF variable. -void NcVar::getVar(const vector& startp, const vector& countp, const vector& stridep, const vector& imapp, char* dataValues) const { - NcType::ncType typeClass(getType().getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_get_varm(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_get_varm_text(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__,__FUNCTION__); -} -// Reads a mapped array section of values from a netCDF variable. -void NcVar::getVar(const vector& startp, const vector& countp, const vector& stridep, const vector& imapp, unsigned char* dataValues) const { - NcType::ncType typeClass(getType().getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_get_varm(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_get_varm_uchar(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__,__FUNCTION__); -} -// Reads a mapped array section of values from a netCDF variable. -void NcVar::getVar(const vector& startp, const vector& countp, const vector& stridep, const vector& imapp, signed char* dataValues) const { - NcType::ncType typeClass(getType().getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_get_varm(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_get_varm_schar(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__,__FUNCTION__); -} -// Reads a mapped array section of values from a netCDF variable. -void NcVar::getVar(const vector& startp, const vector& countp, const vector& stridep, const vector& imapp, short* dataValues) const { - NcType::ncType typeClass(getType().getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_get_varm(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_get_varm_short(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__,__FUNCTION__); -} -// Reads a mapped array section of values from a netCDF variable. -void NcVar::getVar(const vector& startp, const vector& countp, const vector& stridep, const vector& imapp, int* dataValues) const { - NcType::ncType typeClass(getType().getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_get_varm(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_get_varm_int(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__,__FUNCTION__); -} -// Reads a mapped array section of values from a netCDF variable. -void NcVar::getVar(const vector& startp, const vector& countp, const vector& stridep, const vector& imapp, long* dataValues) const { - NcType::ncType typeClass(getType().getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_get_varm(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_get_varm_long(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__,__FUNCTION__); -} -// Reads a mapped array section of values from a netCDF variable. -void NcVar::getVar(const vector& startp, const vector& countp, const vector& stridep, const vector& imapp, float* dataValues) const { - NcType::ncType typeClass(getType().getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_get_varm(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_get_varm_float(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__,__FUNCTION__); -} -// Reads a mapped array section of values from a netCDF variable. -void NcVar::getVar(const vector& startp, const vector& countp, const vector& stridep, const vector& imapp, double* dataValues) const { - NcType::ncType typeClass(getType().getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_get_varm(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_get_varm_double(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__,__FUNCTION__); -} -// Reads a mapped array section of values from a netCDF variable. -void NcVar::getVar(const vector& startp, const vector& countp, const vector& stridep, const vector& imapp, unsigned short* dataValues) const { - NcType::ncType typeClass(getType().getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_get_varm(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_get_varm_ushort(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__,__FUNCTION__); -} -// Reads a mapped array section of values from a netCDF variable. -void NcVar::getVar(const vector& startp, const vector& countp, const vector& stridep, const vector& imapp, unsigned int* dataValues) const { - NcType::ncType typeClass(getType().getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_get_varm(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_get_varm_uint(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__,__FUNCTION__); -} -// Reads a mapped array section of values from a netCDF variable. -void NcVar::getVar(const vector& startp, const vector& countp, const vector& stridep, const vector& imapp, long long* dataValues) const { - NcType::ncType typeClass(getType().getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_get_varm(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_get_varm_longlong(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__,__FUNCTION__); -} -// Reads a mapped array section of values from a netCDF variable -void NcVar::getVar(const vector& startp, const vector& countp, const vector& stridep, const vector& imapp, unsigned long long* dataValues) const { - NcType::ncType typeClass(getType().getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_get_varm(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_get_varm_ulonglong(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__,__FUNCTION__); -} -// Reads a mapped array section of values from a netCDF variable. -void NcVar::getVar(const vector& startp, const vector& countp, const vector& stridep, const vector& imapp, char** dataValues) const { - NcType::ncType typeClass(getType().getTypeClass()); - if(typeClass == NcType::nc_VLEN | typeClass == NcType::nc_OPAQUE | typeClass == NcType::nc_ENUM | typeClass == NcType::nc_COMPOUND) - ncCheck(nc_get_varm(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__,__FUNCTION__); - else - ncCheck(nc_get_varm_string(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__,__FUNCTION__); -} -// Reads a mapped array section of values from a netCDF variable with no data conversion. -void NcVar::getVar(const vector& startp, const vector& countp, const vector& stridep, const vector& imapp, void* dataValues) const { - ncCheck(nc_get_varm(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__,__FUNCTION__); -} - diff --git a/cxx4/ncVar.h_keep b/cxx4/ncVar.h_keep deleted file mode 100644 index 1f13e3f..0000000 --- a/cxx4/ncVar.h_keep +++ /dev/null @@ -1,788 +0,0 @@ -#include -#include -#include -#include -#include -#include "netcdf.h" -#include "ncVarAtt.h" -#include "ncGroup.h" - -#ifndef NcVarClass -#define NcVarClass - -namespace netCDF -{ - // class NcGroup; // forward declaration. - class NcDim; // forward declaration. - // class NcVarAtt; // forward declaration. - class NcType; // forward declaration. - - //! Class represents a netCDF variable. - class NcVar - { - public: - - //! Enumeration type used for chunking specification. - enum ChunkMode - { - nc_CONTIGUOUS = NC_CONTIGUOUS, //!< Nc_CONTIGUOUS - nc_CHUNKED = NC_CHUNKED //!< Nc_CHUNKED - }; - - //! Enumeration type used for endian specification. - enum EndianMode - { - nc_ENDIAN_NATIVE = NC_ENDIAN_NATIVE, - nc_ENDIAN_LITTLE = NC_ENDIAN_LITTLE, - nc_ENDIAN_BIG = NC_ENDIAN_BIG - }; - - //! Enumeration type used for checksum specification. - enum ChecksumMode - { - nc_NOCHECKSUM = NC_NOCHECKSUM, - nc_FLETCHER32 = NC_FLETCHER32 - }; - - //! destructor - ~NcVar(){}; - - //! Constructor generates a \ref isNull "null object". - NcVar (); - - //! Constructor for a variable - /*! - The variable must already exist in the netCDF file. New netCDF variables can be added using NcGroup::addNcVar(); - \param grp Parent NcGroup object. - \param varId Id of the is NcVar object. - */ - NcVar (const NcGroup& grp, const int& varId); - - //! assignment operator - NcVar& operator =(const NcVar& rhs); - - //! equivalence operator - bool operator==(const NcVar& rhs) const; - - //! != operator - bool operator!=(const NcVar& rhs) const; - - //! The copy constructor. - NcVar(const NcVar& ncVar); - - //! Name of this NcVar object. - const std::string getName() const; - - //! Gets parent group. - const NcGroup getParentGroup() const; - - //! Returns the variable type. - const NcType& getNcType() const; - - - //! Rename the variable. - void rename( const std::string& newname ) const; - - - //! Get the variable id. - int getId() const; - - //! Returns true if this object variable is not defined. - bool isNull() const {return nullObject;} - - //! comparator operator - friend bool operator<(const NcVar& lhs,const NcVar& rhs); - - //! comparator operator - friend bool operator>(const NcVar& lhs,const NcVar& rhs); - - ///////////////// - - // Information about Dimensions - - ///////////////// - - // The the number of dimensions. - int getDimCount() const ; - - //! Gets the i'th NcDim object. - const NcDim& getDim(int i) const; - - //! Gets the set of NcDim objects. - const std::vector getDims() const; - - ///////////////// - - // Information about Attributes - - ///////////////// - - //! Gets the number of attributes. - int getAttCount() const; - - //! Gets attribute by name - const NcVarAtt& getAtt(const std::string& name) const; - - // Gets the set of attributes. - const std::map getAtts() const; - - //! Add a new NetCDF variable attribute. - /*! - \param name Name of attribute. - \param typeName Type name; must be a type known the the current group. - \param len The length of the attribute (number of Nctype repeats). - \param dataValues Data Values to put into the new attribute. - */ - template NcVarAtt addAtt(const std::string& name, const std::string& typeName, size_t len, const T& dataValues) const { - // Create an NcType object with the given name. - NcType tmpType(getParentGroup().getType(typeName)); - nc_type xtype = tmpType.getId(); - if(typeid(T) == *type_a) - ncCheck(nc_put_att_text(groupId,myId,name.c_str(),len,&dataValues),__FILE__,__LINE__,__FUNCTION__); - else if(typeid(T) == *type_b) - ncCheck(nc_put_att_uchar(groupId,myId,name.c_str(),xtype,len,&dataValues),__FILE__,__LINE__,__FUNCTION__); - else if(typeid(T) == *type_c) - ncCheck(nc_put_att_schar(groupId,myId,name.c_str(),xtype,len,&dataValues),__FILE__,__LINE__,__FUNCTION__); - else if(typeid(T) == *type_d) - ncCheck(nc_put_att_short(groupId,myId,name.c_str(),xtype,len,&dataValues),__FILE__,__LINE__,__FUNCTION__); - else if(typeid(T) == *type_e) - ncCheck(nc_put_att_int(groupId,myId,name.c_str(),xtype,len,&dataValues),__FILE__,__LINE__,__FUNCTION__); - else if(typeid(T) == *type_f) - ncCheck(nc_put_att_long(groupId,myId,name.c_str(),xtype,len,&dataValues),__FILE__,__LINE__,__FUNCTION__); - else if(typeid(T) == *type_g) - ncCheck(nc_put_att_float(groupId,myId,name.c_str(),xtype,len,&dataValues),__FILE__,__LINE__,__FUNCTION__); - else if(typeid(T) == *type_h) - ncCheck(nc_put_att_double(groupId,myId,name.c_str(),xtype,len,&dataValues),__FILE__,__LINE__,__FUNCTION__); - else if(typeid(T) == *type_i) - ncCheck(nc_put_att_ushort(groupId,myId,name.c_str(),xtype,len,&dataValues),__FILE__,__LINE__,__FUNCTION__); - else if(typeid(T) == *type_j) - ncCheck(nc_put_att_uint(groupId,myId,name.c_str(),xtype,len,&dataValues),__FILE__,__LINE__,__FUNCTION__); - else if(typeid(T) == *type_k) - ncCheck(nc_put_att_longlong(groupId,myId,name.c_str(),xtype,len,&dataValues),__FILE__,__LINE__,__FUNCTION__); - else if(typeid(T) == *type_l) - ncCheck(nc_put_att_ulonglong(groupId,myId,name.c_str(),xtype,len,&dataValues),__FILE__,__LINE__,__FUNCTION__); - else if(typeid(T) == *type_m) - ncCheck(nc_put_att_string(groupId,myId,name.c_str(),len,&dataValues),__FILE__,__LINE__,__FUNCTION__); - else if(typeid(T) == *type_n) { - ncCheck(nc_put_att(groupId,myId,name.c_str(),xtype,len,&dataValues),__FILE__,__LINE__,__FUNCTION__); - } - else - throw NcException("Unrecognised container type for getting attribute data",__FILE__,__LINE__,__FUNCTION__); - - // finally instantiate this attribute and return - return getAtt(name); - - } - - //////////////////// - - // Chunking details - - //////////////////// - - //! Sets chunking parameters. - /*! - \param chunkMode Enumeration type. Allowable parameters are: "nc_CONTIGUOUS", "nc_CHUNKED" - \param chunksizes Shape of chunking, used if ChunkMode=nc_CHUNKED. - */ - void setChunking(ChunkMode chunkMode, std::vector& chunksizes); - - //! Gets the chunking parameters - /*! - \param chunkMode On return contains either: "nc_CONTIGUOUS" or "nc_CHUNKED" - \param chunksizes On return contains shape of chunking, used if ChunkMode=nc_CHUNKED. - */ - void getChunkingParameters(ChunkMode& chunkMode, std::vector& chunkSizes); - - - - //////////////////// - - // Fill details - - //////////////////// - - - //! Sets the fill parameters - /*! - \param fillMode Setting to true, turns on fill mode. - \param fillValue A pointer to a value which will be used as the fill value for the variable. - Must be the same type as the variable. Ignored if fillMode=.false. - */ - void setFill(bool fillMode,void* fillValues=NULL); - - - //! Gets the fill parameters - /*! - \param On return set to true if fill mode is enabled. - \param On return pointer is set to fill values. - */ - void getFillModeParameters(bool& fillMode, void* fillValues=NULL); - - - //////////////////// - - // Compression details - - //////////////////// - - - //! Sets the compression parameters - /*! - \param enableShuffleFilter Set to true to turn on shuffle filter. - \param enableDeflateFilter Set to true to turn on deflate filter. - \param deflateLevel The deflate level, must be 0 and 9. - */ - void setCompression(bool enableShuffleFilter, bool enableDeflateFilter, int deflateLevel); - - //! Gets the compression parameters - /*! - \param enableShuffleFilter On return set to true if the shuffle filter is enabled. - \param enableDeflateFilter On return set to true if the deflate filter is enabled. - \param deflateLevel On return set to the deflate level. - */ - void getCompressionParameters(bool& shuffleFilterEnabled, bool& deflateFilterEnabled, int& deflateLevel); - - - - //////////////////// - - // Endianness details - - //////////////////// - - - //! Sets the endianness of the variable. - /*! - \param Endianness enumeration type. Allowable parameters are: "nc_ENDIAN_NATIVE" (the default), "nc_ENDIAN_LITTLE", "nc_ENDIAN_BIG" - */ - void setEndianness(EndianMode endianMode); - - //! Gets the endianness of the variable. - /*! - \return Endianness enumeration type. Allowable parameters are: "nc_ENDIAN_NATIVE" (the default), "nc_ENDIAN_LITTLE", "nc_ENDIAN_BIG" - */ - EndianMode getEndianness(); - - - - //////////////////// - - // Checksum details - - //////////////////// - - - //! Sets the checksum parameters of a variable. - /*! - \param ChecksumMode enumeration type. Allowable parameters are: "nc_NOCHECKSUM", "nc_FLETCHER32". - */ - void setChecksum(ChecksumMode checksumMode); - - //! Gets the checksum parameters of the variable. - /*! - \return ChecksumMode enumeration type. Allowable parameters are: "nc_NOCHECKSUM", "nc_FLETCHER32". - */ - ChecksumMode getChecksum(); - - - - //////////////////// - - // data reading - - //////////////////// - - - - //! Reads the entire data into the netCDF variable. - /*! - \param dataValues The data values. - */ - template void get_var(T& dataValues) - { - if(typeid(T) == *type_a) - ncCheck(nc_get_var_text(groupId, myId,dataValues),__FILE__,__LINE__,__FUNCTION__); - else if(typeid(T) == *type_b) - ncCheck(nc_get_var_uchar(groupId, myId,dataValues),__FILE__,__LINE__,__FUNCTION__); - else if(typeid(T) == *type_c) - ncCheck(nc_get_var_schar(groupId, myId,dataValues),__FILE__,__LINE__,__FUNCTION__); - else if(typeid(T) == *type_d) - ncCheck(nc_get_var_short(groupId, myId,dataValues),__FILE__,__LINE__,__FUNCTION__); - else if(typeid(T) == *type_e) - ncCheck(nc_get_var_int(groupId, myId,dataValues),__FILE__,__LINE__,__FUNCTION__); - else if(typeid(T) == *type_f) - ncCheck(nc_get_var_long(groupId, myId,dataValues),__FILE__,__LINE__,__FUNCTION__); - else if(typeid(T) == *type_g) - ncCheck(nc_get_var_float(groupId, myId,dataValues),__FILE__,__LINE__,__FUNCTION__); - else if(typeid(T) == *type_h) - ncCheck(nc_get_var_double(groupId, myId,dataValues),__FILE__,__LINE__,__FUNCTION__); - else if(typeid(T) == *type_i) - ncCheck(nc_get_var_ushort(groupId, myId,dataValues),__FILE__,__LINE__,__FUNCTION__); - else if(typeid(T) == *type_j) - ncCheck(nc_get_var_uint(groupId, myId,dataValues),__FILE__,__LINE__,__FUNCTION__); - else if(typeid(T) == *type_k) - ncCheck(nc_get_var_longlong(groupId, myId,dataValues),__FILE__,__LINE__,__FUNCTION__); - else if(typeid(T) == *type_l) - ncCheck(nc_get_var_ulonglong(groupId, myId,dataValues),__FILE__,__LINE__,__FUNCTION__); - else if(typeid(T) == *type_m) - ncCheck(nc_get_var_string(groupId, myId,dataValues),__FILE__,__LINE__,__FUNCTION__); - else if(typeid(T) == *type_n){ - ncCheck(nc_get_var(groupId, myId,dataValues),__FILE__,__LINE__,__FUNCTION__); - } - else - throw NcException("Unrecognised container type for getting ncVar data",__FILE__,__LINE__,__FUNCTION__); - - } - - //! Reads a single datum value into the netCDF variable. - /*! - \param index Vector specifying the index where the data values will be written. - \param datumValue The datum values. - */ - template void get_var(const std::vector& index, T& datumValue) - { - if(typeid(T) == *type_a) - ncCheck(nc_get_var1_text(groupId, myId,index,datumValue),__FILE__,__LINE__,__FUNCTION__); - else if(typeid(T) == *type_b) - ncCheck(nc_get_var1_uchar(groupId, myId,index,datumValue),__FILE__,__LINE__,__FUNCTION__); - else if(typeid(T) == *type_c) - ncCheck(nc_get_var1_schar(groupId, myId,index,datumValue),__FILE__,__LINE__,__FUNCTION__); - else if(typeid(T) == *type_d) - ncCheck(nc_get_var1_short(groupId, myId,index,datumValue),__FILE__,__LINE__,__FUNCTION__); - else if(typeid(T) == *type_e) - ncCheck(nc_get_var1_int(groupId, myId,index,datumValue),__FILE__,__LINE__,__FUNCTION__); - else if(typeid(T) == *type_f) - ncCheck(nc_get_var1_long(groupId, myId,index,datumValue),__FILE__,__LINE__,__FUNCTION__); - else if(typeid(T) == *type_g) - ncCheck(nc_get_var1_float(groupId, myId,index,datumValue),__FILE__,__LINE__,__FUNCTION__); - else if(typeid(T) == *type_h) - ncCheck(nc_get_var1_double(groupId, myId,index,datumValue),__FILE__,__LINE__,__FUNCTION__); - else if(typeid(T) == *type_i) - ncCheck(nc_get_var1_ushort(groupId, myId,index,datumValue),__FILE__,__LINE__,__FUNCTION__); - else if(typeid(T) == *type_j) - ncCheck(nc_get_var1_uint(groupId, myId,index,datumValue),__FILE__,__LINE__,__FUNCTION__); - else if(typeid(T) == *type_k) - ncCheck(nc_get_var1_longlong(groupId, myId,index,datumValue),__FILE__,__LINE__,__FUNCTION__); - else if(typeid(T) == *type_l) - ncCheck(nc_get_var1_ulonglong(groupId, myId,index,datumValue),__FILE__,__LINE__,__FUNCTION__); - else if(typeid(T) == *type_m) - ncCheck(nc_get_var1_string(groupId, myId,index,datumValue),__FILE__,__LINE__,__FUNCTION__); - else if(typeid(T) == *type_n){ - ncCheck(nc_get_var1(groupId, myId,index,datumValue),__FILE__,__LINE__,__FUNCTION__); - } - else - throw NcException("Unrecognised container type for getting ncVar data",__FILE__,__LINE__,__FUNCTION__); - } - - - //! Reads data for an array of values into the netCDF variable. - /*! - \param startp Vector specifying the index where the first data values will be written. - \param countp Vector specifying the number of indices along each dimension. - \param dataValues The data values. - */ - template void get_var(const std::vector& startp, const std::vector& countp, T& dataValues) - { - if(typeid(T) == *type_a) - ncCheck(nc_get_vara_text(groupId, myId,startp,countp,dataValues),__FILE__,__LINE__,__FUNCTION__); - else if(typeid(T) == *type_b) - ncCheck(nc_get_vara_uchar(groupId, myId,startp,countp,dataValues),__FILE__,__LINE__,__FUNCTION__); - else if(typeid(T) == *type_c) - ncCheck(nc_get_vara_schar(groupId, myId,startp,countp,dataValues),__FILE__,__LINE__,__FUNCTION__); - else if(typeid(T) == *type_d) - ncCheck(nc_get_vara_short(groupId, myId,startp,countp,dataValues),__FILE__,__LINE__,__FUNCTION__); - else if(typeid(T) == *type_e) - ncCheck(nc_get_vara_int(groupId, myId,startp,countp,dataValues),__FILE__,__LINE__,__FUNCTION__); - else if(typeid(T) == *type_f) - ncCheck(nc_get_vara_long(groupId, myId,startp,countp,dataValues),__FILE__,__LINE__,__FUNCTION__); - else if(typeid(T) == *type_g) - ncCheck(nc_get_vara_float(groupId, myId,startp,countp,dataValues),__FILE__,__LINE__,__FUNCTION__); - else if(typeid(T) == *type_h) - ncCheck(nc_get_vara_double(groupId, myId,startp,countp,dataValues),__FILE__,__LINE__,__FUNCTION__); - else if(typeid(T) == *type_i) - ncCheck(nc_get_vara_ushort(groupId, myId,startp,countp,dataValues),__FILE__,__LINE__,__FUNCTION__); - else if(typeid(T) == *type_j) - ncCheck(nc_get_vara_uint(groupId, myId,startp,countp,dataValues),__FILE__,__LINE__,__FUNCTION__); - else if(typeid(T) == *type_k) - ncCheck(nc_get_vara_longlong(groupId, myId,startp,countp,dataValues),__FILE__,__LINE__,__FUNCTION__); - else if(typeid(T) == *type_l) - ncCheck(nc_get_vara_ulonglong(groupId, myId,startp,countp,dataValues),__FILE__,__LINE__,__FUNCTION__); - else if(typeid(T) == *type_m) - ncCheck(nc_get_vara_string(groupId, myId,startp,countp,dataValues),__FILE__,__LINE__,__FUNCTION__); - else if(typeid(T) == *type_n){ - ncCheck(nc_get_vara(groupId, myId,startp,countp,dataValues),__FILE__,__LINE__,__FUNCTION__); - } - else - throw NcException("Unrecognised container type for getting ncVar data",__FILE__,__LINE__,__FUNCTION__); - } - - - - - - //! Reads data for a set of subsampled array values into the netCDF variable. - /*! - \param startp Vector specifying the index where the first data values will be written. - \param countp Vector specifying the number of indices along each dimension. - \param stridep Vector specifying the sampling interval along each dimension of the netCDF variable. - \param dataValues The data values. - */ - template void get_var(const std::vector& startp, const std::vector& countp, const std::vector& stridep, T& dataValues) - { - if(typeid(T) == *type_a) - ncCheck(nc_get_vars_text(groupId, myId,startp,countp,stridep,dataValues),__FILE__,__LINE__,__FUNCTION__); - else if(typeid(T) == *type_b) - ncCheck(nc_get_vars_uchar(groupId, myId,startp,countp,stridep,dataValues),__FILE__,__LINE__,__FUNCTION__); - else if(typeid(T) == *type_c) - ncCheck(nc_get_vars_schar(groupId, myId,startp,countp,stridep,dataValues),__FILE__,__LINE__,__FUNCTION__); - else if(typeid(T) == *type_d) - ncCheck(nc_get_vars_short(groupId, myId,startp,countp,stridep,dataValues),__FILE__,__LINE__,__FUNCTION__); - else if(typeid(T) == *type_e) - ncCheck(nc_get_vars_int(groupId, myId,startp,countp,stridep,dataValues),__FILE__,__LINE__,__FUNCTION__); - else if(typeid(T) == *type_f) - ncCheck(nc_get_vars_long(groupId, myId,startp,countp,stridep,dataValues),__FILE__,__LINE__,__FUNCTION__); - else if(typeid(T) == *type_g) - ncCheck(nc_get_vars_float(groupId, myId,startp,countp,stridep,dataValues),__FILE__,__LINE__,__FUNCTION__); - else if(typeid(T) == *type_h) - ncCheck(nc_get_vars_double(groupId, myId,startp,countp,stridep,dataValues),__FILE__,__LINE__,__FUNCTION__); - else if(typeid(T) == *type_i) - ncCheck(nc_get_vars_ushort(groupId, myId,startp,countp,stridep,dataValues),__FILE__,__LINE__,__FUNCTION__); - else if(typeid(T) == *type_j) - ncCheck(nc_get_vars_uint(groupId, myId,startp,countp,stridep,dataValues),__FILE__,__LINE__,__FUNCTION__); - else if(typeid(T) == *type_k) - ncCheck(nc_get_vars_longlong(groupId, myId,startp,countp,stridep,dataValues),__FILE__,__LINE__,__FUNCTION__); - else if(typeid(T) == *type_l) - ncCheck(nc_get_vars_ulonglong(groupId, myId,startp,countp,stridep,dataValues),__FILE__,__LINE__,__FUNCTION__); - else if(typeid(T) == *type_m) - ncCheck(nc_get_vars_string(groupId, myId,startp,countp,stridep,dataValues),__FILE__,__LINE__,__FUNCTION__); - else if(typeid(T) == *type_n){ - ncCheck(nc_get_vars(groupId, myId,startp,countp,stridep,dataValues),__FILE__,__LINE__,__FUNCTION__); - } - else - throw NcException("Unrecognised container type for getting ncVar data",__FILE__,__LINE__,__FUNCTION__); - } - - - - //! Reads data for a set of mapped values into the netCDF variable. - /*! - \param startp Vector specifying the index where the first data values will be written. - \param countp Vector specifying the number of indices along each dimension. - \param stridep Vector specifying the sampling interval along each dimension of the netCDF variable. - \param imapp Vector specifying the mapping between the dimensions of a netCDF variables and the in-memory strucutre of the internal data array. - \param dataValues The data values. - */ - template void get_var(const std::vector& startp, const std::vector& countp, const std::vector& stridep , const std::vector& imapp, T& dataValues) - { - if(typeid(T) == *type_a) - ncCheck(nc_get_varm_text(groupId, myId,startp,countp,stridep, imapp,dataValues),__FILE__,__LINE__,__FUNCTION__); - else if(typeid(T) == *type_b) - ncCheck(nc_get_varm_uchar(groupId, myId,startp,countp,stridep, imapp,dataValues),__FILE__,__LINE__,__FUNCTION__); - else if(typeid(T) == *type_c) - ncCheck(nc_get_varm_schar(groupId, myId,startp,countp,stridep, imapp,dataValues),__FILE__,__LINE__,__FUNCTION__); - else if(typeid(T) == *type_d) - ncCheck(nc_get_varm_short(groupId, myId,startp,countp,stridep, imapp,dataValues),__FILE__,__LINE__,__FUNCTION__); - else if(typeid(T) == *type_e) - ncCheck(nc_get_varm_int(groupId, myId,startp,countp,stridep, imapp,dataValues),__FILE__,__LINE__,__FUNCTION__); - else if(typeid(T) == *type_f) - ncCheck(nc_get_varm_long(groupId, myId,startp,countp,stridep, imapp,dataValues),__FILE__,__LINE__,__FUNCTION__); - else if(typeid(T) == *type_g) - ncCheck(nc_get_varm_float(groupId, myId,startp,countp,stridep, imapp,dataValues),__FILE__,__LINE__,__FUNCTION__); - else if(typeid(T) == *type_h) - ncCheck(nc_get_varm_double(groupId, myId,startp,countp,stridep, imapp,dataValues),__FILE__,__LINE__,__FUNCTION__); - else if(typeid(T) == *type_i) - ncCheck(nc_get_varm_ushort(groupId, myId,startp,countp,stridep, imapp,dataValues),__FILE__,__LINE__,__FUNCTION__); - else if(typeid(T) == *type_j) - ncCheck(nc_get_varm_uint(groupId, myId,startp,countp,stridep, imapp,dataValues),__FILE__,__LINE__,__FUNCTION__); - else if(typeid(T) == *type_k) - ncCheck(nc_get_varm_longlong(groupId, myId,startp,countp,stridep, imapp,dataValues),__FILE__,__LINE__,__FUNCTION__); - else if(typeid(T) == *type_l) - ncCheck(nc_get_varm_ulonglong(groupId, myId,startp,countp,stridep, imapp,dataValues),__FILE__,__LINE__,__FUNCTION__); - else if(typeid(T) == *type_m) - ncCheck(nc_get_varm_string(groupId, myId,startp,countp,stridep, imapp,dataValues),__FILE__,__LINE__,__FUNCTION__); - else if(typeid(T) == *type_n){ - ncCheck(nc_get_varm(groupId, myId,startp,countp,stridep, imapp,dataValues),__FILE__,__LINE__,__FUNCTION__); - } - else - throw NcException("Unrecognised container type for getting ncVar data",__FILE__,__LINE__,__FUNCTION__); - - } - - - - //////////////////// - - // data writing - - //////////////////// - - - //! Writes the entire data into the netCDF variable. - /*! - This is the simplest interface to use for writing a value in a scalar variable - or whenever all the values of a multidimensional variable can all be - written at once. The values to be written are associated with the - netCDF variable by assuming that the last dimension of the netCDF - variable varies fastest in the C interface. The values are converted - to the external data type of the variable, if necessary. - - Take care when using the simplest forms of this interface with - record variables when you don't specify how many records are to be - written. If you try to write all the values of a record variable - into a netCDF file that has no record data yet (hence has 0 records), - nothing will be written. Similarly, if you try to write all of a record - variable but there are more records in the file than you assume, more data - may be written to the file than you supply, which may result in a - segmentation violation. - \param dataValues The data values. - */ - void putVar(const long long* dataValues); - /*! \overload - */ - void putVar(const char** dataValues); - /*! \overload - */ - void putVar(const char* dataValues); - /*! \overload - */ - void putVar(const unsigned char* dataValues); - /*! \overload - */ - void putVar(const signed char* dataValues); - /*! \overload - */ - void putVar(const short* dataValues); - /*! \overload - */ - void putVar(const int* dataValues); - /*! \overload - */ - void putVar(const long* dataValues); - /*! \overload - */ - void putVar(const float* dataValues); - /*! \overload - */ - void putVar(const double* dataValues); - /*! \overload - */ - void putVar(const unsigned short* dataValues); - /*! \overload - */ - void putVar(const unsigned int* dataValues); - /*! \overload - */ - void putVar(const unsigned long long* dataValues); - //! Writes the entire data into the netCDF variable. - /*! - \param dataValues The data values. - */ - void putVar(const void* dataValues); - - - - - - //! Writes a single datum value into the netCDF variable. - /*! - \param index Vector specifying the index where the data values will be written. - \param datumValue The datum values. - */ - template void putVar(const std::vector& index, const T& datumValue) { - if(typeid(T) == *type_a) - ncCheck(nc_put_var1_text(groupId, myId,index,datumValue),__FILE__,__LINE__,__FUNCTION__); - else if(typeid(T) == *type_b) - ncCheck(nc_put_var1_uchar(groupId, myId,index,datumValue),__FILE__,__LINE__,__FUNCTION__); - else if(typeid(T) == *type_c) - ncCheck(nc_put_var1_schar(groupId, myId,index,datumValue),__FILE__,__LINE__,__FUNCTION__); - else if(typeid(T) == *type_d) - ncCheck(nc_put_var1_short(groupId, myId,index,datumValue),__FILE__,__LINE__,__FUNCTION__); - else if(typeid(T) == *type_e) - ncCheck(nc_put_var1_int(groupId, myId,index,datumValue),__FILE__,__LINE__,__FUNCTION__); - else if(typeid(T) == *type_f) - ncCheck(nc_put_var1_long(groupId, myId,index,datumValue),__FILE__,__LINE__,__FUNCTION__); - else if(typeid(T) == *type_g) - ncCheck(nc_put_var1_float(groupId, myId,index,datumValue),__FILE__,__LINE__,__FUNCTION__); - else if(typeid(T) == *type_h) - ncCheck(nc_put_var1_double(groupId, myId,index,datumValue),__FILE__,__LINE__,__FUNCTION__); - else if(typeid(T) == *type_i) - ncCheck(nc_put_var1_ushort(groupId, myId,index,datumValue),__FILE__,__LINE__,__FUNCTION__); - else if(typeid(T) == *type_j) - ncCheck(nc_put_var1_uint(groupId, myId,index,datumValue),__FILE__,__LINE__,__FUNCTION__); - else if(typeid(T) == *type_k) - ncCheck(nc_put_var1_longlong(groupId, myId,index,datumValue),__FILE__,__LINE__,__FUNCTION__); - else if(typeid(T) == *type_l) - ncCheck(nc_put_var1_ulonglong(groupId, myId,index,datumValue),__FILE__,__LINE__,__FUNCTION__); - else if(typeid(T) == *type_m) - ncCheck(nc_put_var1_string(groupId, myId,index,datumValue),__FILE__,__LINE__,__FUNCTION__); - else if(typeid(T) == *type_n){ - ncCheck(nc_put_var1(groupId, myId,index,datumValue),__FILE__,__LINE__,__FUNCTION__); - } - else - throw NcException("Unrecognised container type for putting ncVar data",__FILE__,__LINE__,__FUNCTION__); - } - - - //! Writes data for an array of values into the netCDF variable. - /*! - \param startp Vector specifying the index where the first data values will be written. - \param countp Vector specifying the number of indices along each dimension. - \param dataValues The data values. - */ - template void putVar(const std::vector& startp, const std::vector& countp, const T& dataValues) { - if(typeid(T) == *type_a) - ncCheck(nc_put_vara_text(groupId, myId,startp,countp,dataValues),__FILE__,__LINE__,__FUNCTION__); - else if(typeid(T) == *type_b) - ncCheck(nc_put_vara_uchar(groupId, myId,startp,countp,dataValues),__FILE__,__LINE__,__FUNCTION__); - else if(typeid(T) == *type_c) - ncCheck(nc_put_vara_schar(groupId, myId,startp,countp,dataValues),__FILE__,__LINE__,__FUNCTION__); - else if(typeid(T) == *type_d) - ncCheck(nc_put_vara_short(groupId, myId,startp,countp,dataValues),__FILE__,__LINE__,__FUNCTION__); - else if(typeid(T) == *type_e) - ncCheck(nc_put_vara_int(groupId, myId,startp,countp,dataValues),__FILE__,__LINE__,__FUNCTION__); - else if(typeid(T) == *type_f) - ncCheck(nc_put_vara_long(groupId, myId,startp,countp,dataValues),__FILE__,__LINE__,__FUNCTION__); - else if(typeid(T) == *type_g) - ncCheck(nc_put_vara_float(groupId, myId,startp,countp,dataValues),__FILE__,__LINE__,__FUNCTION__); - else if(typeid(T) == *type_h) - ncCheck(nc_put_vara_double(groupId, myId,startp,countp,dataValues),__FILE__,__LINE__,__FUNCTION__); - else if(typeid(T) == *type_i) - ncCheck(nc_put_vara_ushort(groupId, myId,startp,countp,dataValues),__FILE__,__LINE__,__FUNCTION__); - else if(typeid(T) == *type_j) - ncCheck(nc_put_vara_uint(groupId, myId,startp,countp,dataValues),__FILE__,__LINE__,__FUNCTION__); - else if(typeid(T) == *type_k) - ncCheck(nc_put_vara_longlong(groupId, myId,startp,countp,dataValues),__FILE__,__LINE__,__FUNCTION__); - else if(typeid(T) == *type_l) - ncCheck(nc_put_vara_ulonglong(groupId, myId,startp,countp,dataValues),__FILE__,__LINE__,__FUNCTION__); - else if(typeid(T) == *type_m) - ncCheck(nc_put_vara_string(groupId, myId,startp,countp,dataValues),__FILE__,__LINE__,__FUNCTION__); - else if(typeid(T) == *type_n){ - ncCheck(nc_put_vara(groupId, myId,startp,countp,dataValues),__FILE__,__LINE__,__FUNCTION__); - } - else - throw NcException("Unrecognised container type for putting ncVar data",__FILE__,__LINE__,__FUNCTION__); - } - - - - //! Writes data for a set of subsampled array values into the netCDF variable. - /*! - \param startp Vector specifying the index where the first data values will be written. - \param countp Vector specifying the number of indices along each dimension. - \param stridep Vector specifying the sampling interval along each dimension of the netCDF variable. - \param dataValues The data values. - */ - template void putVar(const std::vector& startp, const std::vector& countp, const std::vector& stridep, const T& dataValues) { - - if(typeid(T) == *type_a) - ncCheck(nc_put_vars_text(groupId, myId,startp,countp,stridep,dataValues),__FILE__,__LINE__,__FUNCTION__); - else if(typeid(T) == *type_b) - ncCheck(nc_put_vars_uchar(groupId, myId,startp,countp,stridep,dataValues),__FILE__,__LINE__,__FUNCTION__); - else if(typeid(T) == *type_c) - ncCheck(nc_put_vars_schar(groupId, myId,startp,countp,stridep,dataValues),__FILE__,__LINE__,__FUNCTION__); - else if(typeid(T) == *type_d) - ncCheck(nc_put_vars_short(groupId, myId,startp,countp,stridep,dataValues),__FILE__,__LINE__,__FUNCTION__); - else if(typeid(T) == *type_e) - ncCheck(nc_put_vars_int(groupId, myId,startp,countp,stridep,dataValues),__FILE__,__LINE__,__FUNCTION__); - else if(typeid(T) == *type_f) - ncCheck(nc_put_vars_long(groupId, myId,startp,countp,stridep,dataValues),__FILE__,__LINE__,__FUNCTION__); - else if(typeid(T) == *type_g) - ncCheck(nc_put_vars_float(groupId, myId,startp,countp,stridep,dataValues),__FILE__,__LINE__,__FUNCTION__); - else if(typeid(T) == *type_h) - ncCheck(nc_put_vars_double(groupId, myId,startp,countp,stridep,dataValues),__FILE__,__LINE__,__FUNCTION__); - else if(typeid(T) == *type_i) - ncCheck(nc_put_vars_ushort(groupId, myId,startp,countp,stridep,dataValues),__FILE__,__LINE__,__FUNCTION__); - else if(typeid(T) == *type_j) - ncCheck(nc_put_vars_uint(groupId, myId,startp,countp,stridep,dataValues),__FILE__,__LINE__,__FUNCTION__); - else if(typeid(T) == *type_k) - ncCheck(nc_put_vars_longlong(groupId, myId,startp,countp,stridep,dataValues),__FILE__,__LINE__,__FUNCTION__); - else if(typeid(T) == *type_l) - ncCheck(nc_put_vars_ulonglong(groupId, myId,startp,countp,stridep,dataValues),__FILE__,__LINE__,__FUNCTION__); - else if(typeid(T) == *type_m) - ncCheck(nc_put_vars_string(groupId, myId,startp,countp,stridep,dataValues),__FILE__,__LINE__,__FUNCTION__); - else if(typeid(T) == *type_n){ - ncCheck(nc_put_vars(groupId, myId,startp,countp,stridep,dataValues),__FILE__,__LINE__,__FUNCTION__); - } - else - throw NcException("Unrecognised container type for putting ncVar data",__FILE__,__LINE__,__FUNCTION__); - } - - - - - - - //! Writes data for a set of mapped values into the netCDF variable. - /*! - \param startp Vector specifying the index where the first data values will be written. - \param countp Vector specifying the number of indices along each dimension. - \param stridep Vector specifying the sampling interval along each dimension of the netCDF variable. - \param imapp Vector specifying the mapping between the dimensions of a netCDF variables and the in-memory strucutre of the internal data array. - \param dataValues The data values. - */ - template void putVar(const std::vector& startp, const std::vector& countp, const std::vector& stridep , const std::vector& imapp, const T& dataValues) { - - if(typeid(T) == *type_a) - ncCheck(nc_put_varm_text(groupId, myId,startp,countp,stridep, imapp,dataValues),__FILE__,__LINE__,__FUNCTION__); - else if(typeid(T) == *type_b) - ncCheck(nc_put_varm_uchar(groupId, myId,startp,countp,stridep, imapp,dataValues),__FILE__,__LINE__,__FUNCTION__); - else if(typeid(T) == *type_c) - ncCheck(nc_put_varm_schar(groupId, myId,startp,countp,stridep, imapp,dataValues),__FILE__,__LINE__,__FUNCTION__); - else if(typeid(T) == *type_d) - ncCheck(nc_put_varm_short(groupId, myId,startp,countp,stridep, imapp,dataValues),__FILE__,__LINE__,__FUNCTION__); - else if(typeid(T) == *type_e) - ncCheck(nc_put_varm_int(groupId, myId,startp,countp,stridep, imapp,dataValues),__FILE__,__LINE__,__FUNCTION__); - else if(typeid(T) == *type_f) - ncCheck(nc_put_varm_long(groupId, myId,startp,countp,stridep, imapp,dataValues),__FILE__,__LINE__,__FUNCTION__); - else if(typeid(T) == *type_g) - ncCheck(nc_put_varm_float(groupId, myId,startp,countp,stridep, imapp,dataValues),__FILE__,__LINE__,__FUNCTION__); - else if(typeid(T) == *type_h) - ncCheck(nc_put_varm_double(groupId, myId,startp,countp,stridep, imapp,dataValues),__FILE__,__LINE__,__FUNCTION__); - else if(typeid(T) == *type_i) - ncCheck(nc_put_varm_ushort(groupId, myId,startp,countp,stridep, imapp,dataValues),__FILE__,__LINE__,__FUNCTION__); - else if(typeid(T) == *type_j) - ncCheck(nc_put_varm_uint(groupId, myId,startp,countp,stridep, imapp,dataValues),__FILE__,__LINE__,__FUNCTION__); - else if(typeid(T) == *type_k) - ncCheck(nc_put_varm_longlong(groupId, myId,startp,countp,stridep, imapp,dataValues),__FILE__,__LINE__,__FUNCTION__); - else if(typeid(T) == *type_l) - ncCheck(nc_put_varm_ulonglong(groupId, myId,startp,countp,stridep, imapp,dataValues),__FILE__,__LINE__,__FUNCTION__); - else if(typeid(T) == *type_m) - ncCheck(nc_put_varm_string(groupId, myId,startp,countp,stridep, imapp,dataValues),__FILE__,__LINE__,__FUNCTION__); - else if(typeid(T) == *type_n){ - ncCheck(nc_put_varm(groupId, myId,startp,countp,stridep, imapp,dataValues),__FILE__,__LINE__,__FUNCTION__); - } - else - throw NcException("Unrecognised container type for putting ncVar data",__FILE__,__LINE__,__FUNCTION__); - } - - - private: - - int myId; - - int groupId; - - bool nullObject; - - // The following hold the typeid for different variable types - const std::type_info* type_a; - const std::type_info* type_b; - const std::type_info* type_c; - const std::type_info* type_d; - const std::type_info* type_e; - const std::type_info* type_f; - const std::type_info* type_g; - const std::type_info* type_h; - const std::type_info* type_i; - const std::type_info* type_j; - const std::type_info* type_k; - const std::type_info* type_l; - const std::type_info* type_m; - const std::type_info* type_n; - - }; - -} - -#endif