5 #ifndef _NetCDFSimple_h_
6 #define _NetCDFSimple_h_
12 #include <vapor/MyBase.h>
55 string varname, std::vector <string> dimnames,
68 std::vector <string> GetAttNames()
const;
74 std::vector <string>
GetDimNames()
const {
return(_dimnames); };
84 int GetAttType(
string name)
const;
104 void GetAtt(
string name, std::vector <double> &values)
const;
105 void GetAtt(
string name, std::vector <long> &values)
const;
106 void GetAtt(
string name,
string &values)
const;
113 void SetAtt(
string name,
const std::vector <double> &values) {
114 _flt_atts.push_back(make_pair(name, values));
116 void SetAtt(
string name,
const std::vector <long> &values) {
117 _int_atts.push_back(make_pair(name, values));
119 void SetAtt(
string name,
const string &values) {
120 _str_atts.push_back(make_pair(name, values));
123 VDF_API friend std::ostream &operator<<(std::ostream &o,
const Variable &var);
126 (v1._name == v2._name) &&
127 (v1._dimnames == v2._dimnames) &&
128 (v1._flt_atts == v2._flt_atts) &&
129 (v1._int_atts == v2._int_atts) &&
130 (v1._str_atts == v2._str_atts) &&
131 (v1._type == v2._type) &&
132 (v1._varid == v2._varid)
139 std::vector <string> _dimnames;
140 std::vector <std::pair <string, std::vector <double> > > _flt_atts;
141 std::vector <std::pair <string, std::vector <long> > > _int_atts;
142 std::vector <std::pair <string, string> > _str_atts;
156 int Initialize(
string path);
195 const size_t start[],
const size_t count[],
float *data,
int fd = 0
198 const size_t start[],
const size_t count[],
int *data,
int fd = 0
201 const size_t start[],
const size_t count[],
char *data,
int fd = 0
209 int Close(
int fd = 0);
233 void GetDimensions(std::vector <string> &names, std::vector <size_t> &dims)
const;
246 string DimName(
int id)
const;
260 size_t DimLen(
string name)
const;
273 int DimId(
string name)
const;
284 std::vector <string> GetAttNames()
const;
294 int GetAttType(
string name)
const;
310 void GetAtt(
string name, std::vector <double> &values)
const;
311 void GetAtt(
string name, std::vector <long> &values)
const;
312 void GetAtt(
string name,
string &values)
const;
326 static bool IsNCTypeInt(
int type);
338 static bool IsNCTypeFloat(
int type);
350 static bool IsNCTypeText(
int type);
356 std::map <int, int> _ovr_table;
359 std::vector <string> _dimnames;
360 std::vector <size_t> _dims;
361 std::vector <string> _unlimited_dimnames;
362 std::vector <std::pair <string, std::vector <double> > > _flt_atts;
363 std::vector <std::pair <string, std::vector <long> > > _int_atts;
364 std::vector <std::pair <string, string> > _str_atts;
365 std::vector <NetCDFSimple::Variable> _variables;
369 std::vector <std::pair <
string, std::vector <double> > > &flt_atts,
370 std::vector <std::pair <
string, std::vector <long> > > &int_atts,
371 std::vector <std::pair <string, string> > &str_atts
void SetAtt(string name, const string &values)
NetCDFSimple API interface.
std::vector< string > GetDimNames() const
int GetVarID() const
Return the netCDF variable ID for this variable.
string GetName() const
Return the variable's name.
const std::vector< NetCDFSimple::Variable > & GetVariables() const
VDF_API friend bool operator==(const Variable &v1, const Variable &v2)
void SetAtt(string name, const std::vector< long > &values)
NetCDFSimple API interface.
void SetAtt(string name, const std::vector< double > &values)