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;
108 void GetAtt(
string name, std::vector <double> &values)
const;
109 void GetAtt(
string name, std::vector <long> &values)
const;
110 void GetAtt(
string name,
string &values)
const;
117 void SetAtt(
string name,
const std::vector <double> &values) {
118 _flt_atts.push_back(make_pair(name, values));
120 void SetAtt(
string name,
const std::vector <long> &values) {
121 _int_atts.push_back(make_pair(name, values));
123 void SetAtt(
string name,
const string &values) {
124 _str_atts.push_back(make_pair(name, values));
127 VDF_API friend std::ostream &operator<<(std::ostream &o,
const Variable &var);
130 (v1._name == v2._name) &&
131 (v1._dimnames == v2._dimnames) &&
132 (v1._flt_atts == v2._flt_atts) &&
133 (v1._int_atts == v2._int_atts) &&
134 (v1._str_atts == v2._str_atts) &&
135 (v1._type == v2._type) &&
136 (v1._varid == v2._varid)
143 std::vector <string> _dimnames;
144 std::vector <std::pair <string, std::vector <double> > > _flt_atts;
145 std::vector <std::pair <string, std::vector <long> > > _int_atts;
146 std::vector <std::pair <string, string> > _str_atts;
160 int Initialize(
string path);
199 const size_t start[],
const size_t count[],
float *data,
int fd = 0
202 const size_t start[],
const size_t count[],
int *data,
int fd = 0
205 const size_t start[],
const size_t count[],
char *data,
int fd = 0
213 int Close(
int fd = 0);
237 void GetDimensions(std::vector <string> &names, std::vector <size_t> &dims)
const;
250 string DimName(
int id)
const;
264 size_t DimLen(
string name)
const;
277 int DimId(
string name)
const;
288 std::vector <string> GetAttNames()
const;
298 int GetAttType(
string name)
const;
314 void GetAtt(
string name, std::vector <double> &values)
const;
315 void GetAtt(
string name, std::vector <long> &values)
const;
316 void GetAtt(
string name,
string &values)
const;
330 static bool IsNCTypeInt(
int type);
342 static bool IsNCTypeFloat(
int type);
354 static bool IsNCTypeText(
int type);
360 std::map <int, int> _ovr_table;
363 std::vector <string> _dimnames;
364 std::vector <size_t> _dims;
365 std::vector <string> _unlimited_dimnames;
366 std::vector <std::pair <string, std::vector <double> > > _flt_atts;
367 std::vector <std::pair <string, std::vector <long> > > _int_atts;
368 std::vector <std::pair <string, string> > _str_atts;
369 std::vector <NetCDFSimple::Variable> _variables;
373 std::vector <std::pair <
string, std::vector <double> > > &flt_atts,
374 std::vector <std::pair <
string, std::vector <long> > > &int_atts,
375 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)