5#ifndef _NetCDFSimple_h_
6#define _NetCDFSimple_h_
53 Variable(
string varname, std::vector<string> dimnames,
int type);
57 string GetName()
const {
return (_name); };
70 std::vector<string>
GetDimNames()
const {
return (_dimnames); };
71 void SetDimNames(
const std::vector<string> dimnames) { _dimnames = dimnames; }
101 void GetAtt(
string name, std::vector<double> &values)
const;
102 void GetAtt(
string name, std::vector<long> &values)
const;
103 void GetAtt(
string name,
string &values)
const;
110 void SetAtt(
string name,
const std::vector<double> &values) { _flt_atts.push_back(make_pair(name, values)); }
111 void SetAtt(
string name,
const std::vector<long> &values) { _int_atts.push_back(make_pair(name, values)); }
112 void SetAtt(
string name,
const string &values) { _str_atts.push_back(make_pair(name, values)); }
117 return ((v1._name == v2._name) && (v1._dimnames == v2._dimnames) && (v1._flt_atts == v2._flt_atts) && (v1._int_atts == v2._int_atts) && (v1._str_atts == v2._str_atts)
118 && (v1._type == v2._type));
123 std::vector<string> _dimnames;
124 std::vector<std::pair<string, std::vector<double>>> _flt_atts;
125 std::vector<std::pair<string, std::vector<long>>> _int_atts;
126 std::vector<std::pair<string, string>> _str_atts;
177 int Read(
const size_t start[],
const size_t count[],
double *data,
int fd = 0)
const;
178 int Read(
const size_t start[],
const size_t count[],
float *data,
int fd = 0)
const;
179 int Read(
const size_t start[],
const size_t count[],
int *data,
int fd = 0)
const;
180 int Read(
const size_t start[],
const size_t count[],
char *data,
int fd = 0)
const;
196 const std::vector<NetCDFSimple::Variable> &
GetVariables()
const {
return (_variables); };
209 void GetDimensions(std::vector<string> &names, std::vector<size_t> &dims)
const;
286 void GetAtt(
string name, std::vector<double> &values)
const;
287 void GetAtt(
string name, std::vector<long> &values)
const;
288 void GetAtt(
string name,
string &values)
const;
337 std::vector<std::pair<string, std::vector<double>>>
_flt_atts;
338 std::vector<std::pair<string, std::vector<long>>>
_int_atts;
342 int _GetAtts(
int ncid,
int varid, std::vector<std::pair<
string, std::vector<double>>> &flt_atts, std::vector<std::pair<
string, std::vector<long>>> &int_atts,
343 std::vector<std::pair<string, string>> &str_atts);
NetCDFSimple API interface.
void SetAtt(string name, const std::vector< double > &values)
void SetAtt(string name, const string &values)
int GetAttType(string name) const
void SetAtt(string name, const std::vector< long > &values)
std::vector< string > GetDimNames() const
void GetAtt(string name, string &values) const
string GetName() const
Return the variable's name.
std::vector< string > GetAttNames() const
VDF_API friend bool operator==(const Variable &v1, const Variable &v2)
void GetAtt(string name, std::vector< double > &values) const
void GetAtt(string name, std::vector< long > &values) const
void SetDimNames(const std::vector< string > dimnames)
VDF_API friend std::ostream & operator<<(std::ostream &o, const Variable &var)
Variable(string varname, std::vector< string > dimnames, int type)
NetCDFSimple API interface.
VDF_API friend std::ostream & operator<<(std::ostream &o, const NetCDFSimple &nc)
string DimName(int id) const
std::vector< std::pair< string, std::vector< double > > > _flt_atts
int Read(const size_t start[], const size_t count[], char *data, int fd=0) const
std::vector< string > GetAttNames() const
virtual int Initialize(string path)
int _GetAtts(int ncid, int varid, std::vector< std::pair< string, std::vector< double > > > &flt_atts, std::vector< std::pair< string, std::vector< long > > > &int_atts, std::vector< std::pair< string, string > > &str_atts)
int GetAttType(string name) const
std::vector< std::pair< string, string > > _str_atts
void GetAtt(string name, string &values) const
size_t DimLen(string name) const
const std::vector< NetCDFSimple::Variable > & GetVariables() const
std::vector< NetCDFSimple::Variable > _variables
virtual int Close(int fd=0)
std::vector< string > _dimnames
virtual int OpenRead(const NetCDFSimple::Variable &variable)
void GetDimensions(std::vector< string > &names, std::vector< size_t > &dims) const
void GetAtt(string name, std::vector< long > &values) const
static bool IsNCTypeInt(int type)
std::vector< size_t > _dims
std::vector< string > _unlimited_dimnames
int Read(const size_t start[], const size_t count[], float *data, int fd=0) const
static bool IsNCTypeText(int type)
static bool IsNCTypeFloat(int type)
std::vector< std::pair< string, std::vector< long > > > _int_atts
int Read(const size_t start[], const size_t count[], int *data, int fd=0) const
std::map< int, int > _ovr_table
int Read(const size_t start[], const size_t count[], double *data, int fd=0) const
void GetAtt(string name, std::vector< double > &values) const
int DimId(string name) const