VAPOR3 3.9.4
DCP.h
Go to the documentation of this file.
1#include <vector>
2#include <algorithm>
3#include <map>
4#include <iostream>
5#include <vapor/MyBase.h>
7#include <vapor/Proj4API.h>
9#include <vapor/utils.h>
10#include <vapor/DC.h>
11#include <vapor/STLUtils.h>
12
13#ifndef _DCP_H_
14 #define _DCP_H_
15
19 #define DCP_ENABLE_PARTICLE_DENSITY 0
20
21namespace VAPoR {
22
23
26
27class VDF_API DCP : public VAPoR::DC {
28public:
29 DCP();
30 virtual ~DCP();
31
32protected:
48 //
49 virtual int initialize(const vector<string> &paths, const std::vector<string> &options);
50
51
54 virtual bool getDimension(string dimname, DC::Dimension &dimension) const;
55 virtual bool getDimension(string dimname, DC::Dimension &dimension, long ts) const;
56
59 virtual std::vector<string> getDimensionNames() const;
60
63 std::vector<string> getMeshNames() const;
64
67 virtual bool getMesh(string mesh_name, DC::Mesh &mesh) const;
68
71 virtual bool getCoordVarInfo(string varname, DC::CoordVar &cvar) const;
72
75 virtual bool getDataVarInfo(string varname, DC::DataVar &datavar) const;
76
79 virtual bool getAuxVarInfo(string varname, DC::AuxVar &var) const;
80
81
83 //
84 virtual bool getBaseVarInfo(string varname, DC::BaseVar &var) const;
85
86
87
90 virtual std::vector<string> getDataVarNames() const;
91
92 virtual std::vector<string> getAuxVarNames() const;
93
94
97 virtual std::vector<string> getCoordVarNames() const;
98
101 virtual size_t getNumRefLevels(string varname) const { return (1); }
102
105 virtual string getMapProjection() const
106 {
107 // Projections not supported yet :-(
108 //
109 return (_proj4String);
110 }
111
114 virtual bool getAtt(string varname, string attname, vector<double> &values) const;
115 virtual bool getAtt(string varname, string attname, vector<long> &values) const;
116 virtual bool getAtt(string varname, string attname, string &values) const;
117
120 virtual std::vector<string> getAttNames(string varname) const;
121
124 virtual XType getAttType(string varname, string attname) const;
125
128 virtual int getDimLensAtLevel(string varname, int level, std::vector<size_t> &dims_at_level, std::vector<size_t> &bs_at_level) const;
129 virtual int getDimLensAtLevel(string varname, int level, std::vector<size_t> &dims_at_level, std::vector<size_t> &bs_at_level, long ts) const;
130
131
134 virtual int openVariableRead(size_t ts, string varname, int, int) { return (DCP::openVariableRead(ts, varname)); }
135
136 virtual int openVariableRead(size_t ts, string varname);
137
138
141 virtual int closeVariable(int fd);
142
144 //
145 virtual int readRegion(int fd, const vector<size_t> &min, const vector<size_t> &max, float *region) { return (_readRegionTemplate(fd, min, max, region)); }
146 virtual int readRegion(int fd, const vector<size_t> &min, const vector<size_t> &max, double *region) { return (_readRegionTemplate(fd, min, max, region)); }
147 virtual int readRegion(int fd, const vector<size_t> &min, const vector<size_t> &max, int *region) { return (_readRegionTemplate(fd, min, max, region)); }
148
149
152 virtual bool variableExists(size_t ts, string varname, int reflevel = 0, int lod = 0) const;
153
154private:
155 NetCDFCollection *_ncdfc;
156 VAPoR::UDUnits _udunits;
157
158 string _proj4String;
159 std::map<string, DC::Dimension> _dimsMap;
160 std::map<string, DC::CoordVar> _coordVarsMap;
161 std::map<string, DC::AuxVar> _auxVarsMap;
162 std::map<string, DC::Mesh> _meshMap;
163 std::map<string, DC::DataVar> _dataVarsMap;
164 std::map<string, string> _coordVarKeys;
165 std::map<string, string> _sanitizedToOriginalMap;
166
167 const string _nodeFaceVar = "cellsOnVertex";
168 const string _faceNodeVar = "verticesOnCell";
169 const string _fakeEmptyVar = "empty";
170 vector<string> _fakeVars = {_nodeFaceVar, _faceNodeVar};
171 int _fakeVarsFileCounterStart = 10000;
172 int _fakeVarsFileCounter = _fakeVarsFileCounterStart;
173 std::map<int, string> _fdMap;
174
175
176 string sanitizeVarName(const string &name);
177 string getOriginalVarName(const string &name) const;
178 bool isCoordVar(const string &var) const;
179 int getAxis(const string &var) const;
180 string getUnits(const string &var) const;
181 string getTimeCoordVar(const string &var) const;
182
183 template<class T> int _readRegionTemplate(int fd, const vector<size_t> &min, const vector<size_t> &max, T *region);
184
185 template<class T> bool _getAttTemplate(string varname, string attname, T &values) const;
186};
187}; // namespace VAPoR
188
189#endif
Definition: DCP.h:27
virtual bool getBaseVarInfo(string varname, DC::BaseVar &var) const
virtual std::vector< string > getAttNames(string varname) const
virtual int readRegion(int fd, const vector< size_t > &min, const vector< size_t > &max, double *region)
Definition: DCP.h:146
virtual ~DCP()
virtual int initialize(const vector< string > &paths, const std::vector< string > &options)
virtual bool getMesh(string mesh_name, DC::Mesh &mesh) const
virtual std::vector< string > getDimensionNames() const
virtual std::vector< string > getCoordVarNames() const
virtual bool getAtt(string varname, string attname, vector< double > &values) const
virtual int openVariableRead(size_t ts, string varname)
virtual size_t getNumRefLevels(string varname) const
Definition: DCP.h:101
virtual bool getAtt(string varname, string attname, vector< long > &values) const
virtual bool getDataVarInfo(string varname, DC::DataVar &datavar) const
virtual string getMapProjection() const
Definition: DCP.h:105
virtual int getDimLensAtLevel(string varname, int level, std::vector< size_t > &dims_at_level, std::vector< size_t > &bs_at_level) const
virtual bool variableExists(size_t ts, string varname, int reflevel=0, int lod=0) const
virtual int getDimLensAtLevel(string varname, int level, std::vector< size_t > &dims_at_level, std::vector< size_t > &bs_at_level, long ts) const
virtual bool getDimension(string dimname, DC::Dimension &dimension, long ts) const
std::vector< string > getMeshNames() const
virtual int openVariableRead(size_t ts, string varname, int, int)
Definition: DCP.h:134
virtual bool getDimension(string dimname, DC::Dimension &dimension) const
virtual int readRegion(int fd, const vector< size_t > &min, const vector< size_t > &max, float *region)
Definition: DCP.h:145
virtual std::vector< string > getDataVarNames() const
virtual bool getCoordVarInfo(string varname, DC::CoordVar &cvar) const
virtual std::vector< string > getAuxVarNames() const
virtual XType getAttType(string varname, string attname) const
virtual bool getAuxVarInfo(string varname, DC::AuxVar &var) const
virtual bool getAtt(string varname, string attname, string &values) const
virtual int closeVariable(int fd)
virtual int readRegion(int fd, const vector< size_t > &min, const vector< size_t > &max, int *region)
Definition: DCP.h:147
Auxiliary variable metadata.
Definition: DC.h:1230
Base class for storing variable metadata.
Definition: DC.h:754
Coordinate variable metadata.
Definition: DC.h:881
Data variable metadata.
Definition: DC.h:987
Metadata describing a named dimension length.
Definition: DC.h:163
Metadata describing a computational mesh.
Definition: DC.h:310
A Template Method design pattern for reading a collection of data.
Definition: DC.h:150
XType
External storage types for primitive data.
Definition: DC.h:154
Wrapper for a collection of netCDF files.
#define VDF_API
Definition: common.h:73