VAPOR3 3.9.4
DCMelanie.h
Go to the documentation of this file.
1#ifdef BUILD_DC_MELANIE
2
3 #include <vector>
4 #include <algorithm>
5 #include <map>
6 #include <iostream>
7 #include <vapor/MyBase.h>
9 #include <vapor/Proj4API.h>
10 #include <vapor/UDUnitsClass.h>
11 #include <vapor/utils.h>
12 #include <vapor/DC.h>
13 #include <vapor/STLUtils.h>
14
15 #ifndef _DCMelanie_H_
16 #define _DCMelanie_H_
17
18namespace VAPoR {
19
20
21class VDF_API DCMelanie : public VAPoR::DC {
22public:
23 DCMelanie();
24 virtual ~DCMelanie();
25
26protected:
42 //
43 virtual int initialize(const vector<string> &paths, const std::vector<string> &options);
44
45
48 virtual bool getDimension(string dimname, DC::Dimension &dimension) const;
49
52 virtual std::vector<string> getDimensionNames() const;
53
56 std::vector<string> getMeshNames() const;
57
60 virtual bool getMesh(string mesh_name, DC::Mesh &mesh) const;
61
64 virtual bool getCoordVarInfo(string varname, DC::CoordVar &cvar) const;
65
68 virtual bool getDataVarInfo(string varname, DC::DataVar &datavar) const;
69
72 virtual bool getAuxVarInfo(string varname, DC::AuxVar &var) const;
73
74
76 //
77 virtual bool getBaseVarInfo(string varname, DC::BaseVar &var) const;
78
79
80
83 virtual std::vector<string> getDataVarNames() const;
84
85 virtual std::vector<string> getAuxVarNames() const;
86
87
90 virtual std::vector<string> getCoordVarNames() const;
91
94 virtual size_t getNumRefLevels(string varname) const { return (1); }
95
98 virtual string getMapProjection() const
99 {
100 // Projections not supported yet :-(
101 //
102 return (_proj4String);
103 }
104
107 virtual bool getAtt(string varname, string attname, vector<double> &values) const;
108 virtual bool getAtt(string varname, string attname, vector<long> &values) const;
109 virtual bool getAtt(string varname, string attname, string &values) const;
110
113 virtual std::vector<string> getAttNames(string varname) const;
114
117 virtual XType getAttType(string varname, string attname) const;
118
121 virtual int getDimLensAtLevel(string varname, int level, std::vector<size_t> &dims_at_level, std::vector<size_t> &bs_at_level) const;
122
123
126 virtual int openVariableRead(size_t ts, string varname, int, int) { return (DCMelanie::openVariableRead(ts, varname)); }
127
128 virtual int openVariableRead(size_t ts, string varname);
129
130
133 virtual int closeVariable(int fd);
134
136 //
137 virtual int readRegion(int fd, const vector<size_t> &min, const vector<size_t> &max, float *region) { return (_readRegionTemplate(fd, min, max, region)); }
138 virtual int readRegion(int fd, const vector<size_t> &min, const vector<size_t> &max, double *region) { return (_readRegionTemplate(fd, min, max, region)); }
139 virtual int readRegion(int fd, const vector<size_t> &min, const vector<size_t> &max, int *region) { return (_readRegionTemplate(fd, min, max, region)); }
140
143 virtual bool variableExists(size_t ts, string varname, int reflevel = 0, int lod = 0) const;
144
145private:
146 NetCDFCFCollection *_ncdfc;
147 VAPoR::UDUnits _udunits;
148
149 string _proj4String;
150 std::map<string, DC::Dimension> _dimsMap;
151 std::map<string, DC::CoordVar> _coordVarsMap;
152 std::map<string, DC::AuxVar> _auxVarsMap;
153 std::map<string, DC::Mesh> _meshMap;
154 std::map<string, DC::DataVar> _dataVarsMap;
155 std::map<string, string> _coordVarKeys;
156 std::map<string, string> _sanitizedToOriginalMap;
157 std::vector<NetCDFCollection::DerivedVar *> _derivedVars;
158
159 const string nodeFaceVar = "cellsOnVertex";
160 const string faceNodeVar = "verticesOnCell";
161 const vector<string> fakeVars = {nodeFaceVar, faceNodeVar};
162 int fakeVarsFileCounterStart = 10000;
163 int fakeVarsFileCounter = fakeVarsFileCounterStart;
164 std::map<int, string> _fdMap;
165
166
167 string sanitizeVarName(const string &name);
168 string getOriginalVarName(const string &name) const;
169
170 template<class T> int _readRegionTemplate(int fd, const vector<size_t> &min, const vector<size_t> &max, T *region);
171
172 template<class T> bool _getAttTemplate(string varname, string attname, T &values) const;
173};
174}; // namespace VAPoR
175
176 #endif
177#endif
A Template Method design pattern for reading a collection of data.
Definition: DC.h:150
#define VDF_API
Definition: common.h:73