NetCDF-C++ 4.3.1
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>
8using namespace std;
9using namespace netCDF::exceptions;
10
11namespace 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
26using namespace netCDF;
27
28// assignment operator
29NcVar& 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.
38NcVar::NcVar(const NcVar& rhs) :
39 nullObject(rhs.nullObject),
40 myId(rhs.myId),
41 groupId(rhs.groupId)
42{}
43
44
45// equivalence operator
46bool NcVar::operator==(const NcVar & rhs) const
47{
48 // simply check the netCDF id.
49 return (myId == rhs.myId);
50}
51
52// != operator
53bool 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.
65NcVar::NcVar() : nullObject(true),
66 myId(-1),
67 groupId(-1)
68{}
69
70// Constructor for a variable (must already exist in the netCDF file.)
71NcVar::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.
86int 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.
151vector<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.
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.
196map<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.
211NcVarAtt 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.
229NcVarAtt 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.
237NcVarAtt 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.
250NcVarAtt 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.
265NcVarAtt 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.
278NcVarAtt 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.
290NcVarAtt 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.
302NcVarAtt 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.
315NcVarAtt 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.
328NcVarAtt 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.
340NcVarAtt 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.
352NcVarAtt 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.
365NcVarAtt 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.
390NcVarAtt 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.
403NcVarAtt 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.
415NcVarAtt 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.
427NcVarAtt 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.
440NcVarAtt 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.
453NcVarAtt 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.
465NcVarAtt 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.
477NcVarAtt 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.
490NcVarAtt 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.
503NcVarAtt 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.
511NcVarAtt 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.
528string 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.
543void 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
550void 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
569void 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
578void NcVar::setFill(bool fillMode,const void* fillValue) const {
579 setFill(fillMode,const_cast<void*>(fillValue));
580}
581
582
583
584// Gets the fill parameters
585void 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
601void 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// Gets the compression parameters
614void NcVar::getCompressionParameters(bool& shuffleFilterEnabled, bool& deflateFilterEnabled, int& deflateLevel) const {
615
616 int enableShuffleFilterInt;
617 int enableDeflateFilterInt;
618 ncCheck(nc_inq_var_deflate(groupId,myId,
619 &enableShuffleFilterInt,
620 &enableDeflateFilterInt,
621 &deflateLevel),__FILE__,__LINE__);
622 shuffleFilterEnabled = static_cast<bool> (enableShuffleFilterInt);
623 deflateFilterEnabled = static_cast<bool> (enableDeflateFilterInt);
624}
625
626// Define a variable filter to be used for compression (decompression)
627void NcVar::setFilter( unsigned int id, size_t nparams,
628 const unsigned int* parms) const
629{
630 ncCheck(nc_def_var_filter(groupId,myId,id,nparams,parms),__FILE__,__LINE__);
631}
632
633// Query filter details (if any) associated with a variable
634void NcVar::getFilter( unsigned int* idp, size_t* nparamsp, unsigned int* params) const
635{
636 ncCheck(nc_inq_var_filter(groupId, myId, idp, nparamsp, params),__FILE__,__LINE__);
637}
638
639// Query the length of a given Type
640void NcVar::getTypeLen(nc_type type) const
641{
642 ncCheck(nctypelen(type),__FILE__,__LINE__);
643}
644
645// Free string space allocated by the library
646void NcVar::freeString(size_t len, char **data) const
647{
648 ncCheck(nc_free_string(len, data),__FILE__,__LINE__);
649}
650
651// Change the cache settings for a chunked variable
652void NcVar::setChunkCache(size_t size, size_t nelems, float preemption) const
653{
654 ncCheck(nc_set_var_chunk_cache(groupId, myId, size, nelems, preemption),__FILE__,__LINE__);
655}
656
658
659// Endianness details
660
662
663
664// Sets the endianness of the variable.
665void NcVar::setEndianness(EndianMode endianMode) const {
666
667 ncCheck(nc_def_var_endian(groupId,myId,static_cast<int> (endianMode)),__FILE__,__LINE__);
668}
669
670
671// Gets the endianness of the variable.
673
674 int endianInt;
675 ncCheck(nc_inq_var_endian(groupId,myId,&endianInt),__FILE__,__LINE__);
676 return static_cast<EndianMode> (endianInt);
677}
678
679
680
682
683// Checksum details
684
686
687
688// Sets the checksum parameters of a variable.
689void NcVar::setChecksum(ChecksumMode checksumMode) const {
690 ncCheck(nc_def_var_fletcher32(groupId,myId,static_cast<int> (checksumMode)),__FILE__,__LINE__);
691}
692
693
694// Gets the checksum parameters of the variable.
696 int checksumInt;
697 ncCheck(nc_inq_var_fletcher32(groupId,myId,&checksumInt),__FILE__,__LINE__);
698 return static_cast<ChecksumMode> (checksumInt);
699}
700
701
702
703
705
706// renaming the variable
707
709
710void NcVar::rename( const string& newname ) const
711{
712 ncCheck(nc_rename_var(groupId,myId,newname.c_str()),__FILE__,__LINE__);
713}
714
715
716
717
718
720
721// data writing
722
724
725// Writes the entire data into the netCDF variable.
726void NcVar::putVar(const char* dataValues) const {
727 ncCheckDataMode(groupId);
728 NcType::ncType typeClass(getType().getTypeClass());
729 if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
730 ncCheck(nc_put_var(groupId, myId,dataValues),__FILE__,__LINE__);
731 else
732 ncCheck(nc_put_var_text(groupId, myId,dataValues),__FILE__,__LINE__);
733}
734// Writes the entire data into the netCDF variable.
735void NcVar::putVar(const unsigned char* dataValues) const {
736 ncCheckDataMode(groupId);
737 NcType::ncType typeClass(getType().getTypeClass());
738 if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
739 ncCheck(nc_put_var(groupId, myId,dataValues),__FILE__,__LINE__);
740 else
741 ncCheck(nc_put_var_uchar(groupId, myId,dataValues),__FILE__,__LINE__);
742}
743// Writes the entire data into the netCDF variable.
744void NcVar::putVar(const signed char* dataValues) const {
745 ncCheckDataMode(groupId);
746 NcType::ncType typeClass(getType().getTypeClass());
747 if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
748 ncCheck(nc_put_var(groupId, myId,dataValues),__FILE__,__LINE__);
749 else
750 ncCheck(nc_put_var_schar(groupId, myId,dataValues),__FILE__,__LINE__);
751}
752// Writes the entire data into the netCDF variable.
753void NcVar::putVar(const short* dataValues) const {
754 ncCheckDataMode(groupId);
755 NcType::ncType typeClass(getType().getTypeClass());
756 if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
757 ncCheck(nc_put_var(groupId, myId,dataValues),__FILE__,__LINE__);
758 else
759 ncCheck(nc_put_var_short(groupId, myId,dataValues),__FILE__,__LINE__);
760}
761// Writes the entire data into the netCDF variable.
762void NcVar::putVar(const int* dataValues) const {
763 ncCheckDataMode(groupId);
764 NcType::ncType typeClass(getType().getTypeClass());
765 if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
766 ncCheck(nc_put_var(groupId, myId,dataValues),__FILE__,__LINE__);
767 else
768 ncCheck(nc_put_var_int(groupId, myId,dataValues),__FILE__,__LINE__);
769}
770// Writes the entire data into the netCDF variable.
771void NcVar::putVar(const long* dataValues) const {
772 ncCheckDataMode(groupId);
773 NcType::ncType typeClass(getType().getTypeClass());
774 if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
775 ncCheck(nc_put_var(groupId, myId,dataValues),__FILE__,__LINE__);
776 else
777 ncCheck(nc_put_var_long(groupId, myId,dataValues),__FILE__,__LINE__);
778}
779// Writes the entire data into the netCDF variable.
780void NcVar::putVar(const float* dataValues) const {
781 ncCheckDataMode(groupId);
782 NcType::ncType typeClass(getType().getTypeClass());
783 if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
784 ncCheck(nc_put_var(groupId, myId,dataValues),__FILE__,__LINE__);
785 else
786 ncCheck(nc_put_var_float(groupId, myId,dataValues),__FILE__,__LINE__);
787}
788// Writes the entire data into the netCDF variable.
789void NcVar::putVar(const double* dataValues) const {
790 ncCheckDataMode(groupId);
791 NcType::ncType typeClass(getType().getTypeClass());
792 if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
793 ncCheck(nc_put_var(groupId, myId,dataValues),__FILE__,__LINE__);
794 else
795 ncCheck(nc_put_var_double(groupId, myId,dataValues),__FILE__,__LINE__);
796}
797// Writes the entire data into the netCDF variable.
798void NcVar::putVar(const unsigned short* dataValues) const {
799 ncCheckDataMode(groupId);
800 NcType::ncType typeClass(getType().getTypeClass());
801 if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
802 ncCheck(nc_put_var(groupId, myId,dataValues),__FILE__,__LINE__);
803 else
804 ncCheck(nc_put_var_ushort(groupId, myId,dataValues),__FILE__,__LINE__);
805}
806// Writes the entire data into the netCDF variable.
807void NcVar::putVar(const unsigned int* dataValues) const {
808 ncCheckDataMode(groupId);
809 NcType::ncType typeClass(getType().getTypeClass());
810 if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
811 ncCheck(nc_put_var(groupId, myId,dataValues),__FILE__,__LINE__);
812 else
813 ncCheck(nc_put_var_uint(groupId, myId,dataValues),__FILE__,__LINE__);
814}
815// Writes the entire data into the netCDF variable.
816void NcVar::putVar(const long long* dataValues) const {
817 ncCheckDataMode(groupId);
818 NcType::ncType typeClass(getType().getTypeClass());
819 if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
820 ncCheck(nc_put_var(groupId, myId,dataValues),__FILE__,__LINE__);
821 else
822 ncCheck(nc_put_var_longlong(groupId, myId,dataValues),__FILE__,__LINE__);
823}
824// Writes the entire data into the netCDF variable.
825void NcVar::putVar(const unsigned long long* dataValues) const {
826 ncCheckDataMode(groupId);
827 NcType::ncType typeClass(getType().getTypeClass());
828 if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
829 ncCheck(nc_put_var(groupId, myId,dataValues),__FILE__,__LINE__);
830 else
831 ncCheck(nc_put_var_ulonglong(groupId, myId,dataValues),__FILE__,__LINE__);
832}
833// Writes the entire data into the netCDF variable.
834void NcVar::putVar(const char** dataValues) const {
835 ncCheckDataMode(groupId);
836 NcType::ncType typeClass(getType().getTypeClass());
837 if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
838 ncCheck(nc_put_var(groupId, myId,dataValues),__FILE__,__LINE__);
839 else
840 ncCheck(nc_put_var_string(groupId, myId,dataValues),__FILE__,__LINE__);
841}
842// Writes the entire data into the netCDF variable with no data conversion.
843void NcVar::putVar(const void* dataValues) const {
844 ncCheckDataMode(groupId);
845 ncCheck(nc_put_var(groupId, myId,dataValues),__FILE__,__LINE__);
846}
847
848
850// Writes a single datum value into the netCDF variable.
851void NcVar::putVar(const vector<size_t>& index, const string& datumValue) const {
852 ncCheckDataMode(groupId);
853 NcType::ncType typeClass(getType().getTypeClass());
854 if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
855 throw NcException("user-defined type must be of type void",__FILE__,__LINE__);
856 else
857 {
858 const char* tmpPtr = datumValue.c_str();
859 ncCheck(nc_put_var1_string(groupId, myId,&index[0],&tmpPtr),__FILE__,__LINE__);
860 }
861}
862// Writes a single datum value into the netCDF variable.
863void NcVar::putVar(const vector<size_t>& index, const unsigned char* datumValue) const {
864 ncCheckDataMode(groupId);
865 NcType::ncType typeClass(getType().getTypeClass());
866 if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
867 throw NcException("user-defined type must be of type void",__FILE__,__LINE__);
868 else
869 ncCheck(nc_put_var1_uchar(groupId, myId,&index[0],datumValue),__FILE__,__LINE__);
870}
871// Writes a single datum value into the netCDF variable.
872void NcVar::putVar(const vector<size_t>& index, const signed char* datumValue) const {
873 ncCheckDataMode(groupId);
874 NcType::ncType typeClass(getType().getTypeClass());
875 if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
876 throw NcException("user-defined type must be of type void",__FILE__,__LINE__);
877 else
878 ncCheck(nc_put_var1_schar(groupId, myId,&index[0],datumValue),__FILE__,__LINE__);
879}
880// Writes a single datum value into the netCDF variable.
881void NcVar::putVar(const vector<size_t>& index, const short datumValue) const {
882 ncCheckDataMode(groupId);
883 NcType::ncType typeClass(getType().getTypeClass());
884 if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
885 ncCheck(nc_put_var1(groupId, myId,&index[0],&datumValue),__FILE__,__LINE__);
886 else
887 ncCheck(nc_put_var1_short(groupId, myId,&index[0],&datumValue),__FILE__,__LINE__);
888}
889// Writes a single datum value into the netCDF variable.
890void NcVar::putVar(const vector<size_t>& index, const int datumValue) const {
891 ncCheckDataMode(groupId);
892 NcType::ncType typeClass(getType().getTypeClass());
893 if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
894 ncCheck(nc_put_var1(groupId, myId,&index[0],&datumValue),__FILE__,__LINE__);
895 else
896 ncCheck(nc_put_var1_int(groupId, myId,&index[0],&datumValue),__FILE__,__LINE__);
897}
898// Writes a single datum value into the netCDF variable.
899void NcVar::putVar(const vector<size_t>& index, const long datumValue) const {
900 ncCheckDataMode(groupId);
901 NcType::ncType typeClass(getType().getTypeClass());
902 if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
903 ncCheck(nc_put_var1(groupId, myId,&index[0],&datumValue),__FILE__,__LINE__);
904 else
905 ncCheck(nc_put_var1_long(groupId, myId,&index[0],&datumValue),__FILE__,__LINE__);
906}
907// Writes a single datum value into the netCDF variable.
908void NcVar::putVar(const vector<size_t>& index, const float datumValue) const {
909 ncCheckDataMode(groupId);
910 NcType::ncType typeClass(getType().getTypeClass());
911 if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
912 ncCheck(nc_put_var1(groupId, myId,&index[0],&datumValue),__FILE__,__LINE__);
913 else
914 ncCheck(nc_put_var1_float(groupId, myId,&index[0],&datumValue),__FILE__,__LINE__);
915}
916// Writes a single datum value into the netCDF variable.
917void NcVar::putVar(const vector<size_t>& index, const double datumValue) const {
918 ncCheckDataMode(groupId);
919 NcType::ncType typeClass(getType().getTypeClass());
920 if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
921 ncCheck(nc_put_var1(groupId, myId,&index[0],&datumValue),__FILE__,__LINE__);
922 else
923 ncCheck(nc_put_var1_double(groupId, myId,&index[0],&datumValue),__FILE__,__LINE__);
924}
925// Writes a single datum value into the netCDF variable.
926void NcVar::putVar(const vector<size_t>& index, const unsigned short datumValue) const {
927 ncCheckDataMode(groupId);
928 NcType::ncType typeClass(getType().getTypeClass());
929 if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
930 ncCheck(nc_put_var1(groupId, myId,&index[0],&datumValue),__FILE__,__LINE__);
931 else
932 ncCheck(nc_put_var1_ushort(groupId, myId,&index[0],&datumValue),__FILE__,__LINE__);
933}
934// Writes a single datum value into the netCDF variable.
935void NcVar::putVar(const vector<size_t>& index, const unsigned int datumValue) const {
936 ncCheckDataMode(groupId);
937 NcType::ncType typeClass(getType().getTypeClass());
938 if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
939 ncCheck(nc_put_var1(groupId, myId,&index[0],&datumValue),__FILE__,__LINE__);
940 else
941 ncCheck(nc_put_var1_uint(groupId, myId,&index[0],&datumValue),__FILE__,__LINE__);
942}
943// Writes a single datum value into the netCDF variable.
944void NcVar::putVar(const vector<size_t>& index, const long long datumValue) const {
945 ncCheckDataMode(groupId);
946 NcType::ncType typeClass(getType().getTypeClass());
947 if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
948 ncCheck(nc_put_var1(groupId, myId,&index[0],&datumValue),__FILE__,__LINE__);
949 else
950 ncCheck(nc_put_var1_longlong(groupId, myId,&index[0],&datumValue),__FILE__,__LINE__);
951}
952// Writes a single datum value into the netCDF variable.
953void NcVar::putVar(const vector<size_t>& index, const unsigned long long datumValue) const {
954 ncCheckDataMode(groupId);
955 NcType::ncType typeClass(getType().getTypeClass());
956 if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
957 ncCheck(nc_put_var1(groupId, myId,&index[0],&datumValue),__FILE__,__LINE__);
958 else
959 ncCheck(nc_put_var1_ulonglong(groupId, myId,&index[0],&datumValue),__FILE__,__LINE__);
960}
961// Writes a single datum value into the netCDF variable.
962void NcVar::putVar(const vector<size_t>& index, const char** datumValue) const {
963 ncCheckDataMode(groupId);
964 NcType::ncType typeClass(getType().getTypeClass());
965 if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
966 throw NcException("user-defined type must be of type void",__FILE__,__LINE__);
967 else
968 ncCheck(nc_put_var1_string(groupId, myId,&index[0],datumValue),__FILE__,__LINE__);
969}
970// Writes a single datum value into the netCDF variable with no data conversion.
971void NcVar::putVar(const vector<size_t>& index, const void* datumValue) const {
972 ncCheckDataMode(groupId);
973 ncCheck(nc_put_var1(groupId, myId,&index[0],datumValue),__FILE__,__LINE__);
974}
975
976
978
979// Writes an array of values into the netCDF variable.
980void NcVar::putVar(const vector<size_t>& startp, const vector<size_t>& countp, const char* dataValues) const {
981 ncCheckDataMode(groupId);
982 NcType::ncType typeClass(getType().getTypeClass());
983 if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
984 ncCheck(nc_put_vara(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__);
985 else
986 ncCheck(nc_put_vara_text(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__);
987}
988// Writes an array of values into the netCDF variable.
989void NcVar::putVar(const vector<size_t>& startp, const vector<size_t>& countp, const unsigned char* dataValues) const {
990 ncCheckDataMode(groupId);
991 NcType::ncType typeClass(getType().getTypeClass());
992 if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
993 ncCheck(nc_put_vara(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__);
994 else
995 ncCheck(nc_put_vara_uchar(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__);
996}
997// Writes an array of values into the netCDF variable.
998void NcVar::putVar(const vector<size_t>& startp, const vector<size_t>& countp, const signed char* dataValues) const {
999 ncCheckDataMode(groupId);
1000 NcType::ncType typeClass(getType().getTypeClass());
1001 if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1002 ncCheck(nc_put_vara(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__);
1003 else
1004 ncCheck(nc_put_vara_schar(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__);
1005}
1006// Writes an array of values into the netCDF variable.
1007void NcVar::putVar(const vector<size_t>& startp, const vector<size_t>& countp, const short* dataValues) const {
1008 ncCheckDataMode(groupId);
1009 NcType::ncType typeClass(getType().getTypeClass());
1010 if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1011 ncCheck(nc_put_vara(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__);
1012 else
1013 ncCheck(nc_put_vara_short(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__);
1014}
1015// Writes an array of values into the netCDF variable.
1016void NcVar::putVar(const vector<size_t>& startp, const vector<size_t>& countp, const int* dataValues) const {
1017 ncCheckDataMode(groupId);
1018 NcType::ncType typeClass(getType().getTypeClass());
1019 if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1020 ncCheck(nc_put_vara(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__);
1021 else
1022 ncCheck(nc_put_vara_int(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__);
1023}
1024// Writes an array of values into the netCDF variable.
1025void NcVar::putVar(const vector<size_t>& startp, const vector<size_t>& countp, const long* dataValues) const {
1026 ncCheckDataMode(groupId);
1027 NcType::ncType typeClass(getType().getTypeClass());
1028 if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1029 ncCheck(nc_put_vara(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__);
1030 else
1031 ncCheck(nc_put_vara_long(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__);
1032}
1033// Writes an array of values into the netCDF variable.
1034void NcVar::putVar(const vector<size_t>& startp, const vector<size_t>& countp, const float* dataValues) const {
1035 ncCheckDataMode(groupId);
1036 NcType::ncType typeClass(getType().getTypeClass());
1037 if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1038 ncCheck(nc_put_vara(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__);
1039 else
1040 ncCheck(nc_put_vara_float(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__);
1041}
1042// Writes an array of values into the netCDF variable.
1043void NcVar::putVar(const vector<size_t>& startp, const vector<size_t>& countp, const double* dataValues) const {
1044 ncCheckDataMode(groupId);
1045 NcType::ncType typeClass(getType().getTypeClass());
1046 if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1047 ncCheck(nc_put_vara(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__);
1048 else
1049 ncCheck(nc_put_vara_double(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__);
1050}
1051// Writes an array of values into the netCDF variable.
1052void NcVar::putVar(const vector<size_t>& startp, const vector<size_t>& countp, const unsigned short* dataValues) const {
1053 ncCheckDataMode(groupId);
1054 NcType::ncType typeClass(getType().getTypeClass());
1055 if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1056 ncCheck(nc_put_vara(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__);
1057 else
1058 ncCheck(nc_put_vara_ushort(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__);
1059}
1060// Writes an array of values into the netCDF variable.
1061void NcVar::putVar(const vector<size_t>& startp, const vector<size_t>& countp, const unsigned int* dataValues) const {
1062 ncCheckDataMode(groupId);
1063 NcType::ncType typeClass(getType().getTypeClass());
1064 if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1065 ncCheck(nc_put_vara(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__);
1066 else
1067 ncCheck(nc_put_vara_uint(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__);
1068}
1069// Writes an array of values into the netCDF variable.
1070void NcVar::putVar(const vector<size_t>& startp, const vector<size_t>& countp, const long long* dataValues) const {
1071 ncCheckDataMode(groupId);
1072 NcType::ncType typeClass(getType().getTypeClass());
1073 if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1074 ncCheck(nc_put_vara(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__);
1075 else
1076 ncCheck(nc_put_vara_longlong(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__);
1077}
1078// Writes an array of values into the netCDF variable.
1079void NcVar::putVar(const vector<size_t>& startp, const vector<size_t>& countp, const unsigned long long* 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_vara(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__);
1084 else
1085 ncCheck(nc_put_vara_ulonglong(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__);
1086}
1087// Writes an array of values into the netCDF variable.
1088void NcVar::putVar(const vector<size_t>& startp, const vector<size_t>& countp, const 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_vara(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__);
1093 else
1094 ncCheck(nc_put_vara_string(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__);
1095}
1096// Writes an array of values into the netCDF variable with no data conversion.
1097void NcVar::putVar(const vector<size_t>& startp, const vector<size_t>& countp, const void* dataValues) const {
1098 ncCheckDataMode(groupId);
1099 ncCheck(nc_put_vara(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__);
1100}
1101
1102
1103
1105
1106// Writes a set of subsampled array values into the netCDF variable.
1107void NcVar::putVar(const vector<size_t>& startp, const vector<size_t>&countp, const vector<ptrdiff_t>& stridep, const char* dataValues) const {
1108 ncCheckDataMode(groupId);
1109 NcType::ncType typeClass(getType().getTypeClass());
1110 if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1111 ncCheck(nc_put_vars(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__);
1112 else
1113 ncCheck(nc_put_vars_text(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__);
1114}
1115// Writes a set of subsampled array values into the netCDF variable.
1116void NcVar::putVar(const vector<size_t>& startp, const vector<size_t>&countp, const vector<ptrdiff_t>& stridep, const unsigned char* dataValues) const {
1117 ncCheckDataMode(groupId);
1118 NcType::ncType typeClass(getType().getTypeClass());
1119 if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1120 ncCheck(nc_put_vars(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__);
1121 else
1122 ncCheck(nc_put_vars_uchar(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__);
1123}
1124// Writes a set of subsampled array values into the netCDF variable.
1125void NcVar::putVar(const vector<size_t>& startp, const vector<size_t>&countp, const vector<ptrdiff_t>& stridep, const signed char* dataValues) const {
1126 ncCheckDataMode(groupId);
1127 NcType::ncType typeClass(getType().getTypeClass());
1128 if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1129 ncCheck(nc_put_vars(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__);
1130 else
1131 ncCheck(nc_put_vars_schar(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__);
1132}
1133// Writes a set of subsampled array values into the netCDF variable.
1134void NcVar::putVar(const vector<size_t>& startp, const vector<size_t>&countp, const vector<ptrdiff_t>& stridep, const short* dataValues) const {
1135 ncCheckDataMode(groupId);
1136 NcType::ncType typeClass(getType().getTypeClass());
1137 if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1138 ncCheck(nc_put_vars(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__);
1139 else
1140 ncCheck(nc_put_vars_short(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__);
1141}
1142// Writes a set of subsampled array values into the netCDF variable.
1143void NcVar::putVar(const vector<size_t>& startp, const vector<size_t>&countp, const vector<ptrdiff_t>& stridep, const int* dataValues) const {
1144 ncCheckDataMode(groupId);
1145 NcType::ncType typeClass(getType().getTypeClass());
1146 if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1147 ncCheck(nc_put_vars(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__);
1148 else
1149 ncCheck(nc_put_vars_int(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__);
1150}
1151// Writes a set of subsampled array values into the netCDF variable.
1152void NcVar::putVar(const vector<size_t>& startp, const vector<size_t>&countp, const vector<ptrdiff_t>& stridep, const long* dataValues) const {
1153 ncCheckDataMode(groupId);
1154 NcType::ncType typeClass(getType().getTypeClass());
1155 if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1156 ncCheck(nc_put_vars(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__);
1157 else
1158 ncCheck(nc_put_vars_long(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__);
1159}
1160// Writes a set of subsampled array values into the netCDF variable.
1161void NcVar::putVar(const vector<size_t>& startp, const vector<size_t>&countp, const vector<ptrdiff_t>& stridep, const float* dataValues) const {
1162 ncCheckDataMode(groupId);
1163 NcType::ncType typeClass(getType().getTypeClass());
1164 if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1165 ncCheck(nc_put_vars(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__);
1166 else
1167 ncCheck(nc_put_vars_float(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__);
1168}
1169// Writes a set of subsampled array values into the netCDF variable.
1170void NcVar::putVar(const vector<size_t>& startp, const vector<size_t>&countp, const vector<ptrdiff_t>& stridep, const double* dataValues) const {
1171 ncCheckDataMode(groupId);
1172 NcType::ncType typeClass(getType().getTypeClass());
1173 if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1174 ncCheck(nc_put_vars(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__);
1175 else
1176 ncCheck(nc_put_vars_double(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__);
1177}
1178// Writes a set of subsampled array values into the netCDF variable.
1179void NcVar::putVar(const vector<size_t>& startp, const vector<size_t>&countp, const vector<ptrdiff_t>& stridep, const unsigned short* dataValues) const {
1180 ncCheckDataMode(groupId);
1181 NcType::ncType typeClass(getType().getTypeClass());
1182 if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1183 ncCheck(nc_put_vars(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__);
1184 else
1185 ncCheck(nc_put_vars_ushort(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__);
1186}
1187// Writes a set of subsampled array values into the netCDF variable.
1188void NcVar::putVar(const vector<size_t>& startp, const vector<size_t>&countp, const vector<ptrdiff_t>& stridep, const unsigned int* dataValues) const {
1189 ncCheckDataMode(groupId);
1190 NcType::ncType typeClass(getType().getTypeClass());
1191 if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1192 ncCheck(nc_put_vars(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__);
1193 else
1194 ncCheck(nc_put_vars_uint(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__);
1195}
1196// Writes a set of subsampled array values into the netCDF variable.
1197void NcVar::putVar(const vector<size_t>& startp, const vector<size_t>&countp, const vector<ptrdiff_t>& stridep, const long long* dataValues) const {
1198 ncCheckDataMode(groupId);
1199 NcType::ncType typeClass(getType().getTypeClass());
1200 if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1201 ncCheck(nc_put_vars(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__);
1202 else
1203 ncCheck(nc_put_vars_longlong(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__);
1204}
1205// Writes a set of subsampled array values into the netCDF variable.
1206void NcVar::putVar(const vector<size_t>& startp, const vector<size_t>&countp, const vector<ptrdiff_t>& stridep, const unsigned long long* dataValues) const {
1207 ncCheckDataMode(groupId);
1208 NcType::ncType typeClass(getType().getTypeClass());
1209 if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1210 ncCheck(nc_put_vars(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__);
1211 else
1212 ncCheck(nc_put_vars_ulonglong(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__);
1213}
1214// Writes a set of subsampled array values into the netCDF variable.
1215void NcVar::putVar(const vector<size_t>& startp, const vector<size_t>&countp, const vector<ptrdiff_t>& stridep, const char** dataValues) const {
1216 ncCheckDataMode(groupId);
1217 NcType::ncType typeClass(getType().getTypeClass());
1218 if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1219 ncCheck(nc_put_vars(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__);
1220 else
1221 ncCheck(nc_put_vars_string(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__);
1222}
1223// Writes a set of subsampled array values into the netCDF variable with no data conversion.
1224void NcVar::putVar(const vector<size_t>& startp, const vector<size_t>&countp, const vector<ptrdiff_t>& stridep, const void* dataValues) const {
1225 ncCheckDataMode(groupId);
1226 ncCheck(nc_put_vars(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__);
1227}
1228
1229
1231// Writes a mapped array section of values into the netCDF variable.
1232void 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 {
1233 ncCheckDataMode(groupId);
1234 NcType::ncType typeClass(getType().getTypeClass());
1235 if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1236 ncCheck(nc_put_varm(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__);
1237 else
1238 ncCheck(nc_put_varm_text(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__);
1239}
1240// Writes a mapped array section of values into the netCDF variable.
1241void 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 {
1242 ncCheckDataMode(groupId);
1243 NcType::ncType typeClass(getType().getTypeClass());
1244 if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1245 ncCheck(nc_put_varm(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__);
1246 else
1247 ncCheck(nc_put_varm_uchar(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__);
1248}
1249// Writes a mapped array section of values into the netCDF variable.
1250void 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 {
1251 ncCheckDataMode(groupId);
1252 NcType::ncType typeClass(getType().getTypeClass());
1253 if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1254 ncCheck(nc_put_varm(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__);
1255 else
1256 ncCheck(nc_put_varm_schar(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__);
1257}
1258// Writes a mapped array section of values into the netCDF variable.
1259void 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 {
1260 ncCheckDataMode(groupId);
1261 NcType::ncType typeClass(getType().getTypeClass());
1262 if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1263 ncCheck(nc_put_varm(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__);
1264 else
1265 ncCheck(nc_put_varm_short(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__);
1266}
1267// Writes a mapped array section of values into the netCDF variable.
1268void 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 {
1269 ncCheckDataMode(groupId);
1270 NcType::ncType typeClass(getType().getTypeClass());
1271 if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1272 ncCheck(nc_put_varm(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__);
1273 else
1274 ncCheck(nc_put_varm_int(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__);
1275}
1276// Writes a mapped array section of values into the netCDF variable.
1277void 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 {
1278 ncCheckDataMode(groupId);
1279 NcType::ncType typeClass(getType().getTypeClass());
1280 if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1281 ncCheck(nc_put_varm(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__);
1282 else
1283 ncCheck(nc_put_varm_long(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__);
1284}
1285// Writes a mapped array section of values into the netCDF variable.
1286void 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 {
1287 ncCheckDataMode(groupId);
1288 NcType::ncType typeClass(getType().getTypeClass());
1289 if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1290 ncCheck(nc_put_varm(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__);
1291 else
1292 ncCheck(nc_put_varm_float(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__);
1293}
1294// Writes a mapped array section of values into the netCDF variable.
1295void 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 {
1296 ncCheckDataMode(groupId);
1297 NcType::ncType typeClass(getType().getTypeClass());
1298 if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1299 ncCheck(nc_put_varm(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__);
1300 else
1301 ncCheck(nc_put_varm_double(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__);
1302}
1303// Writes a mapped array section of values into the netCDF variable.
1304void 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 {
1305 ncCheckDataMode(groupId);
1306 NcType::ncType typeClass(getType().getTypeClass());
1307 if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1308 ncCheck(nc_put_varm(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__);
1309 else
1310 ncCheck(nc_put_varm_ushort(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__);
1311}
1312// Writes a mapped array section of values into the netCDF variable.
1313void 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 {
1314 ncCheckDataMode(groupId);
1315 NcType::ncType typeClass(getType().getTypeClass());
1316 if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1317 ncCheck(nc_put_varm(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__);
1318 else
1319 ncCheck(nc_put_varm_uint(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__);
1320}
1321// Writes a mapped array section of values into the netCDF variable.
1322void 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 {
1323 ncCheckDataMode(groupId);
1324 NcType::ncType typeClass(getType().getTypeClass());
1325 if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1326 ncCheck(nc_put_varm(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__);
1327 else
1328 ncCheck(nc_put_varm_longlong(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__);
1329}
1330// Writes a mapped array section of values into the netCDF variable.
1331void 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 {
1332 ncCheckDataMode(groupId);
1333 NcType::ncType typeClass(getType().getTypeClass());
1334 if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1335 ncCheck(nc_put_varm(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__);
1336 else
1337 ncCheck(nc_put_varm_ulonglong(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__);
1338}
1339// Writes a mapped array section of values into the netCDF variable.
1340void 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 {
1341 ncCheckDataMode(groupId);
1342 NcType::ncType typeClass(getType().getTypeClass());
1343 if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1344 ncCheck(nc_put_varm(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__);
1345 else
1346 ncCheck(nc_put_varm_string(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__);
1347}
1348// Writes a mapped array section of values into the netCDF variable with no data conversion.
1349void 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 {
1350 ncCheckDataMode(groupId);
1351 ncCheck(nc_put_varm(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__);
1352}
1353
1354
1355
1356
1357
1358// Data reading
1359
1360
1361
1362// Reads the entire data of the netCDF variable.
1363void NcVar::getVar(char* dataValues) const {
1364 NcType::ncType typeClass(getType().getTypeClass());
1365 if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1366 ncCheck(nc_get_var(groupId, myId,dataValues),__FILE__,__LINE__);
1367 else
1368 ncCheck(nc_get_var_text(groupId, myId,dataValues),__FILE__,__LINE__);
1369}
1370// Reads the entire data of the netCDF variable.
1371void NcVar::getVar(unsigned char* dataValues) const {
1372 NcType::ncType typeClass(getType().getTypeClass());
1373 if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1374 ncCheck(nc_get_var(groupId, myId,dataValues),__FILE__,__LINE__);
1375 else
1376 ncCheck(nc_get_var_uchar(groupId, myId,dataValues),__FILE__,__LINE__);
1377}
1378// Reads the entire data of the netCDF variable.
1379void NcVar::getVar(signed char* dataValues) const {
1380 NcType::ncType typeClass(getType().getTypeClass());
1381 if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1382 ncCheck(nc_get_var(groupId, myId,dataValues),__FILE__,__LINE__);
1383 else
1384 ncCheck(nc_get_var_schar(groupId, myId,dataValues),__FILE__,__LINE__);
1385}
1386// Reads the entire data of the netCDF variable.
1387void NcVar::getVar(short* dataValues) const {
1388 NcType::ncType typeClass(getType().getTypeClass());
1389 if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1390 ncCheck(nc_get_var(groupId, myId,dataValues),__FILE__,__LINE__);
1391 else
1392 ncCheck(nc_get_var_short(groupId, myId,dataValues),__FILE__,__LINE__);
1393}
1394// Reads the entire data of the netCDF variable.
1395void NcVar::getVar(int* dataValues) const {
1396 NcType::ncType typeClass(getType().getTypeClass());
1397 if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1398 ncCheck(nc_get_var(groupId, myId,dataValues),__FILE__,__LINE__);
1399 else
1400 ncCheck(nc_get_var_int(groupId, myId,dataValues),__FILE__,__LINE__);
1401}
1402// Reads the entire data of the netCDF variable.
1403void NcVar::getVar(long* dataValues) const {
1404 NcType::ncType typeClass(getType().getTypeClass());
1405 if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1406 ncCheck(nc_get_var(groupId, myId,dataValues),__FILE__,__LINE__);
1407 else
1408 ncCheck(nc_get_var_long(groupId, myId,dataValues),__FILE__,__LINE__);
1409}
1410// Reads the entire data of the netCDF variable.
1411void NcVar::getVar(float* dataValues) const {
1412 NcType::ncType typeClass(getType().getTypeClass());
1413 if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1414 ncCheck(nc_get_var(groupId, myId,dataValues),__FILE__,__LINE__);
1415 else
1416 ncCheck(nc_get_var_float(groupId, myId,dataValues),__FILE__,__LINE__);
1417}
1418// Reads the entire data of the netCDF variable.
1419void NcVar::getVar(double* dataValues) const {
1420 NcType::ncType typeClass(getType().getTypeClass());
1421 if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1422 ncCheck(nc_get_var(groupId, myId,dataValues),__FILE__,__LINE__);
1423 else
1424 ncCheck(nc_get_var_double(groupId, myId,dataValues),__FILE__,__LINE__);
1425}
1426// Reads the entire data of the netCDF variable.
1427void NcVar::getVar(unsigned short* dataValues) const {
1428 NcType::ncType typeClass(getType().getTypeClass());
1429 if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1430 ncCheck(nc_get_var(groupId, myId,dataValues),__FILE__,__LINE__);
1431 else
1432 ncCheck(nc_get_var_ushort(groupId, myId,dataValues),__FILE__,__LINE__);
1433}
1434// Reads the entire data of the netCDF variable.
1435void NcVar::getVar(unsigned int* dataValues) const {
1436 NcType::ncType typeClass(getType().getTypeClass());
1437 if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1438 ncCheck(nc_get_var(groupId, myId,dataValues),__FILE__,__LINE__);
1439 else
1440 ncCheck(nc_get_var_uint(groupId, myId,dataValues),__FILE__,__LINE__);
1441}
1442// Reads the entire data of the netCDF variable.
1443void NcVar::getVar(long long* dataValues) const {
1444 NcType::ncType typeClass(getType().getTypeClass());
1445 if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1446 ncCheck(nc_get_var(groupId, myId,dataValues),__FILE__,__LINE__);
1447 else
1448 ncCheck(nc_get_var_longlong(groupId, myId,dataValues),__FILE__,__LINE__);
1449}
1450// Reads the entire data of the netCDF variable.
1451void NcVar::getVar(unsigned long long* dataValues) const {
1452 NcType::ncType typeClass(getType().getTypeClass());
1453 if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1454 ncCheck(nc_get_var(groupId, myId,dataValues),__FILE__,__LINE__);
1455 else
1456 ncCheck(nc_get_var_ulonglong(groupId, myId,dataValues),__FILE__,__LINE__);
1457}
1458// Reads the entire data of the netCDF variable.
1459void NcVar::getVar(char** dataValues) const {
1460 NcType::ncType typeClass(getType().getTypeClass());
1461 if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1462 ncCheck(nc_get_var(groupId, myId,dataValues),__FILE__,__LINE__);
1463 else
1464 ncCheck(nc_get_var_string(groupId, myId,dataValues),__FILE__,__LINE__);
1465}
1466// Reads the entire data of the netCDF variable with no data conversion.
1467void NcVar::getVar(void* dataValues) const {
1468 ncCheck(nc_get_var(groupId, myId,dataValues),__FILE__,__LINE__);
1469}
1470
1471
1472
1474
1475// Reads a single datum value of a netCDF variable.
1476void NcVar::getVar(const vector<size_t>& index, char* datumValue) const {
1477 NcType::ncType typeClass(getType().getTypeClass());
1478 if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1479 ncCheck(nc_get_var1(groupId, myId,&index[0],datumValue),__FILE__,__LINE__);
1480 else
1481 ncCheck(nc_get_var1_text(groupId, myId,&index[0],datumValue),__FILE__,__LINE__);
1482}
1483// Reads a single datum value of a netCDF variable.
1484void NcVar::getVar(const vector<size_t>& index, unsigned char* datumValue) const {
1485 NcType::ncType typeClass(getType().getTypeClass());
1486 if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1487 ncCheck(nc_get_var1(groupId, myId,&index[0],datumValue),__FILE__,__LINE__);
1488 else
1489 ncCheck(nc_get_var1_uchar(groupId, myId,&index[0],datumValue),__FILE__,__LINE__);
1490}
1491// Reads a single datum value of a netCDF variable.
1492void NcVar::getVar(const vector<size_t>& index, signed char* datumValue) const {
1493 NcType::ncType typeClass(getType().getTypeClass());
1494 if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1495 ncCheck(nc_get_var1(groupId, myId,&index[0],datumValue),__FILE__,__LINE__);
1496 else
1497 ncCheck(nc_get_var1_schar(groupId, myId,&index[0],datumValue),__FILE__,__LINE__);
1498}
1499// Reads a single datum value of a netCDF variable.
1500void NcVar::getVar(const vector<size_t>& index, short* datumValue) const {
1501 NcType::ncType typeClass(getType().getTypeClass());
1502 if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1503 ncCheck(nc_get_var1(groupId, myId,&index[0],datumValue),__FILE__,__LINE__);
1504 else
1505 ncCheck(nc_get_var1_short(groupId, myId,&index[0],datumValue),__FILE__,__LINE__);
1506}
1507// Reads a single datum value of a netCDF variable.
1508void NcVar::getVar(const vector<size_t>& index, int* datumValue) const {
1509 NcType::ncType typeClass(getType().getTypeClass());
1510 if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1511 ncCheck(nc_get_var1(groupId, myId,&index[0],datumValue),__FILE__,__LINE__);
1512 else
1513 ncCheck(nc_get_var1_int(groupId, myId,&index[0],datumValue),__FILE__,__LINE__);
1514}
1515// Reads a single datum value of a netCDF variable.
1516void NcVar::getVar(const vector<size_t>& index, long* datumValue) const {
1517 NcType::ncType typeClass(getType().getTypeClass());
1518 if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1519 ncCheck(nc_get_var1(groupId, myId,&index[0],datumValue),__FILE__,__LINE__);
1520 else
1521 ncCheck(nc_get_var1_long(groupId, myId,&index[0],datumValue),__FILE__,__LINE__);
1522}
1523// Reads a single datum value of a netCDF variable.
1524void NcVar::getVar(const vector<size_t>& index, float* datumValue) const {
1525 NcType::ncType typeClass(getType().getTypeClass());
1526 if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1527 ncCheck(nc_get_var1(groupId, myId,&index[0],datumValue),__FILE__,__LINE__);
1528 else
1529 ncCheck(nc_get_var1_float(groupId, myId,&index[0],datumValue),__FILE__,__LINE__);
1530}
1531// Reads a single datum value of a netCDF variable.
1532void NcVar::getVar(const vector<size_t>& index, double* datumValue) const {
1533 NcType::ncType typeClass(getType().getTypeClass());
1534 if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1535 ncCheck(nc_get_var1(groupId, myId,&index[0],datumValue),__FILE__,__LINE__);
1536 else
1537 ncCheck(nc_get_var1_double(groupId, myId,&index[0],datumValue),__FILE__,__LINE__);
1538}
1539// Reads a single datum value of a netCDF variable.
1540void NcVar::getVar(const vector<size_t>& index, unsigned short* datumValue) const {
1541 NcType::ncType typeClass(getType().getTypeClass());
1542 if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1543 ncCheck(nc_get_var1(groupId, myId,&index[0],datumValue),__FILE__,__LINE__);
1544 else
1545 ncCheck(nc_get_var1_ushort(groupId, myId,&index[0],datumValue),__FILE__,__LINE__);
1546}
1547// Reads a single datum value of a netCDF variable.
1548void NcVar::getVar(const vector<size_t>& index, unsigned int* datumValue) const {
1549 NcType::ncType typeClass(getType().getTypeClass());
1550 if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1551 ncCheck(nc_get_var1(groupId, myId,&index[0],datumValue),__FILE__,__LINE__);
1552 else
1553 ncCheck(nc_get_var1_uint(groupId, myId,&index[0],datumValue),__FILE__,__LINE__);
1554}
1555// Reads a single datum value of a netCDF variable.
1556void NcVar::getVar(const vector<size_t>& index, long long* datumValue) const {
1557 NcType::ncType typeClass(getType().getTypeClass());
1558 if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1559 ncCheck(nc_get_var1(groupId, myId,&index[0],datumValue),__FILE__,__LINE__);
1560 else
1561 ncCheck(nc_get_var1_longlong(groupId, myId,&index[0],datumValue),__FILE__,__LINE__);
1562}
1563// Reads a single datum value of a netCDF variable
1564void NcVar::getVar(const vector<size_t>& index, unsigned long long* datumValue) const {
1565 NcType::ncType typeClass(getType().getTypeClass());
1566 if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1567 ncCheck(nc_get_var1(groupId, myId,&index[0],datumValue),__FILE__,__LINE__);
1568 else
1569 ncCheck(nc_get_var1_ulonglong(groupId, myId,&index[0],datumValue),__FILE__,__LINE__);
1570}
1571// Reads a single datum value of a netCDF variable.
1572void NcVar::getVar(const vector<size_t>& index, char** datumValue) const {
1573 NcType::ncType typeClass(getType().getTypeClass());
1574 if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1575 ncCheck(nc_get_var1(groupId, myId,&index[0],datumValue),__FILE__,__LINE__);
1576 else
1577 ncCheck(nc_get_var1_string(groupId, myId,&index[0],datumValue),__FILE__,__LINE__);
1578}
1579// Reads a single datum value of a netCDF variable with no data conversion.
1580void NcVar::getVar(const vector<size_t>& index, void* datumValue) const {
1581 ncCheck(nc_get_var1(groupId, myId,&index[0],datumValue),__FILE__,__LINE__);
1582}
1583
1584
1585
1587
1588// Reads an array of values from a netCDF variable.
1589void NcVar::getVar(const vector<size_t>& startp, const vector<size_t>& countp, char* dataValues) const {
1590 NcType::ncType typeClass(getType().getTypeClass());
1591 if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1592 ncCheck(nc_get_vara(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__);
1593 else
1594 ncCheck(nc_get_vara_text(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__);
1595}
1596// Reads an array of values from a netCDF variable.
1597void NcVar::getVar(const vector<size_t>& startp, const vector<size_t>& countp, unsigned char* dataValues) const {
1598 NcType::ncType typeClass(getType().getTypeClass());
1599 if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1600 ncCheck(nc_get_vara(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__);
1601 else
1602 ncCheck(nc_get_vara_uchar(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__);
1603}
1604// Reads an array of values from a netCDF variable.
1605void NcVar::getVar(const vector<size_t>& startp, const vector<size_t>& countp, signed char* dataValues) const {
1606 NcType::ncType typeClass(getType().getTypeClass());
1607 if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1608 ncCheck(nc_get_vara(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__);
1609 else
1610 ncCheck(nc_get_vara_schar(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__);
1611}
1612// Reads an array of values from a netCDF variable.
1613void NcVar::getVar(const vector<size_t>& startp, const vector<size_t>& countp, short* dataValues) const {
1614 NcType::ncType typeClass(getType().getTypeClass());
1615 if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1616 ncCheck(nc_get_vara(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__);
1617 else
1618 ncCheck(nc_get_vara_short(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__);
1619}
1620// Reads an array of values from a netCDF variable.
1621void NcVar::getVar(const vector<size_t>& startp, const vector<size_t>& countp, int* dataValues) const {
1622 NcType::ncType typeClass(getType().getTypeClass());
1623 if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1624 ncCheck(nc_get_vara(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__);
1625 else
1626 ncCheck(nc_get_vara_int(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__);
1627}
1628// Reads an array of values from a netCDF variable.
1629void NcVar::getVar(const vector<size_t>& startp, const vector<size_t>& countp, long* dataValues) const {
1630 NcType::ncType typeClass(getType().getTypeClass());
1631 if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1632 ncCheck(nc_get_vara(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__);
1633 else
1634 ncCheck(nc_get_vara_long(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__);
1635}
1636// Reads an array of values from a netCDF variable.
1637void NcVar::getVar(const vector<size_t>& startp, const vector<size_t>& countp, float* dataValues) const {
1638 NcType::ncType typeClass(getType().getTypeClass());
1639 if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1640 ncCheck(nc_get_vara(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__);
1641 else
1642 ncCheck(nc_get_vara_float(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__);
1643}
1644// Reads an array of values from a netCDF variable.
1645void NcVar::getVar(const vector<size_t>& startp, const vector<size_t>& countp, double* dataValues) const {
1646 NcType::ncType typeClass(getType().getTypeClass());
1647 if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1648 ncCheck(nc_get_vara(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__);
1649 else
1650 ncCheck(nc_get_vara_double(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__);
1651}
1652// Reads an array of values from a netCDF variable.
1653void NcVar::getVar(const vector<size_t>& startp, const vector<size_t>& countp, unsigned short* dataValues) const {
1654 NcType::ncType typeClass(getType().getTypeClass());
1655 if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1656 ncCheck(nc_get_vara(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__);
1657 else
1658 ncCheck(nc_get_vara_ushort(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__);
1659}
1660// Reads an array of values from a netCDF variable.
1661void NcVar::getVar(const vector<size_t>& startp, const vector<size_t>& countp, unsigned int* dataValues) const {
1662 NcType::ncType typeClass(getType().getTypeClass());
1663 if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1664 ncCheck(nc_get_vara(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__);
1665 else
1666 ncCheck(nc_get_vara_uint(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__);
1667}
1668// Reads an array of values from a netCDF variable.
1669void NcVar::getVar(const vector<size_t>& startp, const vector<size_t>& countp, long long* dataValues) const {
1670 NcType::ncType typeClass(getType().getTypeClass());
1671 if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1672 ncCheck(nc_get_vara(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__);
1673 else
1674 ncCheck(nc_get_vara_longlong(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__);
1675}
1676// Reads an array of values from a netCDF variable
1677void NcVar::getVar(const vector<size_t>& startp, const vector<size_t>& countp, unsigned long long* dataValues) const {
1678 NcType::ncType typeClass(getType().getTypeClass());
1679 if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1680 ncCheck(nc_get_vara(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__);
1681 else
1682 ncCheck(nc_get_vara_ulonglong(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__);
1683}
1684// Reads an array of values from a netCDF variable.
1685void NcVar::getVar(const vector<size_t>& startp, const vector<size_t>& countp, char** dataValues) const {
1686 NcType::ncType typeClass(getType().getTypeClass());
1687 if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1688 ncCheck(nc_get_vara(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__);
1689 else
1690 ncCheck(nc_get_vara_string(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__);
1691}
1692// Reads an array of values from a netCDF variable with no data conversion.
1693void NcVar::getVar(const vector<size_t>& startp, const vector<size_t>& countp, void* dataValues) const {
1694 ncCheck(nc_get_vara(groupId, myId,&startp[0],&countp[0],dataValues),__FILE__,__LINE__);
1695}
1696
1697
1699
1700// Reads a subsampled (strided) array section of values from a netCDF variable.
1701void NcVar::getVar(const vector<size_t>& startp, const vector<size_t>& countp, const vector<ptrdiff_t>& stridep, char* dataValues) const {
1702 NcType::ncType typeClass(getType().getTypeClass());
1703 if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1704 ncCheck(nc_get_vars(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__);
1705 else
1706 ncCheck(nc_get_vars_text(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__);
1707}
1708// Reads a subsampled (strided) array section of values from a netCDF variable.
1709void NcVar::getVar(const vector<size_t>& startp, const vector<size_t>& countp, const vector<ptrdiff_t>& stridep, unsigned char* dataValues) const {
1710 NcType::ncType typeClass(getType().getTypeClass());
1711 if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1712 ncCheck(nc_get_vars(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__);
1713 else
1714 ncCheck(nc_get_vars_uchar(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__);
1715}
1716// Reads a subsampled (strided) array section of values from a netCDF variable.
1717void NcVar::getVar(const vector<size_t>& startp, const vector<size_t>& countp, const vector<ptrdiff_t>& stridep, signed char* dataValues) const {
1718 NcType::ncType typeClass(getType().getTypeClass());
1719 if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1720 ncCheck(nc_get_vars(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__);
1721 else
1722 ncCheck(nc_get_vars_schar(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__);
1723}
1724// Reads a subsampled (strided) array section of values from a netCDF variable.
1725void NcVar::getVar(const vector<size_t>& startp, const vector<size_t>& countp, const vector<ptrdiff_t>& stridep, short* dataValues) const {
1726 NcType::ncType typeClass(getType().getTypeClass());
1727 if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1728 ncCheck(nc_get_vars(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__);
1729 else
1730 ncCheck(nc_get_vars_short(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__);
1731}
1732// Reads a subsampled (strided) array section of values from a netCDF variable.
1733void NcVar::getVar(const vector<size_t>& startp, const vector<size_t>& countp, const vector<ptrdiff_t>& stridep, int* dataValues) const {
1734 NcType::ncType typeClass(getType().getTypeClass());
1735 if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1736 ncCheck(nc_get_vars(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__);
1737 else
1738 ncCheck(nc_get_vars_int(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__);
1739}
1740// Reads a subsampled (strided) array section of values from a netCDF variable.
1741void NcVar::getVar(const vector<size_t>& startp, const vector<size_t>& countp, const vector<ptrdiff_t>& stridep, long* dataValues) const {
1742 NcType::ncType typeClass(getType().getTypeClass());
1743 if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1744 ncCheck(nc_get_vars(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__);
1745 else
1746 ncCheck(nc_get_vars_long(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__);
1747}
1748// Reads a subsampled (strided) array section of values from a netCDF variable.
1749void NcVar::getVar(const vector<size_t>& startp, const vector<size_t>& countp, const vector<ptrdiff_t>& stridep, float* dataValues) const {
1750 NcType::ncType typeClass(getType().getTypeClass());
1751 if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1752 ncCheck(nc_get_vars(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__);
1753 else
1754 ncCheck(nc_get_vars_float(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__);
1755}
1756// Reads a subsampled (strided) array section of values from a netCDF variable.
1757void NcVar::getVar(const vector<size_t>& startp, const vector<size_t>& countp, const vector<ptrdiff_t>& stridep, double* dataValues) const {
1758 NcType::ncType typeClass(getType().getTypeClass());
1759 if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1760 ncCheck(nc_get_vars(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__);
1761 else
1762 ncCheck(nc_get_vars_double(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__);
1763}
1764// Reads a subsampled (strided) array section of values from a netCDF variable.
1765void NcVar::getVar(const vector<size_t>& startp, const vector<size_t>& countp, const vector<ptrdiff_t>& stridep, unsigned short* dataValues) const {
1766 NcType::ncType typeClass(getType().getTypeClass());
1767 if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1768 ncCheck(nc_get_vars(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__);
1769 else
1770 ncCheck(nc_get_vars_ushort(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__);
1771}
1772// Reads a subsampled (strided) array section of values from a netCDF variable.
1773void NcVar::getVar(const vector<size_t>& startp, const vector<size_t>& countp, const vector<ptrdiff_t>& stridep, unsigned int* dataValues) const {
1774 NcType::ncType typeClass(getType().getTypeClass());
1775 if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1776 ncCheck(nc_get_vars(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__);
1777 else
1778 ncCheck(nc_get_vars_uint(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__);
1779}
1780// Reads a subsampled (strided) array section of values from a netCDF variable.
1781void NcVar::getVar(const vector<size_t>& startp, const vector<size_t>& countp, const vector<ptrdiff_t>& stridep, long long* dataValues) const {
1782 NcType::ncType typeClass(getType().getTypeClass());
1783 if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1784 ncCheck(nc_get_vars(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__);
1785 else
1786 ncCheck(nc_get_vars_longlong(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__);
1787}
1788// Reads a subsampled (strided) array section of values from a netCDF variable
1789void NcVar::getVar(const vector<size_t>& startp, const vector<size_t>& countp, const vector<ptrdiff_t>& stridep, unsigned long long* dataValues) const {
1790 NcType::ncType typeClass(getType().getTypeClass());
1791 if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1792 ncCheck(nc_get_vars(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__);
1793 else
1794 ncCheck(nc_get_vars_ulonglong(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__);
1795}
1796// Reads a subsampled (strided) array section of values from a netCDF variable.
1797void NcVar::getVar(const vector<size_t>& startp, const vector<size_t>& countp, const vector<ptrdiff_t>& stridep, char** dataValues) const {
1798 NcType::ncType typeClass(getType().getTypeClass());
1799 if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1800 ncCheck(nc_get_vars(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__);
1801 else
1802 ncCheck(nc_get_vars_string(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__);
1803}
1804// Reads a subsampled (strided) array section of values from a netCDF variable with no data conversion.
1805void NcVar::getVar(const vector<size_t>& startp, const vector<size_t>& countp, const vector<ptrdiff_t>& stridep, void* dataValues) const {
1806 ncCheck(nc_get_vars(groupId, myId,&startp[0],&countp[0],&stridep[0],dataValues),__FILE__,__LINE__);
1807}
1808
1809
1811
1812// Reads a mapped array section of values from a netCDF variable.
1813void 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 {
1814 NcType::ncType typeClass(getType().getTypeClass());
1815 if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1816 ncCheck(nc_get_varm(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__);
1817 else
1818 ncCheck(nc_get_varm_text(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__);
1819}
1820// Reads a mapped array section of values from a netCDF variable.
1821void 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 {
1822 NcType::ncType typeClass(getType().getTypeClass());
1823 if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1824 ncCheck(nc_get_varm(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__);
1825 else
1826 ncCheck(nc_get_varm_uchar(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__);
1827}
1828// Reads a mapped array section of values from a netCDF variable.
1829void 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 {
1830 NcType::ncType typeClass(getType().getTypeClass());
1831 if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1832 ncCheck(nc_get_varm(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__);
1833 else
1834 ncCheck(nc_get_varm_schar(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__);
1835}
1836// Reads a mapped array section of values from a netCDF variable.
1837void 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 {
1838 NcType::ncType typeClass(getType().getTypeClass());
1839 if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1840 ncCheck(nc_get_varm(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__);
1841 else
1842 ncCheck(nc_get_varm_short(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__);
1843}
1844// Reads a mapped array section of values from a netCDF variable.
1845void 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 {
1846 NcType::ncType typeClass(getType().getTypeClass());
1847 if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1848 ncCheck(nc_get_varm(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__);
1849 else
1850 ncCheck(nc_get_varm_int(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__);
1851}
1852// Reads a mapped array section of values from a netCDF variable.
1853void 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 {
1854 NcType::ncType typeClass(getType().getTypeClass());
1855 if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1856 ncCheck(nc_get_varm(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__);
1857 else
1858 ncCheck(nc_get_varm_long(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__);
1859}
1860// Reads a mapped array section of values from a netCDF variable.
1861void 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 {
1862 NcType::ncType typeClass(getType().getTypeClass());
1863 if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1864 ncCheck(nc_get_varm(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__);
1865 else
1866 ncCheck(nc_get_varm_float(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__);
1867}
1868// Reads a mapped array section of values from a netCDF variable.
1869void 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 {
1870 NcType::ncType typeClass(getType().getTypeClass());
1871 if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1872 ncCheck(nc_get_varm(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__);
1873 else
1874 ncCheck(nc_get_varm_double(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__);
1875}
1876// Reads a mapped array section of values from a netCDF variable.
1877void 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 {
1878 NcType::ncType typeClass(getType().getTypeClass());
1879 if(typeClass == NcType::nc_VLEN ||typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1880 ncCheck(nc_get_varm(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__);
1881 else
1882 ncCheck(nc_get_varm_ushort(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__);
1883}
1884// Reads a mapped array section of values from a netCDF variable.
1885void 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 {
1886 NcType::ncType typeClass(getType().getTypeClass());
1887 if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1888 ncCheck(nc_get_varm(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__);
1889 else
1890 ncCheck(nc_get_varm_uint(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__);
1891}
1892// Reads a mapped array section of values from a netCDF variable.
1893void 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 {
1894 NcType::ncType typeClass(getType().getTypeClass());
1895 if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1896 ncCheck(nc_get_varm(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__);
1897 else
1898 ncCheck(nc_get_varm_longlong(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__);
1899}
1900// Reads a mapped array section of values from a netCDF variable
1901void 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 {
1902 NcType::ncType typeClass(getType().getTypeClass());
1903 if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1904 ncCheck(nc_get_varm(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__);
1905 else
1906 ncCheck(nc_get_varm_ulonglong(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__);
1907}
1908// Reads a mapped array section of values from a netCDF variable.
1909void 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 {
1910 NcType::ncType typeClass(getType().getTypeClass());
1911 if(typeClass == NcType::nc_VLEN || typeClass == NcType::nc_OPAQUE || typeClass == NcType::nc_ENUM || typeClass == NcType::nc_COMPOUND)
1912 ncCheck(nc_get_varm(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__);
1913 else
1914 ncCheck(nc_get_varm_string(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__);
1915}
1916// Reads a mapped array section of values from a netCDF variable with no data conversion.
1917void 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 {
1918 ncCheck(nc_get_varm(groupId, myId,&startp[0],&countp[0],&stridep[0],&imapp[0],dataValues),__FILE__,__LINE__);
1919}
std::string getName() const
Get the attribute name.
Definition: ncAtt.h:30
Class represents a netCDF dimension.
Definition: ncDim.h:13
Class represents a netCDF group.
Definition: ncGroup.h:28
@ ParentsAndCurrent
Select from contents of current and parents groups.
Definition: ncGroup.h:53
Base class inherited by NcOpaque, NcVlen, NcCompound and NcEnum classes.
Definition: ncType.h:15
ncType getTypeClass() const
The type class returned as enumeration type.
Definition: ncType.cpp:116
ncType
List of netCDF types that can be represented.
Definition: ncType.h:26
@ nc_OPAQUE
"NcOpaque type"
Definition: ncType.h:40
@ nc_VLEN
"NcVlen type"
Definition: ncType.h:39
@ nc_ENUM
"NcEnum type"
Definition: ncType.h:41
@ nc_COMPOUND
"NcCompound type"
Definition: ncType.h:42
nc_type getId() const
The netCDF Id of this type.
Definition: ncType.h:88
Class represents a netCDF attribute local to a netCDF variable.
Definition: ncVarAtt.h:14
Class represents a netCDF variable.
Definition: ncVar.h:34
void freeString(size_t len, char **data) const
Free memory allocated for a string.
Definition: ncVar.cpp:646
ChecksumMode getChecksum() const
Gets the checksum parameters of the variable.
Definition: ncVar.cpp:695
bool operator!=(const NcVar &rhs) const
!= operator
Definition: ncVar.cpp:53
void setChecksum(ChecksumMode checksumMode) const
Sets the checksum parameters of a variable.
Definition: ncVar.cpp:689
ChunkMode
Used for chunking specifications (see NcVar::setChunking, NcVar::getChunkingParameters).
Definition: ncVar.h:39
void getFilter(unsigned int *idp, size_t *nparamsp, unsigned int *params) const
Query filter properties (if a filter has been applied).
Definition: ncVar.cpp:634
NcGroup getParentGroup() const
Gets parent group.
Definition: ncVar.cpp:80
NcDim getDim(int i) const
Gets the i'th NcDim object.
Definition: ncVar.cpp:171
void getCompressionParameters(bool &shuffleFilterEnabled, bool &deflateFilterEnabled, int &deflateLevel) const
Gets the compression parameters.
Definition: ncVar.cpp:614
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...
void getTypeLen(nc_type type) const
Query the length of a given ncType.
Definition: ncVar.cpp:640
void setCompression(bool enableShuffleFilter, bool enableDeflateFilter, int deflateLevel) const
Sets the compression parameters.
Definition: ncVar.cpp:601
EndianMode getEndianness() const
Gets the endianness of the variable.
Definition: ncVar.cpp:672
std::string getName() const
Name of this NcVar object.
Definition: ncVar.cpp:528
void rename(const std::string &newname) const
Rename the variable.
Definition: ncVar.cpp:710
ChecksumMode
Used for checksum specification (see NcVar::setChecksum, NcVar::getChecksum).
Definition: ncVar.h:63
int getDimCount() const
The the number of dimensions.
Definition: ncVar.cpp:142
void getFillModeParameters(bool &fillMode, void *fillValue=NULL) const
This is an overloaded member function, provided for convenience.
Definition: ncVar.cpp:585
int getId() const
Get the variable id.
Definition: ncVar.cpp:86
void getVar(void *dataValues) const
This is an overloaded member function, provided for convenience.
Definition: ncVar.cpp:1467
void setChunkCache(size_t size, size_t nelems, float preemption) const
Change cache setttings for a chunked variable.
Definition: ncVar.cpp:652
bool operator==(const NcVar &rhs) const
equivalence operator
Definition: ncVar.cpp:46
NcVarAtt getAtt(const std::string &name) const
Gets attribute by name.
Definition: ncVar.cpp:211
void putVar(const void *dataValues) const
This is an overloaded member function, provided for convenience.
Definition: ncVar.cpp:843
void setEndianness(EndianMode endianMode) const
Sets the endianness of the variable.
Definition: ncVar.cpp:665
std::map< std::string, NcVarAtt > getAtts() const
Gets the set of attributes.
Definition: ncVar.cpp:196
void setFilter(unsigned int id, size_t nparams, const unsigned int *parms) const
Define new variable for compression/decompression.
Definition: ncVar.cpp:627
NcVar()
Constructor generates a null object.
Definition: ncVar.cpp:65
void setChunking(ChunkMode chunkMode, std::vector< size_t > &chunksizes) const
Sets chunking parameters.
Definition: ncVar.cpp:543
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:126
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
std::vector< NcDim > getDims() const
Gets the set of NcDim objects.
Definition: ncVar.cpp:151
EndianMode
Used to specifying the endianess of the data, (see NcVar::setEndianness, NcVar::getEndianness).
Definition: ncVar.h:55
int getAttCount() const
Gets the number of attributes.
Definition: ncVar.cpp:187
void getChunkingParameters(ChunkMode &chunkMode, std::vector< size_t > &chunkSizes) const
Gets the chunking parameters.
Definition: ncVar.cpp:550
Base object is thrown if a netCDF exception is encountered.
Definition: ncException.h:24
Exception classes.
Definition: ncException.h:16
C++ API for netCDF4.
Definition: ncAtt.h:10
void ncCheckDataMode(int ncid)
Function checks if the file (group) is in data mode.
Definition: ncCheck.cpp:89
NcShort ncShort
A global instance of the NcShort class within the netCDF namespace.
Definition: ncShort.cpp:7
NcFloat ncFloat
A global instance of the NcFloat class within the netCDF namespace.
Definition: ncFloat.cpp:7
NcInt64 ncInt64
A global instance of the NcInt64 class within the netCDF namespace.
Definition: ncInt64.cpp:7
void ncCheckDefineMode(int ncid)
Function checks if the file (group) is in define mode.
Definition: ncCheck.cpp:83
NcUint64 ncUint64
A global instance of the NcUint64 class within the netCDF namespace.
Definition: ncUint64.cpp:7
NcUint ncUint
A global instance of the NcUint class within the netCDF namespace.
Definition: ncUint.cpp:7
NcString ncString
A global instance of the NcString class within the netCDF namespace.
Definition: ncString.cpp:7
NcInt ncInt
A global instance of the NcInt class within the netCDF namespace.
Definition: ncInt.cpp:7
NcDouble ncDouble
A global instance of the NcDouble class within the netCDF namespace.
Definition: ncDouble.cpp:7
void ncCheck(int retCode, const char *file, int line)
Function checks error code and if necessary throws an exception.
Definition: ncCheck.cpp:11
NcUbyte ncUbyte
A global instance of the NcUbyte class within the netCDF namespace.
Definition: ncUbyte.cpp:7
NcChar ncChar
A global instance of the NcChar class within the netCDF namespace.
Definition: ncChar.cpp:7
NcByte ncByte
A global instance of the NcByte class within the netCDF namespace.
Definition: ncByte.cpp:7

Return to the Main Unidata NetCDF page.
Generated on Wed Nov 10 2021 15:25:08 for NetCDF-C++. NetCDF is a Unidata library.