NetCDF-C++  4.3.1-developer
ncVar.cpp
1 #include "ncVarAtt.h"
2 #include "ncDim.h"
3 #include "ncVar.h"
4 #include "ncGroup.h"
5 #include "ncCheck.h"
6 #include "ncException.h"
7 #include<netcdf.h>
8 using namespace std;
9 using namespace netCDF::exceptions;
10 
11 namespace netCDF {
12  // Global comparator operator ==============
13  // comparator operator
14  bool operator<(const NcVar& lhs,const NcVar& rhs)
15  {
16  return false;
17  }
18 
19  // comparator operator
20  bool operator>(const NcVar& lhs,const NcVar& rhs)
21  {
22  return true;
23  }
24 }
25 
26 using namespace netCDF;
27 
28 // assignment operator
29 NcVar& NcVar::operator=(const NcVar & rhs)
30 {
31  nullObject = rhs.nullObject;
32  myId = rhs.myId;
33  groupId = rhs.groupId;
34  return *this;
35 }
36 
37 // The copy constructor.
38 NcVar::NcVar(const NcVar& rhs) :
39  nullObject(rhs.nullObject),
40  myId(rhs.myId),
41  groupId(rhs.groupId)
42 {}
43 
44 
45 // equivalence operator
46 bool NcVar::operator==(const NcVar & rhs) const
47 {
48  // simply check the netCDF id.
49  return (myId == rhs.myId);
50 }
51 
52 // != operator
53 bool NcVar::operator!=(const NcVar & rhs) const
54 {
55  return !(*this == rhs);
56 }
57 
59 
60 // Constructors and intialization
61 
63 
64 // Constructor generates a null object.
65 NcVar::NcVar() : nullObject(true),
66  myId(-1),
67  groupId(-1)
68 {}
69 
70 // Constructor for a variable (must already exist in the netCDF file.)
71 NcVar::NcVar (const NcGroup& grp, const int& varId) :
72  nullObject (false),
73  myId (varId),
74  groupId(grp.getId())
75 {}
76 
77 
78 
79 // Gets parent group.
81  return NcGroup(groupId);
82 }
83 
84 
85 // Get the variable id.
86 int NcVar::getId() const {return myId;}
87 
89 
90 // Information about the variable type
91 
93 
94 
95 // Gets the NcType object with a given name.
97 
98  // if this variable has not been defined, return a NULL type
99  if(isNull()) return NcType();
100 
101  // first get the typeid
102  nc_type xtypep;
103  ncCheck(nc_inq_vartype(groupId,myId,&xtypep),__FILE__,__LINE__);
104 
105  if(xtypep == ncByte.getId() ) return ncByte;
106  if(xtypep == ncUbyte.getId() ) return ncUbyte;
107  if(xtypep == ncChar.getId() ) return ncChar;
108  if(xtypep == ncShort.getId() ) return ncShort;
109  if(xtypep == ncUshort.getId() ) return ncUshort;
110  if(xtypep == ncInt.getId() ) return ncInt;
111  if(xtypep == ncUint.getId() ) return ncUint;
112  if(xtypep == ncInt64.getId() ) return ncInt64;
113  if(xtypep == ncUint64.getId() ) return ncUint64;
114  if(xtypep == ncFloat.getId() ) return ncFloat;
115  if(xtypep == ncDouble.getId() ) return ncDouble;
116  if(xtypep == ncString.getId() ) return ncString;
117 
118  multimap<string,NcType>::const_iterator it;
119  multimap<string,NcType> types(NcGroup(groupId).getTypes(NcGroup::ParentsAndCurrent));
120  for(it=types.begin(); it!=types.end(); it++) {
121  if(it->second.getId() == xtypep) return it->second;
122  }
123  // we will never reach here
124  return true;
125 }
126 
127 
128 
129 
130 
131 
132 
133 
135 
136 // Information about Dimensions
137 
139 
140 
141 // Gets the number of dimensions.
143 {
144  // get the number of dimensions
145  int dimCount;
146  ncCheck(nc_inq_varndims(groupId,myId, &dimCount),__FILE__,__LINE__);
147  return dimCount;
148 }
149 
150 // Gets the set of Ncdim objects.
151 vector<NcDim> NcVar::getDims() const
152 {
153  // get the number of dimensions
154  int dimCount = getDimCount();
155  // create a vector of dimensions.
156  vector<NcDim> ncDims;
157  if (dimCount){
158  vector<int> dimids(dimCount);
159  ncCheck(nc_inq_vardimid(groupId,myId, &dimids[0]),__FILE__,__LINE__);
160  ncDims.reserve(dimCount);
161  for (int i=0; i<dimCount; i++){
162  NcDim tmpDim(getParentGroup(),dimids[i]);
163  ncDims.push_back(tmpDim);
164  }
165  }
166  return ncDims;
167 }
168 
169 
170 // Gets the i'th NcDim object.
171 NcDim NcVar::getDim(int i) const
172 {
173  vector<NcDim> ncDims = getDims();
174  if((size_t)i >= ncDims.size() || i < 0) throw NcException("Index out of range",__FILE__,__LINE__);
175  return ncDims[i];
176 }
177 
178 
180 
181 // Information about Attributes
182 
184 
185 
186 // Gets the number of attributes.
188 {
189  // get the number of attributes
190  int attCount;
191  ncCheck(nc_inq_varnatts(groupId,myId, &attCount),__FILE__,__LINE__);
192  return attCount;
193 }
194 
195 // Gets the set of attributes.
196 map<string,NcVarAtt> NcVar::getAtts() const
197 {
198  // get the number of attributes
199  int attCount = getAttCount();
200  // create a container of attributes.
201  map<string,NcVarAtt> ncAtts;
202  for (int i=0; i<attCount; i++){
203  NcVarAtt tmpAtt(getParentGroup(),*this,i);
204  ncAtts.insert(pair<const string,NcVarAtt>(tmpAtt.getName(),tmpAtt));
205  }
206  return ncAtts;
207 }
208 
209 
210 // Gets attribute by name.
211 NcVarAtt NcVar::getAtt(const string& name) const
212 {
213  map<string,NcVarAtt> attributeList = getAtts();
214  map<string,NcVarAtt>::iterator myIter;
215  myIter = attributeList.find(name);
216  if(myIter == attributeList.end()){
217  string msg("Attribute '"+name+"' not found");
218  throw NcException(msg.c_str(),__FILE__,__LINE__);
219  }
220  return NcVarAtt(myIter->second);
221 }
222 
223 
224 
226 
227 
228 // Creates a new NetCDF variable attribute or if already exisiting replaces it.
229 NcVarAtt NcVar::putAtt(const string& name, const string& dataValues) const {
230  ncCheckDefineMode(groupId);
231  ncCheck(nc_put_att_text(groupId,myId,name.c_str(),dataValues.size(),dataValues.c_str()),__FILE__,__LINE__);
232  // finally instantiate this attribute and return
233  return getAtt(name);
234 }
235 
236 // Creates a new NetCDF variable attribute or if already exisiting replaces it.
237 NcVarAtt NcVar::putAtt(const string& name, const NcType& type, size_t len, const unsigned char* dataValues) const {
238  ncCheckDefineMode(groupId);
239  NcType::ncType typeClass(type.getTypeClass());
240  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
241  ncCheck(nc_put_att(groupId,myId,name.c_str(),type.getId(),len,dataValues),__FILE__,__LINE__);
242  else
243  ncCheck(nc_put_att_uchar(groupId,myId,name.c_str(),type.getId(),len,dataValues),__FILE__,__LINE__);
244  // finally instantiate this attribute and return
245  return getAtt(name);
246 }
247 
248 
249 // Creates a new NetCDF variable attribute or if already exisiting replaces it.
250 NcVarAtt NcVar::putAtt(const string& name, const NcType& type, size_t len, const signed char* dataValues) const {
251  ncCheckDefineMode(groupId);
252  NcType::ncType typeClass(type.getTypeClass());
253  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
254  ncCheck(nc_put_att(groupId,myId,name.c_str(),type.getId(),len,dataValues),__FILE__,__LINE__);
255  else
256  ncCheck(nc_put_att_schar(groupId,myId,name.c_str(),type.getId(),len,dataValues),__FILE__,__LINE__);
257  // finally instantiate this attribute and return
258  return getAtt(name);
259 }
260 
261 
262 
264 // Creates a new NetCDF variable attribute or if already exisiting replaces it.
265 NcVarAtt NcVar::putAtt(const string& name, const NcType& type, short datumValue) const {
266  ncCheckDefineMode(groupId);
267  NcType::ncType typeClass(type.getTypeClass());
268  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
269  ncCheck(nc_put_att(groupId,myId,name.c_str(),type.getId(),1,&datumValue),__FILE__,__LINE__);
270  else
271  ncCheck(nc_put_att_short(groupId,myId,name.c_str(),type.getId(),1,&datumValue),__FILE__,__LINE__);
272  // finally instantiate this attribute and return
273  return getAtt(name);
274 }
275 
276 
277 // Creates a new NetCDF variable attribute or if already exisiting replaces it.
278 NcVarAtt NcVar::putAtt(const string& name, const NcType& type, int datumValue) const {
279  ncCheckDefineMode(groupId);
280  NcType::ncType typeClass(type.getTypeClass());
281  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
282  ncCheck(nc_put_att(groupId,myId,name.c_str(),type.getId(),1,&datumValue),__FILE__,__LINE__);
283  else
284  ncCheck(nc_put_att_int(groupId,myId,name.c_str(),type.getId(),1,&datumValue),__FILE__,__LINE__);
285  // finally instantiate this attribute and return
286  return getAtt(name);
287 }
288 
289 // Creates a new NetCDF variable attribute or if already exisiting replaces it.
290 NcVarAtt NcVar::putAtt(const string& name, const NcType& type, long datumValue) const {
291  ncCheckDefineMode(groupId);
292  NcType::ncType typeClass(type.getTypeClass());
293  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
294  ncCheck(nc_put_att(groupId,myId,name.c_str(),type.getId(),1,&datumValue),__FILE__,__LINE__);
295  else
296  ncCheck(nc_put_att_long(groupId,myId,name.c_str(),type.getId(),1,&datumValue),__FILE__,__LINE__);
297  // finally instantiate this attribute and return
298  return getAtt(name);
299 }
300 
301 // Creates a new NetCDF variable attribute or if already exisiting replaces it.
302 NcVarAtt NcVar::putAtt(const string& name, const NcType& type, float datumValue) const {
303  ncCheckDefineMode(groupId);
304  NcType::ncType typeClass(type.getTypeClass());
305  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
306  ncCheck(nc_put_att(groupId,myId,name.c_str(),type.getId(),1,&datumValue),__FILE__,__LINE__);
307  else
308  ncCheck(nc_put_att_float(groupId,myId,name.c_str(),type.getId(),1,&datumValue),__FILE__,__LINE__);
309  // finally instantiate this attribute and return
310  return getAtt(name);
311 }
312 
313 
314 // Creates a new NetCDF variable attribute or if already exisiting replaces it.
315 NcVarAtt NcVar::putAtt(const string& name, const NcType& type, double datumValue) const {
316  ncCheckDefineMode(groupId);
317  NcType::ncType typeClass(type.getTypeClass());
318  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
319  ncCheck(nc_put_att(groupId,myId,name.c_str(),type.getId(),1,&datumValue),__FILE__,__LINE__);
320  else
321  ncCheck(nc_put_att_double(groupId,myId,name.c_str(),type.getId(),1,&datumValue),__FILE__,__LINE__);
322  // finally instantiate this attribute and return
323  return getAtt(name);
324 }
325 
326 
327 // Creates a new NetCDF variable attribute or if already exisiting replaces it.
328 NcVarAtt NcVar::putAtt(const string& name, const NcType& type, unsigned short datumValue) const {
329  ncCheckDefineMode(groupId);
330  NcType::ncType typeClass(type.getTypeClass());
331  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
332  ncCheck(nc_put_att(groupId,myId,name.c_str(),type.getId(),1,&datumValue),__FILE__,__LINE__);
333  else
334  ncCheck(nc_put_att_ushort(groupId,myId,name.c_str(),type.getId(),1,&datumValue),__FILE__,__LINE__);
335  // finally instantiate this attribute and return
336  return getAtt(name);
337 }
338 
339 // Creates a new NetCDF variable attribute or if already exisiting replaces it.
340 NcVarAtt NcVar::putAtt(const string& name, const NcType& type, unsigned int datumValue) const {
341  ncCheckDefineMode(groupId);
342  NcType::ncType typeClass(type.getTypeClass());
343  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
344  ncCheck(nc_put_att(groupId,myId,name.c_str(),type.getId(),1,&datumValue),__FILE__,__LINE__);
345  else
346  ncCheck(nc_put_att_uint(groupId,myId,name.c_str(),type.getId(),1,&datumValue),__FILE__,__LINE__);
347  // finally instantiate this attribute and return
348  return getAtt(name);
349 }
350 
351 // Creates a new NetCDF variable attribute or if already exisiting replaces it.
352 NcVarAtt NcVar::putAtt(const string& name, const NcType& type, long long datumValue) const {
353  ncCheckDefineMode(groupId);
354  NcType::ncType typeClass(type.getTypeClass());
355  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
356  ncCheck(nc_put_att(groupId,myId,name.c_str(),type.getId(),1,&datumValue),__FILE__,__LINE__);
357  else
358  ncCheck(nc_put_att_longlong(groupId,myId,name.c_str(),type.getId(),1,&datumValue),__FILE__,__LINE__);
359  // finally instantiate this attribute and return
360  return getAtt(name);
361 }
362 
363 
364 // Creates a new NetCDF variable attribute or if already exisiting replaces it.
365 NcVarAtt NcVar::putAtt(const string& name, const NcType& type, unsigned long long datumValue) const {
366  ncCheckDefineMode(groupId);
367  NcType::ncType typeClass(type.getTypeClass());
368  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
369  ncCheck(nc_put_att(groupId,myId,name.c_str(),type.getId(),1,&datumValue),__FILE__,__LINE__);
370  else
371  ncCheck(nc_put_att_ulonglong(groupId,myId,name.c_str(),type.getId(),1,&datumValue),__FILE__,__LINE__);
372  // finally instantiate this attribute and return
373  return getAtt(name);
374 }
375 
376 
378 
379 
380 
381 
382 
383 
384 
385 
386 
387 
388 
389 // Creates a new NetCDF variable attribute or if already exisiting replaces it.
390 NcVarAtt NcVar::putAtt(const string& name, const NcType& type, size_t len, const short* dataValues) const {
391  ncCheckDefineMode(groupId);
392  NcType::ncType typeClass(type.getTypeClass());
393  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
394  ncCheck(nc_put_att(groupId,myId,name.c_str(),type.getId(),len,dataValues),__FILE__,__LINE__);
395  else
396  ncCheck(nc_put_att_short(groupId,myId,name.c_str(),type.getId(),len,dataValues),__FILE__,__LINE__);
397  // finally instantiate this attribute and return
398  return getAtt(name);
399 }
400 
401 
402 // Creates a new NetCDF variable attribute or if already exisiting replaces it.
403 NcVarAtt NcVar::putAtt(const string& name, const NcType& type, size_t len, const int* dataValues) const {
404  ncCheckDefineMode(groupId);
405  NcType::ncType typeClass(type.getTypeClass());
406  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
407  ncCheck(nc_put_att(groupId,myId,name.c_str(),type.getId(),len,dataValues),__FILE__,__LINE__);
408  else
409  ncCheck(nc_put_att_int(groupId,myId,name.c_str(),type.getId(),len,dataValues),__FILE__,__LINE__);
410  // finally instantiate this attribute and return
411  return getAtt(name);
412 }
413 
414 // Creates a new NetCDF variable attribute or if already exisiting replaces it.
415 NcVarAtt NcVar::putAtt(const string& name, const NcType& type, size_t len, const long* dataValues) const {
416  ncCheckDefineMode(groupId);
417  NcType::ncType typeClass(type.getTypeClass());
418  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
419  ncCheck(nc_put_att(groupId,myId,name.c_str(),type.getId(),len,dataValues),__FILE__,__LINE__);
420  else
421  ncCheck(nc_put_att_long(groupId,myId,name.c_str(),type.getId(),len,dataValues),__FILE__,__LINE__);
422  // finally instantiate this attribute and return
423  return getAtt(name);
424 }
425 
426 // Creates a new NetCDF variable attribute or if already exisiting replaces it.
427 NcVarAtt NcVar::putAtt(const string& name, const NcType& type, size_t len, const float* dataValues) const {
428  ncCheckDefineMode(groupId);
429  NcType::ncType typeClass(type.getTypeClass());
430  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
431  ncCheck(nc_put_att(groupId,myId,name.c_str(),type.getId(),len,dataValues),__FILE__,__LINE__);
432  else
433  ncCheck(nc_put_att_float(groupId,myId,name.c_str(),type.getId(),len,dataValues),__FILE__,__LINE__);
434  // finally instantiate this attribute and return
435  return getAtt(name);
436 }
437 
438 
439 // Creates a new NetCDF variable attribute or if already exisiting replaces it.
440 NcVarAtt NcVar::putAtt(const string& name, const NcType& type, size_t len, const double* dataValues) const {
441  ncCheckDefineMode(groupId);
442  NcType::ncType typeClass(type.getTypeClass());
443  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
444  ncCheck(nc_put_att(groupId,myId,name.c_str(),type.getId(),len,dataValues),__FILE__,__LINE__);
445  else
446  ncCheck(nc_put_att_double(groupId,myId,name.c_str(),type.getId(),len,dataValues),__FILE__,__LINE__);
447  // finally instantiate this attribute and return
448  return getAtt(name);
449 }
450 
451 
452 // Creates a new NetCDF variable attribute or if already exisiting replaces it.
453 NcVarAtt NcVar::putAtt(const string& name, const NcType& type, size_t len, const unsigned short* dataValues) const {
454  ncCheckDefineMode(groupId);
455  NcType::ncType typeClass(type.getTypeClass());
456  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
457  ncCheck(nc_put_att(groupId,myId,name.c_str(),type.getId(),len,dataValues),__FILE__,__LINE__);
458  else
459  ncCheck(nc_put_att_ushort(groupId,myId,name.c_str(),type.getId(),len,dataValues),__FILE__,__LINE__);
460  // finally instantiate this attribute and return
461  return getAtt(name);
462 }
463 
464 // Creates a new NetCDF variable attribute or if already exisiting replaces it.
465 NcVarAtt NcVar::putAtt(const string& name, const NcType& type, size_t len, const unsigned int* dataValues) const {
466  ncCheckDefineMode(groupId);
467  NcType::ncType typeClass(type.getTypeClass());
468  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
469  ncCheck(nc_put_att(groupId,myId,name.c_str(),type.getId(),len,dataValues),__FILE__,__LINE__);
470  else
471  ncCheck(nc_put_att_uint(groupId,myId,name.c_str(),type.getId(),len,dataValues),__FILE__,__LINE__);
472  // finally instantiate this attribute and return
473  return getAtt(name);
474 }
475 
476 // Creates a new NetCDF variable attribute or if already exisiting replaces it.
477 NcVarAtt NcVar::putAtt(const string& name, const NcType& type, size_t len, const long long* dataValues) const {
478  ncCheckDefineMode(groupId);
479  NcType::ncType typeClass(type.getTypeClass());
480  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
481  ncCheck(nc_put_att(groupId,myId,name.c_str(),type.getId(),len,dataValues),__FILE__,__LINE__);
482  else
483  ncCheck(nc_put_att_longlong(groupId,myId,name.c_str(),type.getId(),len,dataValues),__FILE__,__LINE__);
484  // finally instantiate this attribute and return
485  return getAtt(name);
486 }
487 
488 
489 // Creates a new NetCDF variable attribute or if already exisiting replaces it.
490 NcVarAtt NcVar::putAtt(const string& name, const NcType& type, size_t len, const unsigned long long* dataValues) const {
491  ncCheckDefineMode(groupId);
492  NcType::ncType typeClass(type.getTypeClass());
493  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
494  ncCheck(nc_put_att(groupId,myId,name.c_str(),type.getId(),len,dataValues),__FILE__,__LINE__);
495  else
496  ncCheck(nc_put_att_ulonglong(groupId,myId,name.c_str(),type.getId(),len,dataValues),__FILE__,__LINE__);
497  // finally instantiate this attribute and return
498  return getAtt(name);
499 }
500 
501 
502 // Creates a new NetCDF variable attribute or if already exisiting replaces it.
503 NcVarAtt NcVar::putAtt(const string& name, size_t len, const char** dataValues) const {
504  ncCheckDefineMode(groupId);
505  ncCheck(nc_put_att_string(groupId,myId,name.c_str(),len,dataValues),__FILE__,__LINE__);
506  // finally instantiate this attribute and return
507  return getAtt(name);
508 }
509 
510 // Creates a new NetCDF variable attribute or if already exisiting replaces it.
511 NcVarAtt NcVar::putAtt(const string& name, const NcType& type, size_t len, const void* dataValues) const {
512  ncCheckDefineMode(groupId);
513  ncCheck(nc_put_att(groupId,myId ,name.c_str(),type.getId(),len,dataValues),__FILE__,__LINE__);
514  // finally instantiate this attribute and return
515  return getAtt(name);
516 }
517 
518 
519 
520 
522 
523 // Other Basic variable info
524 
526 
527 // The name of this variable.
528 string NcVar::getName() const{
529  char charName[NC_MAX_NAME+1];
530  ncCheck(nc_inq_varname(groupId, myId, charName),__FILE__,__LINE__);
531  return string(charName);
532 }
533 
534 
536 
537 // Chunking details
538 
540 
541 
542 // Sets chunking parameters.
543 void NcVar::setChunking(ChunkMode chunkMode, vector<size_t>& chunkSizes) const {
544  size_t *chunkSizesPtr = chunkSizes.empty() ? 0 : &chunkSizes[0];
545  ncCheck(nc_def_var_chunking(groupId,myId,static_cast<int> (chunkMode), chunkSizesPtr),__FILE__,__LINE__);
546 }
547 
548 
549 // Gets the chunking parameters
550 void NcVar::getChunkingParameters(ChunkMode& chunkMode, vector<size_t>& chunkSizes) const {
551  int chunkModeInt;
552  chunkSizes.resize(getDimCount());
553  size_t *chunkSizesPtr = chunkSizes.empty() ? 0 : &chunkSizes[0];
554  ncCheck(nc_inq_var_chunking(groupId,myId, &chunkModeInt, chunkSizesPtr),__FILE__,__LINE__);
555  chunkMode = static_cast<ChunkMode> (chunkModeInt);
556 }
557 
558 
559 
560 
562 
563 // Fill details
564 
566 
567 
568 // Sets the fill parameters
569 void NcVar::setFill(bool fillMode, void* fillValue) const {
570  // If fillMode is enabled, check that fillValue has a legal pointer.
571  if(fillMode && fillValue == NULL)
572  throw NcException("FillMode was set to zero but fillValue has invalid pointer",__FILE__,__LINE__);
573 
574  ncCheck(nc_def_var_fill(groupId,myId,static_cast<int> (!fillMode),fillValue),__FILE__,__LINE__);
575 }
576 
577 // Sets the fill parameters
578 void NcVar::setFill(bool fillMode,const void* fillValue) const {
579  setFill(fillMode,const_cast<void*>(fillValue));
580 }
581 
582 
583 
584 // Gets the fill parameters
585 void NcVar::getFillModeParameters(bool& fillMode, void* fillValue)const{
586 
587  int fillModeInt;
588  ncCheck(nc_inq_var_fill(groupId,myId,&fillModeInt,fillValue),__FILE__,__LINE__);
589  fillMode= static_cast<bool> (fillModeInt == 0);
590 }
591 
592 
594 
595 // Compression details
596 
598 
599 
600 // Sets the compression parameters
601 void NcVar::setCompression(bool enableShuffleFilter, bool enableDeflateFilter, int deflateLevel) const {
602 
603  // Check that the deflate level is legal
604  if(enableDeflateFilter & (deflateLevel < 0 || deflateLevel >9))
605  throw NcException("The deflateLevel must be set between 0 and 9.",__FILE__,__LINE__);
606 
607  ncCheck(nc_def_var_deflate(groupId,myId,
608  static_cast<int> (enableShuffleFilter),
609  static_cast<int> (enableDeflateFilter),
610  deflateLevel),__FILE__,__LINE__);
611 }
612 
613 
614 // Gets the compression parameters
615 void NcVar::getCompressionParameters(bool& shuffleFilterEnabled, bool& deflateFilterEnabled, int& deflateLevel) const {
616 
617  int enableShuffleFilterInt;
618  int enableDeflateFilterInt;
619  ncCheck(nc_inq_var_deflate(groupId,myId,
620  &enableShuffleFilterInt,
621  &enableDeflateFilterInt,
622  &deflateLevel),__FILE__,__LINE__);
623  shuffleFilterEnabled = static_cast<bool> (enableShuffleFilterInt);
624  deflateFilterEnabled = static_cast<bool> (enableDeflateFilterInt);
625 }
626 
627 
628 
630 
631 // Endianness details
632 
634 
635 
636 // Sets the endianness of the variable.
637 void NcVar::setEndianness(EndianMode endianMode) const {
638 
639  ncCheck(nc_def_var_endian(groupId,myId,static_cast<int> (endianMode)),__FILE__,__LINE__);
640 }
641 
642 
643 // Gets the endianness of the variable.
645 
646  int endianInt;
647  ncCheck(nc_inq_var_endian(groupId,myId,&endianInt),__FILE__,__LINE__);
648  return static_cast<EndianMode> (endianInt);
649 }
650 
651 
652 
654 
655 // Checksum details
656 
658 
659 
660 // Sets the checksum parameters of a variable.
661 void NcVar::setChecksum(ChecksumMode checksumMode) const {
662  ncCheck(nc_def_var_fletcher32(groupId,myId,static_cast<int> (checksumMode)),__FILE__,__LINE__);
663 }
664 
665 
666 // Gets the checksum parameters of the variable.
668  int checksumInt;
669  ncCheck(nc_inq_var_fletcher32(groupId,myId,&checksumInt),__FILE__,__LINE__);
670  return static_cast<ChecksumMode> (checksumInt);
671 }
672 
673 
674 
675 
677 
678 // renaming the variable
679 
681 
682 void NcVar::rename( const string& newname ) const
683 {
684  ncCheck(nc_rename_var(groupId,myId,newname.c_str()),__FILE__,__LINE__);
685 }
686 
687 
688 
689 
690 
692 
693 // data writing
694 
696 
697 // Writes the entire data into the netCDF variable.
698 void NcVar::putVar(const char* dataValues) const {
699  ncCheckDataMode(groupId);
700  NcType::ncType typeClass(getType().getTypeClass());
701  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
702  ncCheck(nc_put_var(groupId, myId,dataValues),__FILE__,__LINE__);
703  else
704  ncCheck(nc_put_var_text(groupId, myId,dataValues),__FILE__,__LINE__);
705 }
706 // Writes the entire data into the netCDF variable.
707 void NcVar::putVar(const unsigned char* dataValues) const {
708  ncCheckDataMode(groupId);
709  NcType::ncType typeClass(getType().getTypeClass());
710  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
711  ncCheck(nc_put_var(groupId, myId,dataValues),__FILE__,__LINE__);
712  else
713  ncCheck(nc_put_var_uchar(groupId, myId,dataValues),__FILE__,__LINE__);
714 }
715 // Writes the entire data into the netCDF variable.
716 void NcVar::putVar(const signed char* dataValues) const {
717  ncCheckDataMode(groupId);
718  NcType::ncType typeClass(getType().getTypeClass());
719  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
720  ncCheck(nc_put_var(groupId, myId,dataValues),__FILE__,__LINE__);
721  else
722  ncCheck(nc_put_var_schar(groupId, myId,dataValues),__FILE__,__LINE__);
723 }
724 // Writes the entire data into the netCDF variable.
725 void NcVar::putVar(const short* dataValues) const {
726  ncCheckDataMode(groupId);
727  NcType::ncType typeClass(getType().getTypeClass());
728  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
729  ncCheck(nc_put_var(groupId, myId,dataValues),__FILE__,__LINE__);
730  else
731  ncCheck(nc_put_var_short(groupId, myId,dataValues),__FILE__,__LINE__);
732 }
733 // Writes the entire data into the netCDF variable.
734 void NcVar::putVar(const int* dataValues) const {
735  ncCheckDataMode(groupId);
736  NcType::ncType typeClass(getType().getTypeClass());
737  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
738  ncCheck(nc_put_var(groupId, myId,dataValues),__FILE__,__LINE__);
739  else
740  ncCheck(nc_put_var_int(groupId, myId,dataValues),__FILE__,__LINE__);
741 }
742 // Writes the entire data into the netCDF variable.
743 void NcVar::putVar(const long* dataValues) const {
744  ncCheckDataMode(groupId);
745  NcType::ncType typeClass(getType().getTypeClass());
746  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
747  ncCheck(nc_put_var(groupId, myId,dataValues),__FILE__,__LINE__);
748  else
749  ncCheck(nc_put_var_long(groupId, myId,dataValues),__FILE__,__LINE__);
750 }
751 // Writes the entire data into the netCDF variable.
752 void NcVar::putVar(const float* dataValues) const {
753  ncCheckDataMode(groupId);
754  NcType::ncType typeClass(getType().getTypeClass());
755  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
756  ncCheck(nc_put_var(groupId, myId,dataValues),__FILE__,__LINE__);
757  else
758  ncCheck(nc_put_var_float(groupId, myId,dataValues),__FILE__,__LINE__);
759 }
760 // Writes the entire data into the netCDF variable.
761 void NcVar::putVar(const double* dataValues) const {
762  ncCheckDataMode(groupId);
763  NcType::ncType typeClass(getType().getTypeClass());
764  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
765  ncCheck(nc_put_var(groupId, myId,dataValues),__FILE__,__LINE__);
766  else
767  ncCheck(nc_put_var_double(groupId, myId,dataValues),__FILE__,__LINE__);
768 }
769 // Writes the entire data into the netCDF variable.
770 void NcVar::putVar(const unsigned short* dataValues) const {
771  ncCheckDataMode(groupId);
772  NcType::ncType typeClass(getType().getTypeClass());
773  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
774  ncCheck(nc_put_var(groupId, myId,dataValues),__FILE__,__LINE__);
775  else
776  ncCheck(nc_put_var_ushort(groupId, myId,dataValues),__FILE__,__LINE__);
777 }
778 // Writes the entire data into the netCDF variable.
779 void NcVar::putVar(const unsigned int* dataValues) const {
780  ncCheckDataMode(groupId);
781  NcType::ncType typeClass(getType().getTypeClass());
782  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
783  ncCheck(nc_put_var(groupId, myId,dataValues),__FILE__,__LINE__);
784  else
785  ncCheck(nc_put_var_uint(groupId, myId,dataValues),__FILE__,__LINE__);
786 }
787 // Writes the entire data into the netCDF variable.
788 void NcVar::putVar(const long long* dataValues) const {
789  ncCheckDataMode(groupId);
790  NcType::ncType typeClass(getType().getTypeClass());
791  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
792  ncCheck(nc_put_var(groupId, myId,dataValues),__FILE__,__LINE__);
793  else
794  ncCheck(nc_put_var_longlong(groupId, myId,dataValues),__FILE__,__LINE__);
795 }
796 // Writes the entire data into the netCDF variable.
797 void NcVar::putVar(const unsigned long long* dataValues) const {
798  ncCheckDataMode(groupId);
799  NcType::ncType typeClass(getType().getTypeClass());
800  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
801  ncCheck(nc_put_var(groupId, myId,dataValues),__FILE__,__LINE__);
802  else
803  ncCheck(nc_put_var_ulonglong(groupId, myId,dataValues),__FILE__,__LINE__);
804 }
805 // Writes the entire data into the netCDF variable.
806 void NcVar::putVar(const char** dataValues) const {
807  ncCheckDataMode(groupId);
808  NcType::ncType typeClass(getType().getTypeClass());
809  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
810  ncCheck(nc_put_var(groupId, myId,dataValues),__FILE__,__LINE__);
811  else
812  ncCheck(nc_put_var_string(groupId, myId,dataValues),__FILE__,__LINE__);
813 }
814 // Writes the entire data into the netCDF variable with no data conversion.
815 void NcVar::putVar(const void* dataValues) const {
816  ncCheckDataMode(groupId);
817  ncCheck(nc_put_var(groupId, myId,dataValues),__FILE__,__LINE__);
818 }
819 
820 
822 // Writes a single datum value into the netCDF variable.
823 void NcVar::putVar(const vector<size_t>& index, const string& datumValue) const {
824  ncCheckDataMode(groupId);
825  NcType::ncType typeClass(getType().getTypeClass());
826  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
827  throw NcException("user-defined type must be of type void",__FILE__,__LINE__);
828  else
829  {
830  const char* tmpPtr = datumValue.c_str();
831  ncCheck(nc_put_var1_string(groupId, myId,&index[0],&tmpPtr),__FILE__,__LINE__);
832  }
833 }
834 // Writes a single datum value into the netCDF variable.
835 void NcVar::putVar(const vector<size_t>& index, const unsigned char* datumValue) const {
836  ncCheckDataMode(groupId);
837  NcType::ncType typeClass(getType().getTypeClass());
838  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
839  throw NcException("user-defined type must be of type void",__FILE__,__LINE__);
840  else
841  ncCheck(nc_put_var1_uchar(groupId, myId,&index[0],datumValue),__FILE__,__LINE__);
842 }
843 // Writes a single datum value into the netCDF variable.
844 void NcVar::putVar(const vector<size_t>& index, const signed char* datumValue) const {
845  ncCheckDataMode(groupId);
846  NcType::ncType typeClass(getType().getTypeClass());
847  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
848  throw NcException("user-defined type must be of type void",__FILE__,__LINE__);
849  else
850  ncCheck(nc_put_var1_schar(groupId, myId,&index[0],datumValue),__FILE__,__LINE__);
851 }
852 // Writes a single datum value into the netCDF variable.
853 void NcVar::putVar(const vector<size_t>& index, const short datumValue) const {
854  ncCheckDataMode(groupId);
855  NcType::ncType typeClass(getType().getTypeClass());
856  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
857  ncCheck(nc_put_var1(groupId, myId,&index[0],&datumValue),__FILE__,__LINE__);
858  else
859  ncCheck(nc_put_var1_short(groupId, myId,&index[0],&datumValue),__FILE__,__LINE__);
860 }
861 // Writes a single datum value into the netCDF variable.
862 void NcVar::putVar(const vector<size_t>& index, const int datumValue) const {
863  ncCheckDataMode(groupId);
864  NcType::ncType typeClass(getType().getTypeClass());
865  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
866  ncCheck(nc_put_var1(groupId, myId,&index[0],&datumValue),__FILE__,__LINE__);
867  else
868  ncCheck(nc_put_var1_int(groupId, myId,&index[0],&datumValue),__FILE__,__LINE__);
869 }
870 // Writes a single datum value into the netCDF variable.
871 void NcVar::putVar(const vector<size_t>& index, const long datumValue) const {
872  ncCheckDataMode(groupId);
873  NcType::ncType typeClass(getType().getTypeClass());
874  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
875  ncCheck(nc_put_var1(groupId, myId,&index[0],&datumValue),__FILE__,__LINE__);
876  else
877  ncCheck(nc_put_var1_long(groupId, myId,&index[0],&datumValue),__FILE__,__LINE__);
878 }
879 // Writes a single datum value into the netCDF variable.
880 void NcVar::putVar(const vector<size_t>& index, const float datumValue) const {
881  ncCheckDataMode(groupId);
882  NcType::ncType typeClass(getType().getTypeClass());
883  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
884  ncCheck(nc_put_var1(groupId, myId,&index[0],&datumValue),__FILE__,__LINE__);
885  else
886  ncCheck(nc_put_var1_float(groupId, myId,&index[0],&datumValue),__FILE__,__LINE__);
887 }
888 // Writes a single datum value into the netCDF variable.
889 void NcVar::putVar(const vector<size_t>& index, const double datumValue) const {
890  ncCheckDataMode(groupId);
891  NcType::ncType typeClass(getType().getTypeClass());
892  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
893  ncCheck(nc_put_var1(groupId, myId,&index[0],&datumValue),__FILE__,__LINE__);
894  else
895  ncCheck(nc_put_var1_double(groupId, myId,&index[0],&datumValue),__FILE__,__LINE__);
896 }
897 // Writes a single datum value into the netCDF variable.
898 void NcVar::putVar(const vector<size_t>& index, const unsigned short datumValue) const {
899  ncCheckDataMode(groupId);
900  NcType::ncType typeClass(getType().getTypeClass());
901  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
902  ncCheck(nc_put_var1(groupId, myId,&index[0],&datumValue),__FILE__,__LINE__);
903  else
904  ncCheck(nc_put_var1_ushort(groupId, myId,&index[0],&datumValue),__FILE__,__LINE__);
905 }
906 // Writes a single datum value into the netCDF variable.
907 void NcVar::putVar(const vector<size_t>& index, const unsigned int datumValue) const {
908  ncCheckDataMode(groupId);
909  NcType::ncType typeClass(getType().getTypeClass());
910  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
911  ncCheck(nc_put_var1(groupId, myId,&index[0],&datumValue),__FILE__,__LINE__);
912  else
913  ncCheck(nc_put_var1_uint(groupId, myId,&index[0],&datumValue),__FILE__,__LINE__);
914 }
915 // Writes a single datum value into the netCDF variable.
916 void NcVar::putVar(const vector<size_t>& index, const long long datumValue) const {
917  ncCheckDataMode(groupId);
918  NcType::ncType typeClass(getType().getTypeClass());
919  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
920  ncCheck(nc_put_var1(groupId, myId,&index[0],&datumValue),__FILE__,__LINE__);
921  else
922  ncCheck(nc_put_var1_longlong(groupId, myId,&index[0],&datumValue),__FILE__,__LINE__);
923 }
924 // Writes a single datum value into the netCDF variable.
925 void NcVar::putVar(const vector<size_t>& index, const unsigned long long datumValue) const {
926  ncCheckDataMode(groupId);
927  NcType::ncType typeClass(getType().getTypeClass());
928  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
929  ncCheck(nc_put_var1(groupId, myId,&index[0],&datumValue),__FILE__,__LINE__);
930  else
931  ncCheck(nc_put_var1_ulonglong(groupId, myId,&index[0],&datumValue),__FILE__,__LINE__);
932 }
933 // Writes a single datum value into the netCDF variable.
934 void NcVar::putVar(const vector<size_t>& index, const char** datumValue) const {
935  ncCheckDataMode(groupId);
936  NcType::ncType typeClass(getType().getTypeClass());
937  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
938  throw NcException("user-defined type must be of type void",__FILE__,__LINE__);
939  else
940  ncCheck(nc_put_var1_string(groupId, myId,&index[0],datumValue),__FILE__,__LINE__);
941 }
942 // Writes a single datum value into the netCDF variable with no data conversion.
943 void NcVar::putVar(const vector<size_t>& index, const void* datumValue) const {
944  ncCheckDataMode(groupId);
945  ncCheck(nc_put_var1(groupId, myId,&index[0],datumValue),__FILE__,__LINE__);
946 }
947 
948 
950 
951 // Writes an array of values into the netCDF variable.
952 void NcVar::putVar(const vector<size_t>& startp, const vector<size_t>& countp, const char* dataValues) const {
953  ncCheckDataMode(groupId);
954  NcType::ncType typeClass(getType().getTypeClass());
955  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
956  ncCheck(nc_put_vara(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__);
957  else
958  ncCheck(nc_put_vara_text(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__);
959 }
960 // Writes an array of values into the netCDF variable.
961 void NcVar::putVar(const vector<size_t>& startp, const vector<size_t>& countp, const unsigned char* dataValues) const {
962  ncCheckDataMode(groupId);
963  NcType::ncType typeClass(getType().getTypeClass());
964  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
965  ncCheck(nc_put_vara(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__);
966  else
967  ncCheck(nc_put_vara_uchar(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__);
968 }
969 // Writes an array of values into the netCDF variable.
970 void NcVar::putVar(const vector<size_t>& startp, const vector<size_t>& countp, const signed char* dataValues) const {
971  ncCheckDataMode(groupId);
972  NcType::ncType typeClass(getType().getTypeClass());
973  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
974  ncCheck(nc_put_vara(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__);
975  else
976  ncCheck(nc_put_vara_schar(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__);
977 }
978 // Writes an array of values into the netCDF variable.
979 void NcVar::putVar(const vector<size_t>& startp, const vector<size_t>& countp, const short* dataValues) const {
980  ncCheckDataMode(groupId);
981  NcType::ncType typeClass(getType().getTypeClass());
982  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
983  ncCheck(nc_put_vara(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__);
984  else
985  ncCheck(nc_put_vara_short(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__);
986 }
987 // Writes an array of values into the netCDF variable.
988 void NcVar::putVar(const vector<size_t>& startp, const vector<size_t>& countp, const int* dataValues) const {
989  ncCheckDataMode(groupId);
990  NcType::ncType typeClass(getType().getTypeClass());
991  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
992  ncCheck(nc_put_vara(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__);
993  else
994  ncCheck(nc_put_vara_int(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__);
995 }
996 // Writes an array of values into the netCDF variable.
997 void NcVar::putVar(const vector<size_t>& startp, const vector<size_t>& countp, const long* dataValues) const {
998  ncCheckDataMode(groupId);
999  NcType::ncType typeClass(getType().getTypeClass());
1000  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1001  ncCheck(nc_put_vara(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__);
1002  else
1003  ncCheck(nc_put_vara_long(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__);
1004 }
1005 // Writes an array of values into the netCDF variable.
1006 void NcVar::putVar(const vector<size_t>& startp, const vector<size_t>& countp, const float* dataValues) const {
1007  ncCheckDataMode(groupId);
1008  NcType::ncType typeClass(getType().getTypeClass());
1009  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1010  ncCheck(nc_put_vara(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__);
1011  else
1012  ncCheck(nc_put_vara_float(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__);
1013 }
1014 // Writes an array of values into the netCDF variable.
1015 void NcVar::putVar(const vector<size_t>& startp, const vector<size_t>& countp, const double* dataValues) const {
1016  ncCheckDataMode(groupId);
1017  NcType::ncType typeClass(getType().getTypeClass());
1018  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1019  ncCheck(nc_put_vara(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__);
1020  else
1021  ncCheck(nc_put_vara_double(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__);
1022 }
1023 // Writes an array of values into the netCDF variable.
1024 void NcVar::putVar(const vector<size_t>& startp, const vector<size_t>& countp, const unsigned short* dataValues) const {
1025  ncCheckDataMode(groupId);
1026  NcType::ncType typeClass(getType().getTypeClass());
1027  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1028  ncCheck(nc_put_vara(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__);
1029  else
1030  ncCheck(nc_put_vara_ushort(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__);
1031 }
1032 // Writes an array of values into the netCDF variable.
1033 void NcVar::putVar(const vector<size_t>& startp, const vector<size_t>& countp, const unsigned int* dataValues) const {
1034  ncCheckDataMode(groupId);
1035  NcType::ncType typeClass(getType().getTypeClass());
1036  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1037  ncCheck(nc_put_vara(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__);
1038  else
1039  ncCheck(nc_put_vara_uint(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__);
1040 }
1041 // Writes an array of values into the netCDF variable.
1042 void NcVar::putVar(const vector<size_t>& startp, const vector<size_t>& countp, const long long* dataValues) const {
1043  ncCheckDataMode(groupId);
1044  NcType::ncType typeClass(getType().getTypeClass());
1045  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1046  ncCheck(nc_put_vara(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__);
1047  else
1048  ncCheck(nc_put_vara_longlong(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__);
1049 }
1050 // Writes an array of values into the netCDF variable.
1051 void NcVar::putVar(const vector<size_t>& startp, const vector<size_t>& countp, const unsigned long long* dataValues) const {
1052  ncCheckDataMode(groupId);
1053  NcType::ncType typeClass(getType().getTypeClass());
1054  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1055  ncCheck(nc_put_vara(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__);
1056  else
1057  ncCheck(nc_put_vara_ulonglong(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__);
1058 }
1059 // Writes an array of values into the netCDF variable.
1060 void NcVar::putVar(const vector<size_t>& startp, const vector<size_t>& countp, const char** dataValues) const {
1061  ncCheckDataMode(groupId);
1062  NcType::ncType typeClass(getType().getTypeClass());
1063  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1064  ncCheck(nc_put_vara(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__);
1065  else
1066  ncCheck(nc_put_vara_string(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__);
1067 }
1068 // Writes an array of values into the netCDF variable with no data conversion.
1069 void NcVar::putVar(const vector<size_t>& startp, const vector<size_t>& countp, const void* dataValues) const {
1070  ncCheckDataMode(groupId);
1071  ncCheck(nc_put_vara(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__);
1072 }
1073 
1074 
1075 
1077 
1078 // Writes a set of subsampled array values into the netCDF variable.
1079 void NcVar::putVar(const vector<size_t>& startp, const vector<size_t>&countp, const vector<ptrdiff_t>& stridep, const char* dataValues) const {
1080  ncCheckDataMode(groupId);
1081  NcType::ncType typeClass(getType().getTypeClass());
1082  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1083  ncCheck(nc_put_vars(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__);
1084  else
1085  ncCheck(nc_put_vars_text(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__);
1086 }
1087 // Writes a set of subsampled array values into the netCDF variable.
1088 void NcVar::putVar(const vector<size_t>& startp, const vector<size_t>&countp, const vector<ptrdiff_t>& stridep, const unsigned char* dataValues) const {
1089  ncCheckDataMode(groupId);
1090  NcType::ncType typeClass(getType().getTypeClass());
1091  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1092  ncCheck(nc_put_vars(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__);
1093  else
1094  ncCheck(nc_put_vars_uchar(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__);
1095 }
1096 // Writes a set of subsampled array values into the netCDF variable.
1097 void NcVar::putVar(const vector<size_t>& startp, const vector<size_t>&countp, const vector<ptrdiff_t>& stridep, const signed char* dataValues) const {
1098  ncCheckDataMode(groupId);
1099  NcType::ncType typeClass(getType().getTypeClass());
1100  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1101  ncCheck(nc_put_vars(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__);
1102  else
1103  ncCheck(nc_put_vars_schar(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__);
1104 }
1105 // Writes a set of subsampled array values into the netCDF variable.
1106 void NcVar::putVar(const vector<size_t>& startp, const vector<size_t>&countp, const vector<ptrdiff_t>& stridep, const short* dataValues) const {
1107  ncCheckDataMode(groupId);
1108  NcType::ncType typeClass(getType().getTypeClass());
1109  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1110  ncCheck(nc_put_vars(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__);
1111  else
1112  ncCheck(nc_put_vars_short(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__);
1113 }
1114 // Writes a set of subsampled array values into the netCDF variable.
1115 void NcVar::putVar(const vector<size_t>& startp, const vector<size_t>&countp, const vector<ptrdiff_t>& stridep, const int* dataValues) const {
1116  ncCheckDataMode(groupId);
1117  NcType::ncType typeClass(getType().getTypeClass());
1118  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1119  ncCheck(nc_put_vars(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__);
1120  else
1121  ncCheck(nc_put_vars_int(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__);
1122 }
1123 // Writes a set of subsampled array values into the netCDF variable.
1124 void NcVar::putVar(const vector<size_t>& startp, const vector<size_t>&countp, const vector<ptrdiff_t>& stridep, const long* dataValues) const {
1125  ncCheckDataMode(groupId);
1126  NcType::ncType typeClass(getType().getTypeClass());
1127  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1128  ncCheck(nc_put_vars(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__);
1129  else
1130  ncCheck(nc_put_vars_long(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__);
1131 }
1132 // Writes a set of subsampled array values into the netCDF variable.
1133 void NcVar::putVar(const vector<size_t>& startp, const vector<size_t>&countp, const vector<ptrdiff_t>& stridep, const float* dataValues) const {
1134  ncCheckDataMode(groupId);
1135  NcType::ncType typeClass(getType().getTypeClass());
1136  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1137  ncCheck(nc_put_vars(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__);
1138  else
1139  ncCheck(nc_put_vars_float(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__);
1140 }
1141 // Writes a set of subsampled array values into the netCDF variable.
1142 void NcVar::putVar(const vector<size_t>& startp, const vector<size_t>&countp, const vector<ptrdiff_t>& stridep, const double* dataValues) const {
1143  ncCheckDataMode(groupId);
1144  NcType::ncType typeClass(getType().getTypeClass());
1145  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1146  ncCheck(nc_put_vars(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__);
1147  else
1148  ncCheck(nc_put_vars_double(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__);
1149 }
1150 // Writes a set of subsampled array values into the netCDF variable.
1151 void NcVar::putVar(const vector<size_t>& startp, const vector<size_t>&countp, const vector<ptrdiff_t>& stridep, const unsigned short* dataValues) const {
1152  ncCheckDataMode(groupId);
1153  NcType::ncType typeClass(getType().getTypeClass());
1154  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1155  ncCheck(nc_put_vars(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__);
1156  else
1157  ncCheck(nc_put_vars_ushort(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__);
1158 }
1159 // Writes a set of subsampled array values into the netCDF variable.
1160 void NcVar::putVar(const vector<size_t>& startp, const vector<size_t>&countp, const vector<ptrdiff_t>& stridep, const unsigned int* dataValues) const {
1161  ncCheckDataMode(groupId);
1162  NcType::ncType typeClass(getType().getTypeClass());
1163  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1164  ncCheck(nc_put_vars(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__);
1165  else
1166  ncCheck(nc_put_vars_uint(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__);
1167 }
1168 // Writes a set of subsampled array values into the netCDF variable.
1169 void NcVar::putVar(const vector<size_t>& startp, const vector<size_t>&countp, const vector<ptrdiff_t>& stridep, const long long* dataValues) const {
1170  ncCheckDataMode(groupId);
1171  NcType::ncType typeClass(getType().getTypeClass());
1172  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1173  ncCheck(nc_put_vars(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__);
1174  else
1175  ncCheck(nc_put_vars_longlong(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__);
1176 }
1177 // Writes a set of subsampled array values into the netCDF variable.
1178 void NcVar::putVar(const vector<size_t>& startp, const vector<size_t>&countp, const vector<ptrdiff_t>& stridep, const unsigned long long* dataValues) const {
1179  ncCheckDataMode(groupId);
1180  NcType::ncType typeClass(getType().getTypeClass());
1181  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1182  ncCheck(nc_put_vars(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__);
1183  else
1184  ncCheck(nc_put_vars_ulonglong(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__);
1185 }
1186 // Writes a set of subsampled array values into the netCDF variable.
1187 void NcVar::putVar(const vector<size_t>& startp, const vector<size_t>&countp, const vector<ptrdiff_t>& stridep, const char** dataValues) const {
1188  ncCheckDataMode(groupId);
1189  NcType::ncType typeClass(getType().getTypeClass());
1190  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1191  ncCheck(nc_put_vars(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__);
1192  else
1193  ncCheck(nc_put_vars_string(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__);
1194 }
1195 // Writes a set of subsampled array values into the netCDF variable with no data conversion.
1196 void NcVar::putVar(const vector<size_t>& startp, const vector<size_t>&countp, const vector<ptrdiff_t>& stridep, const void* dataValues) const {
1197  ncCheckDataMode(groupId);
1198  ncCheck(nc_put_vars(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__);
1199 }
1200 
1201 
1203 // Writes a mapped array section of values into the netCDF variable.
1204 void NcVar::putVar(const vector<size_t>& startp, const vector<size_t>&countp, const vector<ptrdiff_t>& stridep, const vector<ptrdiff_t>& imapp, const char* dataValues) const {
1205  ncCheckDataMode(groupId);
1206  NcType::ncType typeClass(getType().getTypeClass());
1207  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1208  ncCheck(nc_put_varm(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__);
1209  else
1210  ncCheck(nc_put_varm_text(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__);
1211 }
1212 // Writes a mapped array section of values into the netCDF variable.
1213 void NcVar::putVar(const vector<size_t>& startp, const vector<size_t>&countp, const vector<ptrdiff_t>& stridep, const vector<ptrdiff_t>& imapp, const unsigned char* dataValues) const {
1214  ncCheckDataMode(groupId);
1215  NcType::ncType typeClass(getType().getTypeClass());
1216  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1217  ncCheck(nc_put_varm(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__);
1218  else
1219  ncCheck(nc_put_varm_uchar(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__);
1220 }
1221 // Writes a mapped array section of values into the netCDF variable.
1222 void NcVar::putVar(const vector<size_t>& startp, const vector<size_t>&countp, const vector<ptrdiff_t>& stridep, const vector<ptrdiff_t>& imapp, const signed char* dataValues) const {
1223  ncCheckDataMode(groupId);
1224  NcType::ncType typeClass(getType().getTypeClass());
1225  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1226  ncCheck(nc_put_varm(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__);
1227  else
1228  ncCheck(nc_put_varm_schar(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__);
1229 }
1230 // Writes a mapped array section of values into the netCDF variable.
1231 void NcVar::putVar(const vector<size_t>& startp, const vector<size_t>&countp, const vector<ptrdiff_t>& stridep, const vector<ptrdiff_t>& imapp, const short* dataValues) const {
1232  ncCheckDataMode(groupId);
1233  NcType::ncType typeClass(getType().getTypeClass());
1234  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1235  ncCheck(nc_put_varm(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__);
1236  else
1237  ncCheck(nc_put_varm_short(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__);
1238 }
1239 // Writes a mapped array section of values into the netCDF variable.
1240 void NcVar::putVar(const vector<size_t>& startp, const vector<size_t>&countp, const vector<ptrdiff_t>& stridep, const vector<ptrdiff_t>& imapp, const int* dataValues) const {
1241  ncCheckDataMode(groupId);
1242  NcType::ncType typeClass(getType().getTypeClass());
1243  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1244  ncCheck(nc_put_varm(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__);
1245  else
1246  ncCheck(nc_put_varm_int(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__);
1247 }
1248 // Writes a mapped array section of values into the netCDF variable.
1249 void NcVar::putVar(const vector<size_t>& startp, const vector<size_t>&countp, const vector<ptrdiff_t>& stridep, const vector<ptrdiff_t>& imapp, const long* dataValues) const {
1250  ncCheckDataMode(groupId);
1251  NcType::ncType typeClass(getType().getTypeClass());
1252  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1253  ncCheck(nc_put_varm(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__);
1254  else
1255  ncCheck(nc_put_varm_long(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__);
1256 }
1257 // Writes a mapped array section of values into the netCDF variable.
1258 void NcVar::putVar(const vector<size_t>& startp, const vector<size_t>&countp, const vector<ptrdiff_t>& stridep, const vector<ptrdiff_t>& imapp, const float* dataValues) const {
1259  ncCheckDataMode(groupId);
1260  NcType::ncType typeClass(getType().getTypeClass());
1261  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1262  ncCheck(nc_put_varm(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__);
1263  else
1264  ncCheck(nc_put_varm_float(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__);
1265 }
1266 // Writes a mapped array section of values into the netCDF variable.
1267 void NcVar::putVar(const vector<size_t>& startp, const vector<size_t>&countp, const vector<ptrdiff_t>& stridep, const vector<ptrdiff_t>& imapp, const double* dataValues) const {
1268  ncCheckDataMode(groupId);
1269  NcType::ncType typeClass(getType().getTypeClass());
1270  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1271  ncCheck(nc_put_varm(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__);
1272  else
1273  ncCheck(nc_put_varm_double(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__);
1274 }
1275 // Writes a mapped array section of values into the netCDF variable.
1276 void NcVar::putVar(const vector<size_t>& startp, const vector<size_t>&countp, const vector<ptrdiff_t>& stridep, const vector<ptrdiff_t>& imapp, const unsigned short* dataValues) const {
1277  ncCheckDataMode(groupId);
1278  NcType::ncType typeClass(getType().getTypeClass());
1279  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1280  ncCheck(nc_put_varm(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__);
1281  else
1282  ncCheck(nc_put_varm_ushort(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__);
1283 }
1284 // Writes a mapped array section of values into the netCDF variable.
1285 void NcVar::putVar(const vector<size_t>& startp, const vector<size_t>&countp, const vector<ptrdiff_t>& stridep, const vector<ptrdiff_t>& imapp, const unsigned int* dataValues) const {
1286  ncCheckDataMode(groupId);
1287  NcType::ncType typeClass(getType().getTypeClass());
1288  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1289  ncCheck(nc_put_varm(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__);
1290  else
1291  ncCheck(nc_put_varm_uint(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__);
1292 }
1293 // Writes a mapped array section of values into the netCDF variable.
1294 void NcVar::putVar(const vector<size_t>& startp, const vector<size_t>&countp, const vector<ptrdiff_t>& stridep, const vector<ptrdiff_t>& imapp, const long long* dataValues) const {
1295  ncCheckDataMode(groupId);
1296  NcType::ncType typeClass(getType().getTypeClass());
1297  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1298  ncCheck(nc_put_varm(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__);
1299  else
1300  ncCheck(nc_put_varm_longlong(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__);
1301 }
1302 // Writes a mapped array section of values into the netCDF variable.
1303 void NcVar::putVar(const vector<size_t>& startp, const vector<size_t>&countp, const vector<ptrdiff_t>& stridep, const vector<ptrdiff_t>& imapp, const unsigned long long* dataValues) const {
1304  ncCheckDataMode(groupId);
1305  NcType::ncType typeClass(getType().getTypeClass());
1306  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1307  ncCheck(nc_put_varm(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__);
1308  else
1309  ncCheck(nc_put_varm_ulonglong(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__);
1310 }
1311 // Writes a mapped array section of values into the netCDF variable.
1312 void NcVar::putVar(const vector<size_t>& startp, const vector<size_t>&countp, const vector<ptrdiff_t>& stridep, const vector<ptrdiff_t>& imapp, const char** dataValues) const {
1313  ncCheckDataMode(groupId);
1314  NcType::ncType typeClass(getType().getTypeClass());
1315  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1316  ncCheck(nc_put_varm(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__);
1317  else
1318  ncCheck(nc_put_varm_string(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__);
1319 }
1320 // Writes a mapped array section of values into the netCDF variable with no data conversion.
1321 void NcVar::putVar(const vector<size_t>& startp, const vector<size_t>&countp, const vector<ptrdiff_t>& stridep, const vector<ptrdiff_t>& imapp, const void* dataValues) const {
1322  ncCheckDataMode(groupId);
1323  ncCheck(nc_put_varm(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__);
1324 }
1325 
1326 
1327 
1328 
1329 
1330 // Data reading
1331 
1332 
1333 
1334 // Reads the entire data of the netCDF variable.
1335 void NcVar::getVar(char* dataValues) const {
1336  NcType::ncType typeClass(getType().getTypeClass());
1337  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1338  ncCheck(nc_get_var(groupId, myId,dataValues),__FILE__,__LINE__);
1339  else
1340  ncCheck(nc_get_var_text(groupId, myId,dataValues),__FILE__,__LINE__);
1341 }
1342 // Reads the entire data of the netCDF variable.
1343 void NcVar::getVar(unsigned char* dataValues) const {
1344  NcType::ncType typeClass(getType().getTypeClass());
1345  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1346  ncCheck(nc_get_var(groupId, myId,dataValues),__FILE__,__LINE__);
1347  else
1348  ncCheck(nc_get_var_uchar(groupId, myId,dataValues),__FILE__,__LINE__);
1349 }
1350 // Reads the entire data of the netCDF variable.
1351 void NcVar::getVar(signed char* dataValues) const {
1352  NcType::ncType typeClass(getType().getTypeClass());
1353  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1354  ncCheck(nc_get_var(groupId, myId,dataValues),__FILE__,__LINE__);
1355  else
1356  ncCheck(nc_get_var_schar(groupId, myId,dataValues),__FILE__,__LINE__);
1357 }
1358 // Reads the entire data of the netCDF variable.
1359 void NcVar::getVar(short* dataValues) const {
1360  NcType::ncType typeClass(getType().getTypeClass());
1361  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1362  ncCheck(nc_get_var(groupId, myId,dataValues),__FILE__,__LINE__);
1363  else
1364  ncCheck(nc_get_var_short(groupId, myId,dataValues),__FILE__,__LINE__);
1365 }
1366 // Reads the entire data of the netCDF variable.
1367 void NcVar::getVar(int* dataValues) const {
1368  NcType::ncType typeClass(getType().getTypeClass());
1369  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1370  ncCheck(nc_get_var(groupId, myId,dataValues),__FILE__,__LINE__);
1371  else
1372  ncCheck(nc_get_var_int(groupId, myId,dataValues),__FILE__,__LINE__);
1373 }
1374 // Reads the entire data of the netCDF variable.
1375 void NcVar::getVar(long* dataValues) const {
1376  NcType::ncType typeClass(getType().getTypeClass());
1377  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1378  ncCheck(nc_get_var(groupId, myId,dataValues),__FILE__,__LINE__);
1379  else
1380  ncCheck(nc_get_var_long(groupId, myId,dataValues),__FILE__,__LINE__);
1381 }
1382 // Reads the entire data of the netCDF variable.
1383 void NcVar::getVar(float* dataValues) const {
1384  NcType::ncType typeClass(getType().getTypeClass());
1385  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1386  ncCheck(nc_get_var(groupId, myId,dataValues),__FILE__,__LINE__);
1387  else
1388  ncCheck(nc_get_var_float(groupId, myId,dataValues),__FILE__,__LINE__);
1389 }
1390 // Reads the entire data of the netCDF variable.
1391 void NcVar::getVar(double* dataValues) const {
1392  NcType::ncType typeClass(getType().getTypeClass());
1393  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1394  ncCheck(nc_get_var(groupId, myId,dataValues),__FILE__,__LINE__);
1395  else
1396  ncCheck(nc_get_var_double(groupId, myId,dataValues),__FILE__,__LINE__);
1397 }
1398 // Reads the entire data of the netCDF variable.
1399 void NcVar::getVar(unsigned short* dataValues) const {
1400  NcType::ncType typeClass(getType().getTypeClass());
1401  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1402  ncCheck(nc_get_var(groupId, myId,dataValues),__FILE__,__LINE__);
1403  else
1404  ncCheck(nc_get_var_ushort(groupId, myId,dataValues),__FILE__,__LINE__);
1405 }
1406 // Reads the entire data of the netCDF variable.
1407 void NcVar::getVar(unsigned int* dataValues) const {
1408  NcType::ncType typeClass(getType().getTypeClass());
1409  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1410  ncCheck(nc_get_var(groupId, myId,dataValues),__FILE__,__LINE__);
1411  else
1412  ncCheck(nc_get_var_uint(groupId, myId,dataValues),__FILE__,__LINE__);
1413 }
1414 // Reads the entire data of the netCDF variable.
1415 void NcVar::getVar(long long* dataValues) const {
1416  NcType::ncType typeClass(getType().getTypeClass());
1417  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1418  ncCheck(nc_get_var(groupId, myId,dataValues),__FILE__,__LINE__);
1419  else
1420  ncCheck(nc_get_var_longlong(groupId, myId,dataValues),__FILE__,__LINE__);
1421 }
1422 // Reads the entire data of the netCDF variable.
1423 void NcVar::getVar(unsigned long long* dataValues) const {
1424  NcType::ncType typeClass(getType().getTypeClass());
1425  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1426  ncCheck(nc_get_var(groupId, myId,dataValues),__FILE__,__LINE__);
1427  else
1428  ncCheck(nc_get_var_ulonglong(groupId, myId,dataValues),__FILE__,__LINE__);
1429 }
1430 // Reads the entire data of the netCDF variable.
1431 void NcVar::getVar(char** dataValues) const {
1432  NcType::ncType typeClass(getType().getTypeClass());
1433  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1434  ncCheck(nc_get_var(groupId, myId,dataValues),__FILE__,__LINE__);
1435  else
1436  ncCheck(nc_get_var_string(groupId, myId,dataValues),__FILE__,__LINE__);
1437 }
1438 // Reads the entire data of the netCDF variable with no data conversion.
1439 void NcVar::getVar(void* dataValues) const {
1440  ncCheck(nc_get_var(groupId, myId,dataValues),__FILE__,__LINE__);
1441 }
1442 
1443 
1444 
1446 
1447 // Reads a single datum value of a netCDF variable.
1448 void NcVar::getVar(const vector<size_t>& index, char* datumValue) const {
1449  NcType::ncType typeClass(getType().getTypeClass());
1450  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1451  ncCheck(nc_get_var1(groupId, myId,&index[0],datumValue),__FILE__,__LINE__);
1452  else
1453  ncCheck(nc_get_var1_text(groupId, myId,&index[0],datumValue),__FILE__,__LINE__);
1454 }
1455 // Reads a single datum value of a netCDF variable.
1456 void NcVar::getVar(const vector<size_t>& index, unsigned char* datumValue) const {
1457  NcType::ncType typeClass(getType().getTypeClass());
1458  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1459  ncCheck(nc_get_var1(groupId, myId,&index[0],datumValue),__FILE__,__LINE__);
1460  else
1461  ncCheck(nc_get_var1_uchar(groupId, myId,&index[0],datumValue),__FILE__,__LINE__);
1462 }
1463 // Reads a single datum value of a netCDF variable.
1464 void NcVar::getVar(const vector<size_t>& index, signed char* datumValue) const {
1465  NcType::ncType typeClass(getType().getTypeClass());
1466  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1467  ncCheck(nc_get_var1(groupId, myId,&index[0],datumValue),__FILE__,__LINE__);
1468  else
1469  ncCheck(nc_get_var1_schar(groupId, myId,&index[0],datumValue),__FILE__,__LINE__);
1470 }
1471 // Reads a single datum value of a netCDF variable.
1472 void NcVar::getVar(const vector<size_t>& index, short* datumValue) const {
1473  NcType::ncType typeClass(getType().getTypeClass());
1474  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1475  ncCheck(nc_get_var1(groupId, myId,&index[0],datumValue),__FILE__,__LINE__);
1476  else
1477  ncCheck(nc_get_var1_short(groupId, myId,&index[0],datumValue),__FILE__,__LINE__);
1478 }
1479 // Reads a single datum value of a netCDF variable.
1480 void NcVar::getVar(const vector<size_t>& index, int* datumValue) const {
1481  NcType::ncType typeClass(getType().getTypeClass());
1482  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1483  ncCheck(nc_get_var1(groupId, myId,&index[0],datumValue),__FILE__,__LINE__);
1484  else
1485  ncCheck(nc_get_var1_int(groupId, myId,&index[0],datumValue),__FILE__,__LINE__);
1486 }
1487 // Reads a single datum value of a netCDF variable.
1488 void NcVar::getVar(const vector<size_t>& index, long* datumValue) const {
1489  NcType::ncType typeClass(getType().getTypeClass());
1490  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1491  ncCheck(nc_get_var1(groupId, myId,&index[0],datumValue),__FILE__,__LINE__);
1492  else
1493  ncCheck(nc_get_var1_long(groupId, myId,&index[0],datumValue),__FILE__,__LINE__);
1494 }
1495 // Reads a single datum value of a netCDF variable.
1496 void NcVar::getVar(const vector<size_t>& index, float* datumValue) const {
1497  NcType::ncType typeClass(getType().getTypeClass());
1498  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1499  ncCheck(nc_get_var1(groupId, myId,&index[0],datumValue),__FILE__,__LINE__);
1500  else
1501  ncCheck(nc_get_var1_float(groupId, myId,&index[0],datumValue),__FILE__,__LINE__);
1502 }
1503 // Reads a single datum value of a netCDF variable.
1504 void NcVar::getVar(const vector<size_t>& index, double* datumValue) const {
1505  NcType::ncType typeClass(getType().getTypeClass());
1506  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1507  ncCheck(nc_get_var1(groupId, myId,&index[0],datumValue),__FILE__,__LINE__);
1508  else
1509  ncCheck(nc_get_var1_double(groupId, myId,&index[0],datumValue),__FILE__,__LINE__);
1510 }
1511 // Reads a single datum value of a netCDF variable.
1512 void NcVar::getVar(const vector<size_t>& index, unsigned short* datumValue) const {
1513  NcType::ncType typeClass(getType().getTypeClass());
1514  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1515  ncCheck(nc_get_var1(groupId, myId,&index[0],datumValue),__FILE__,__LINE__);
1516  else
1517  ncCheck(nc_get_var1_ushort(groupId, myId,&index[0],datumValue),__FILE__,__LINE__);
1518 }
1519 // Reads a single datum value of a netCDF variable.
1520 void NcVar::getVar(const vector<size_t>& index, unsigned int* datumValue) const {
1521  NcType::ncType typeClass(getType().getTypeClass());
1522  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1523  ncCheck(nc_get_var1(groupId, myId,&index[0],datumValue),__FILE__,__LINE__);
1524  else
1525  ncCheck(nc_get_var1_uint(groupId, myId,&index[0],datumValue),__FILE__,__LINE__);
1526 }
1527 // Reads a single datum value of a netCDF variable.
1528 void NcVar::getVar(const vector<size_t>& index, long long* datumValue) const {
1529  NcType::ncType typeClass(getType().getTypeClass());
1530  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1531  ncCheck(nc_get_var1(groupId, myId,&index[0],datumValue),__FILE__,__LINE__);
1532  else
1533  ncCheck(nc_get_var1_longlong(groupId, myId,&index[0],datumValue),__FILE__,__LINE__);
1534 }
1535 // Reads a single datum value of a netCDF variable
1536 void NcVar::getVar(const vector<size_t>& index, unsigned long long* datumValue) const {
1537  NcType::ncType typeClass(getType().getTypeClass());
1538  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1539  ncCheck(nc_get_var1(groupId, myId,&index[0],datumValue),__FILE__,__LINE__);
1540  else
1541  ncCheck(nc_get_var1_ulonglong(groupId, myId,&index[0],datumValue),__FILE__,__LINE__);
1542 }
1543 // Reads a single datum value of a netCDF variable.
1544 void NcVar::getVar(const vector<size_t>& index, char** datumValue) const {
1545  NcType::ncType typeClass(getType().getTypeClass());
1546  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1547  ncCheck(nc_get_var1(groupId, myId,&index[0],datumValue),__FILE__,__LINE__);
1548  else
1549  ncCheck(nc_get_var1_string(groupId, myId,&index[0],datumValue),__FILE__,__LINE__);
1550 }
1551 // Reads a single datum value of a netCDF variable with no data conversion.
1552 void NcVar::getVar(const vector<size_t>& index, void* datumValue) const {
1553  ncCheck(nc_get_var1(groupId, myId,&index[0],datumValue),__FILE__,__LINE__);
1554 }
1555 
1556 
1557 
1559 
1560 // Reads an array of values from a netCDF variable.
1561 void NcVar::getVar(const vector<size_t>& startp, const vector<size_t>& countp, char* dataValues) const {
1562  NcType::ncType typeClass(getType().getTypeClass());
1563  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1564  ncCheck(nc_get_vara(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__);
1565  else
1566  ncCheck(nc_get_vara_text(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__);
1567 }
1568 // Reads an array of values from a netCDF variable.
1569 void NcVar::getVar(const vector<size_t>& startp, const vector<size_t>& countp, unsigned char* dataValues) const {
1570  NcType::ncType typeClass(getType().getTypeClass());
1571  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1572  ncCheck(nc_get_vara(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__);
1573  else
1574  ncCheck(nc_get_vara_uchar(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__);
1575 }
1576 // Reads an array of values from a netCDF variable.
1577 void NcVar::getVar(const vector<size_t>& startp, const vector<size_t>& countp, signed char* dataValues) const {
1578  NcType::ncType typeClass(getType().getTypeClass());
1579  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1580  ncCheck(nc_get_vara(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__);
1581  else
1582  ncCheck(nc_get_vara_schar(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__);
1583 }
1584 // Reads an array of values from a netCDF variable.
1585 void NcVar::getVar(const vector<size_t>& startp, const vector<size_t>& countp, short* dataValues) const {
1586  NcType::ncType typeClass(getType().getTypeClass());
1587  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1588  ncCheck(nc_get_vara(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__);
1589  else
1590  ncCheck(nc_get_vara_short(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__);
1591 }
1592 // Reads an array of values from a netCDF variable.
1593 void NcVar::getVar(const vector<size_t>& startp, const vector<size_t>& countp, int* dataValues) const {
1594  NcType::ncType typeClass(getType().getTypeClass());
1595  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1596  ncCheck(nc_get_vara(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__);
1597  else
1598  ncCheck(nc_get_vara_int(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__);
1599 }
1600 // Reads an array of values from a netCDF variable.
1601 void NcVar::getVar(const vector<size_t>& startp, const vector<size_t>& countp, long* dataValues) const {
1602  NcType::ncType typeClass(getType().getTypeClass());
1603  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1604  ncCheck(nc_get_vara(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__);
1605  else
1606  ncCheck(nc_get_vara_long(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__);
1607 }
1608 // Reads an array of values from a netCDF variable.
1609 void NcVar::getVar(const vector<size_t>& startp, const vector<size_t>& countp, float* dataValues) const {
1610  NcType::ncType typeClass(getType().getTypeClass());
1611  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1612  ncCheck(nc_get_vara(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__);
1613  else
1614  ncCheck(nc_get_vara_float(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__);
1615 }
1616 // Reads an array of values from a netCDF variable.
1617 void NcVar::getVar(const vector<size_t>& startp, const vector<size_t>& countp, double* dataValues) const {
1618  NcType::ncType typeClass(getType().getTypeClass());
1619  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1620  ncCheck(nc_get_vara(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__);
1621  else
1622  ncCheck(nc_get_vara_double(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__);
1623 }
1624 // Reads an array of values from a netCDF variable.
1625 void NcVar::getVar(const vector<size_t>& startp, const vector<size_t>& countp, unsigned short* dataValues) const {
1626  NcType::ncType typeClass(getType().getTypeClass());
1627  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1628  ncCheck(nc_get_vara(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__);
1629  else
1630  ncCheck(nc_get_vara_ushort(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__);
1631 }
1632 // Reads an array of values from a netCDF variable.
1633 void NcVar::getVar(const vector<size_t>& startp, const vector<size_t>& countp, unsigned int* dataValues) const {
1634  NcType::ncType typeClass(getType().getTypeClass());
1635  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1636  ncCheck(nc_get_vara(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__);
1637  else
1638  ncCheck(nc_get_vara_uint(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__);
1639 }
1640 // Reads an array of values from a netCDF variable.
1641 void NcVar::getVar(const vector<size_t>& startp, const vector<size_t>& countp, long long* dataValues) const {
1642  NcType::ncType typeClass(getType().getTypeClass());
1643  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1644  ncCheck(nc_get_vara(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__);
1645  else
1646  ncCheck(nc_get_vara_longlong(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__);
1647 }
1648 // Reads an array of values from a netCDF variable
1649 void NcVar::getVar(const vector<size_t>& startp, const vector<size_t>& countp, unsigned long long* dataValues) const {
1650  NcType::ncType typeClass(getType().getTypeClass());
1651  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1652  ncCheck(nc_get_vara(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__);
1653  else
1654  ncCheck(nc_get_vara_ulonglong(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__);
1655 }
1656 // Reads an array of values from a netCDF variable.
1657 void NcVar::getVar(const vector<size_t>& startp, const vector<size_t>& countp, char** dataValues) const {
1658  NcType::ncType typeClass(getType().getTypeClass());
1659  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1660  ncCheck(nc_get_vara(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__);
1661  else
1662  ncCheck(nc_get_vara_string(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__);
1663 }
1664 // Reads an array of values from a netCDF variable with no data conversion.
1665 void NcVar::getVar(const vector<size_t>& startp, const vector<size_t>& countp, void* dataValues) const {
1666  ncCheck(nc_get_vara(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__);
1667 }
1668 
1669 
1671 
1672 // Reads a subsampled (strided) array section of values from a netCDF variable.
1673 void NcVar::getVar(const vector<size_t>& startp, const vector<size_t>& countp, const vector<ptrdiff_t>& stridep, char* dataValues) const {
1674  NcType::ncType typeClass(getType().getTypeClass());
1675  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1676  ncCheck(nc_get_vars(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__);
1677  else
1678  ncCheck(nc_get_vars_text(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__);
1679 }
1680 // Reads a subsampled (strided) array section of values from a netCDF variable.
1681 void NcVar::getVar(const vector<size_t>& startp, const vector<size_t>& countp, const vector<ptrdiff_t>& stridep, unsigned char* dataValues) const {
1682  NcType::ncType typeClass(getType().getTypeClass());
1683  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1684  ncCheck(nc_get_vars(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__);
1685  else
1686  ncCheck(nc_get_vars_uchar(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__);
1687 }
1688 // Reads a subsampled (strided) array section of values from a netCDF variable.
1689 void NcVar::getVar(const vector<size_t>& startp, const vector<size_t>& countp, const vector<ptrdiff_t>& stridep, signed char* dataValues) const {
1690  NcType::ncType typeClass(getType().getTypeClass());
1691  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1692  ncCheck(nc_get_vars(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__);
1693  else
1694  ncCheck(nc_get_vars_schar(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__);
1695 }
1696 // Reads a subsampled (strided) array section of values from a netCDF variable.
1697 void NcVar::getVar(const vector<size_t>& startp, const vector<size_t>& countp, const vector<ptrdiff_t>& stridep, short* dataValues) const {
1698  NcType::ncType typeClass(getType().getTypeClass());
1699  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1700  ncCheck(nc_get_vars(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__);
1701  else
1702  ncCheck(nc_get_vars_short(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__);
1703 }
1704 // Reads a subsampled (strided) array section of values from a netCDF variable.
1705 void NcVar::getVar(const vector<size_t>& startp, const vector<size_t>& countp, const vector<ptrdiff_t>& stridep, int* dataValues) const {
1706  NcType::ncType typeClass(getType().getTypeClass());
1707  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1708  ncCheck(nc_get_vars(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__);
1709  else
1710  ncCheck(nc_get_vars_int(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__);
1711 }
1712 // Reads a subsampled (strided) array section of values from a netCDF variable.
1713 void NcVar::getVar(const vector<size_t>& startp, const vector<size_t>& countp, const vector<ptrdiff_t>& stridep, long* dataValues) const {
1714  NcType::ncType typeClass(getType().getTypeClass());
1715  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1716  ncCheck(nc_get_vars(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__);
1717  else
1718  ncCheck(nc_get_vars_long(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__);
1719 }
1720 // Reads a subsampled (strided) array section of values from a netCDF variable.
1721 void NcVar::getVar(const vector<size_t>& startp, const vector<size_t>& countp, const vector<ptrdiff_t>& stridep, float* dataValues) const {
1722  NcType::ncType typeClass(getType().getTypeClass());
1723  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1724  ncCheck(nc_get_vars(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__);
1725  else
1726  ncCheck(nc_get_vars_float(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__);
1727 }
1728 // Reads a subsampled (strided) array section of values from a netCDF variable.
1729 void NcVar::getVar(const vector<size_t>& startp, const vector<size_t>& countp, const vector<ptrdiff_t>& stridep, double* dataValues) const {
1730  NcType::ncType typeClass(getType().getTypeClass());
1731  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1732  ncCheck(nc_get_vars(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__);
1733  else
1734  ncCheck(nc_get_vars_double(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__);
1735 }
1736 // Reads a subsampled (strided) array section of values from a netCDF variable.
1737 void NcVar::getVar(const vector<size_t>& startp, const vector<size_t>& countp, const vector<ptrdiff_t>& stridep, unsigned short* dataValues) const {
1738  NcType::ncType typeClass(getType().getTypeClass());
1739  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1740  ncCheck(nc_get_vars(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__);
1741  else
1742  ncCheck(nc_get_vars_ushort(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__);
1743 }
1744 // Reads a subsampled (strided) array section of values from a netCDF variable.
1745 void NcVar::getVar(const vector<size_t>& startp, const vector<size_t>& countp, const vector<ptrdiff_t>& stridep, unsigned int* dataValues) const {
1746  NcType::ncType typeClass(getType().getTypeClass());
1747  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1748  ncCheck(nc_get_vars(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__);
1749  else
1750  ncCheck(nc_get_vars_uint(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__);
1751 }
1752 // Reads a subsampled (strided) array section of values from a netCDF variable.
1753 void NcVar::getVar(const vector<size_t>& startp, const vector<size_t>& countp, const vector<ptrdiff_t>& stridep, long long* dataValues) const {
1754  NcType::ncType typeClass(getType().getTypeClass());
1755  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1756  ncCheck(nc_get_vars(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__);
1757  else
1758  ncCheck(nc_get_vars_longlong(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__);
1759 }
1760 // Reads a subsampled (strided) array section of values from a netCDF variable
1761 void NcVar::getVar(const vector<size_t>& startp, const vector<size_t>& countp, const vector<ptrdiff_t>& stridep, unsigned long long* dataValues) const {
1762  NcType::ncType typeClass(getType().getTypeClass());
1763  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1764  ncCheck(nc_get_vars(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__);
1765  else
1766  ncCheck(nc_get_vars_ulonglong(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__);
1767 }
1768 // Reads a subsampled (strided) array section of values from a netCDF variable.
1769 void NcVar::getVar(const vector<size_t>& startp, const vector<size_t>& countp, const vector<ptrdiff_t>& stridep, char** dataValues) const {
1770  NcType::ncType typeClass(getType().getTypeClass());
1771  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1772  ncCheck(nc_get_vars(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__);
1773  else
1774  ncCheck(nc_get_vars_string(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__);
1775 }
1776 // Reads a subsampled (strided) array section of values from a netCDF variable with no data conversion.
1777 void NcVar::getVar(const vector<size_t>& startp, const vector<size_t>& countp, const vector<ptrdiff_t>& stridep, void* dataValues) const {
1778  ncCheck(nc_get_vars(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__);
1779 }
1780 
1781 
1783 
1784 // Reads a mapped array section of values from a netCDF variable.
1785 void NcVar::getVar(const vector<size_t>& startp, const vector<size_t>& countp, const vector<ptrdiff_t>& stridep, const vector<ptrdiff_t>& imapp, char* dataValues) const {
1786  NcType::ncType typeClass(getType().getTypeClass());
1787  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1788  ncCheck(nc_get_varm(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__);
1789  else
1790  ncCheck(nc_get_varm_text(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__);
1791 }
1792 // Reads a mapped array section of values from a netCDF variable.
1793 void NcVar::getVar(const vector<size_t>& startp, const vector<size_t>& countp, const vector<ptrdiff_t>& stridep, const vector<ptrdiff_t>& imapp, unsigned char* dataValues) const {
1794  NcType::ncType typeClass(getType().getTypeClass());
1795  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1796  ncCheck(nc_get_varm(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__);
1797  else
1798  ncCheck(nc_get_varm_uchar(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__);
1799 }
1800 // Reads a mapped array section of values from a netCDF variable.
1801 void NcVar::getVar(const vector<size_t>& startp, const vector<size_t>& countp, const vector<ptrdiff_t>& stridep, const vector<ptrdiff_t>& imapp, signed char* dataValues) const {
1802  NcType::ncType typeClass(getType().getTypeClass());
1803  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1804  ncCheck(nc_get_varm(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__);
1805  else
1806  ncCheck(nc_get_varm_schar(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__);
1807 }
1808 // Reads a mapped array section of values from a netCDF variable.
1809 void NcVar::getVar(const vector<size_t>& startp, const vector<size_t>& countp, const vector<ptrdiff_t>& stridep, const vector<ptrdiff_t>& imapp, short* dataValues) const {
1810  NcType::ncType typeClass(getType().getTypeClass());
1811  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1812  ncCheck(nc_get_varm(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__);
1813  else
1814  ncCheck(nc_get_varm_short(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__);
1815 }
1816 // Reads a mapped array section of values from a netCDF variable.
1817 void NcVar::getVar(const vector<size_t>& startp, const vector<size_t>& countp, const vector<ptrdiff_t>& stridep, const vector<ptrdiff_t>& imapp, int* dataValues) const {
1818  NcType::ncType typeClass(getType().getTypeClass());
1819  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1820  ncCheck(nc_get_varm(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__);
1821  else
1822  ncCheck(nc_get_varm_int(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__);
1823 }
1824 // Reads a mapped array section of values from a netCDF variable.
1825 void NcVar::getVar(const vector<size_t>& startp, const vector<size_t>& countp, const vector<ptrdiff_t>& stridep, const vector<ptrdiff_t>& imapp, long* dataValues) const {
1826  NcType::ncType typeClass(getType().getTypeClass());
1827  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1828  ncCheck(nc_get_varm(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__);
1829  else
1830  ncCheck(nc_get_varm_long(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__);
1831 }
1832 // Reads a mapped array section of values from a netCDF variable.
1833 void NcVar::getVar(const vector<size_t>& startp, const vector<size_t>& countp, const vector<ptrdiff_t>& stridep, const vector<ptrdiff_t>& imapp, float* dataValues) const {
1834  NcType::ncType typeClass(getType().getTypeClass());
1835  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1836  ncCheck(nc_get_varm(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__);
1837  else
1838  ncCheck(nc_get_varm_float(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__);
1839 }
1840 // Reads a mapped array section of values from a netCDF variable.
1841 void NcVar::getVar(const vector<size_t>& startp, const vector<size_t>& countp, const vector<ptrdiff_t>& stridep, const vector<ptrdiff_t>& imapp, double* dataValues) const {
1842  NcType::ncType typeClass(getType().getTypeClass());
1843  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1844  ncCheck(nc_get_varm(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__);
1845  else
1846  ncCheck(nc_get_varm_double(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__);
1847 }
1848 // Reads a mapped array section of values from a netCDF variable.
1849 void NcVar::getVar(const vector<size_t>& startp, const vector<size_t>& countp, const vector<ptrdiff_t>& stridep, const vector<ptrdiff_t>& imapp, unsigned short* dataValues) const {
1850  NcType::ncType typeClass(getType().getTypeClass());
1851  if(typeClass == NcType::nc_VLEN ||typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1852  ncCheck(nc_get_varm(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__);
1853  else
1854  ncCheck(nc_get_varm_ushort(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__);
1855 }
1856 // Reads a mapped array section of values from a netCDF variable.
1857 void NcVar::getVar(const vector<size_t>& startp, const vector<size_t>& countp, const vector<ptrdiff_t>& stridep, const vector<ptrdiff_t>& imapp, unsigned int* dataValues) const {
1858  NcType::ncType typeClass(getType().getTypeClass());
1859  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1860  ncCheck(nc_get_varm(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__);
1861  else
1862  ncCheck(nc_get_varm_uint(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__);
1863 }
1864 // Reads a mapped array section of values from a netCDF variable.
1865 void NcVar::getVar(const vector<size_t>& startp, const vector<size_t>& countp, const vector<ptrdiff_t>& stridep, const vector<ptrdiff_t>& imapp, long long* dataValues) const {
1866  NcType::ncType typeClass(getType().getTypeClass());
1867  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1868  ncCheck(nc_get_varm(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__);
1869  else
1870  ncCheck(nc_get_varm_longlong(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__);
1871 }
1872 // Reads a mapped array section of values from a netCDF variable
1873 void NcVar::getVar(const vector<size_t>& startp, const vector<size_t>& countp, const vector<ptrdiff_t>& stridep, const vector<ptrdiff_t>& imapp, unsigned long long* dataValues) const {
1874  NcType::ncType typeClass(getType().getTypeClass());
1875  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1876  ncCheck(nc_get_varm(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__);
1877  else
1878  ncCheck(nc_get_varm_ulonglong(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__);
1879 }
1880 // Reads a mapped array section of values from a netCDF variable.
1881 void NcVar::getVar(const vector<size_t>& startp, const vector<size_t>& countp, const vector<ptrdiff_t>& stridep, const vector<ptrdiff_t>& imapp, char** dataValues) const {
1882  NcType::ncType typeClass(getType().getTypeClass());
1883  if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1884  ncCheck(nc_get_varm(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__);
1885  else
1886  ncCheck(nc_get_varm_string(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__);
1887 }
1888 // Reads a mapped array section of values from a netCDF variable with no data conversion.
1889 void NcVar::getVar(const vector<size_t>& startp, const vector<size_t>& countp, const vector<ptrdiff_t>& stridep, const vector<ptrdiff_t>& imapp, void* dataValues) const {
1890  ncCheck(nc_get_varm(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__);
1891 }
int getAttCount() const
Gets the number of attributes.
Definition: ncVar.cpp:187
ChecksumMode
Used for checksum specification (see NcVar::setChecksum, NcVar::getChecksum).
Definition: ncVar.h:62
int getDimCount() const
The the number of dimensions.
Definition: ncVar.cpp:142
void getChunkingParameters(ChunkMode &chunkMode, std::vector< size_t > &chunkSizes) const
Gets the chunking parameters.
Definition: ncVar.cpp:550
Base class inherited by NcOpaque, NcVlen, NcCompound and NcEnum classes.
Definition: ncType.h:14
NcUint64 ncUint64
A global instance of the NcUint64 class within the netCDF namespace.
Definition: ncUint64.cpp:7
bool operator!=(const NcVar &rhs) const
!= operator
Definition: ncVar.cpp:53
std::string getName() const
Get the attribute name.
Definition: ncAtt.h:30
int getId() const
Get the variable id.
Definition: ncVar.cpp:86
"NcOpaque type"
Definition: ncType.h:40
std::map< std::string, NcVarAtt > getAtts() const
Gets the set of attributes.
Definition: ncVar.cpp:196
C++ API for netCDF4.
Definition: ncAtt.h:9
NcVarAtt putAtt(const std::string &name, size_t len, const char **dataValues) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
NcByte ncByte
A global instance of the NcByte class within the netCDF namespace.
Definition: ncByte.cpp:7
"NcCompound type"
Definition: ncType.h:42
void setCompression(bool enableShuffleFilter, bool enableDeflateFilter, int deflateLevel) const
Sets the compression parameters.
Definition: ncVar.cpp:601
void setChecksum(ChecksumMode checksumMode) const
Sets the checksum parameters of a variable.
Definition: ncVar.cpp:661
"NcVlen type"
Definition: ncType.h:39
EndianMode getEndianness() const
Gets the endianness of the variable.
Definition: ncVar.cpp:644
NcFloat ncFloat
A global instance of the NcFloat class within the netCDF namespace.
Definition: ncFloat.cpp:7
Class represents a netCDF group.
Definition: ncGroup.h:27
std::vector< NcDim > getDims() const
Gets the set of NcDim objects.
Definition: ncVar.cpp:151
NcVarAtt getAtt(const std::string &name) const
Gets attribute by name.
Definition: ncVar.cpp:211
ncType
List of netCDF types that can be represented.
Definition: ncType.h:25
Exception classes.
Definition: ncException.h:15
NcUint ncUint
A global instance of the NcUint class within the netCDF namespace.
Definition: ncUint.cpp:7
NcChar ncChar
A global instance of the NcChar class within the netCDF namespace.
Definition: ncChar.cpp:7
void setEndianness(EndianMode endianMode) const
Sets the endianness of the variable.
Definition: ncVar.cpp:637
NcGroup getParentGroup() const
Gets parent group.
Definition: ncVar.cpp:80
NcType getType() const
Returns the variable type.
Definition: ncVar.cpp:96
bool isNull() const
Returns true if this object variable is not defined.
Definition: ncVar.h:112
void getVar(void *dataValues) const
This is an overloaded member function, provided for convenience.
Definition: ncVar.cpp:1439
void setFill(bool fillMode, void *fillValue=NULL) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: ncVar.cpp:569
NcDim getDim(int i) const
Gets the i&#39;th NcDim object.
Definition: ncVar.cpp:171
nc_type getId() const
The netCDF Id of this type.
Definition: ncType.h:88
NcDouble ncDouble
A global instance of the NcDouble class within the netCDF namespace.
Definition: ncDouble.cpp:7
Class represents a netCDF dimension.
Definition: ncDim.h:13
Base object is thrown if a netCDF exception is encountered.
Definition: ncException.h:24
Select from contents of current and parents groups.
Definition: ncGroup.h:53
void ncCheckDataMode(int ncid)
Function checks if the file (group) is in data mode.
Definition: ncCheck.cpp:89
bool operator==(const NcVar &rhs) const
equivalence operator
Definition: ncVar.cpp:46
void ncCheck(int retCode, const char *file, int line)
Function checks error code and if necessary throws an exception.
Definition: ncCheck.cpp:11
NcShort ncShort
A global instance of the NcShort class within the netCDF namespace.
Definition: ncShort.cpp:7
std::string getName() const
Name of this NcVar object.
Definition: ncVar.cpp:528
void ncCheckDefineMode(int ncid)
Function checks if the file (group) is in define mode.
Definition: ncCheck.cpp:83
void putVar(const void *dataValues) const
This is an overloaded member function, provided for convenience.
Definition: ncVar.cpp:815
Class represents a netCDF attribute local to a netCDF variable.
Definition: ncVarAtt.h:13
void setChunking(ChunkMode chunkMode, std::vector< size_t > &chunksizes) const
Sets chunking parameters.
Definition: ncVar.cpp:543
"NcEnum type"
Definition: ncType.h:41
void rename(const std::string &newname) const
Rename the variable.
Definition: ncVar.cpp:682
NcString ncString
A global instance of the NcString class within the netCDF namespace.
Definition: ncString.cpp:7
void getCompressionParameters(bool &shuffleFilterEnabled, bool &deflateFilterEnabled, int &deflateLevel) const
Gets the compression parameters.
Definition: ncVar.cpp:615
Class represents a netCDF variable.
Definition: ncVar.h:33
NcVar()
Constructor generates a null object.
Definition: ncVar.cpp:65
void getFillModeParameters(bool &fillMode, void *fillValue=NULL) const
This is an overloaded member function, provided for convenience.
Definition: ncVar.cpp:585
ChunkMode
Used for chunking specifications (see NcVar::setChunking, NcVar::getChunkingParameters).
Definition: ncVar.h:38
NcInt ncInt
A global instance of the NcInt class within the netCDF namespace.
Definition: ncInt.cpp:7
ChecksumMode getChecksum() const
Gets the checksum parameters of the variable.
Definition: ncVar.cpp:667
ncType getTypeClass() const
The type class returned as enumeration type.
Definition: ncType.cpp:116
NcUbyte ncUbyte
A global instance of the NcUbyte class within the netCDF namespace.
Definition: ncUbyte.cpp:7
NcInt64 ncInt64
A global instance of the NcInt64 class within the netCDF namespace.
Definition: ncInt64.cpp:7
EndianMode
Used to specifying the endianess of the data, (see NcVar::setEndianness, NcVar::getEndianness).
Definition: ncVar.h:54

Return to the Main Unidata NetCDF page.
Generated on Fri Nov 11 2016 15:28:29 for NetCDF-C++. NetCDF is a Unidata library.