VAPoR  0.1
DCReaderNCDF.h
Go to the documentation of this file.
1 //
2 // $Id$
3 //
4 
5 
6 #ifndef _DCReaderNCDF_h_
7 #define _DCReaderNCDF_h_
8 
9 #include <vector>
10 #include <vapor/NetCDFCollection.h>
11 #include <vapor/DCReader.h>
12 #ifdef WIN32
13 #pragma warning(disable : 4251)
14 #endif
15 
16 namespace VAPoR {
17 
18 //
27 class VDF_API DCReaderNCDF : public DCReader {
28 public:
29 
31  const std::vector <string> &files,
32  const std::vector <string> &time_dimnames,
33  const std::vector <string> &time_coordvars,
34  const std::vector <string> &staggerd_dims,
35  string missing_attr, size_t dims[3]
36 );
37 
38  virtual ~DCReaderNCDF();
39 
40  virtual void GetGridDim(size_t dim[3]) const;
41 
42  virtual void GetBlockSize(size_t bs[3], int reflevel) const;
43 
44  virtual string GetCoordSystemType() const;
45 
46  virtual string GetGridType() const;
47 
48  virtual std::vector <double> GetExtents(size_t ts = 0) const;
49 
50  long GetNumTimeSteps() const {
51  return (_ncdfC->GetNumTimeSteps());
52  }
53 
54  virtual std::vector <string> GetVariables3D() const {
55  return(_vars3d);
56  };
57 
58  virtual std::vector <string> GetVariables2DXY() const {
59  return(_vars2dXY);
60  };
61 
62  virtual std::vector <string> GetVariables2DXZ() const {
63  return(_vars2dXZ);
64  };
65 
66  virtual std::vector <string> GetVariables2DYZ() const {
67  return(_vars2dYZ);
68  };
69 
70  virtual std::vector <string> GetVariables3DExcluded() const {
71  return(_vars3dExcluded);
72  };
73 
74  virtual std::vector <string> GetVariables2DExcluded() const {
75  return(_vars2dExcluded);
76  };
77 
78 
79  virtual std::vector <string> GetCoordinateVariables() const;
80 
81  virtual std::vector<long> GetPeriodicBoundary() const;
82 
83  virtual std::vector<long> GetGridPermutation() const;
84 
85  virtual double GetTSUserTime(size_t ts) const;
86 
87  virtual void GetTSUserTimeStamp(size_t ts, string &s) const;
88 
89  virtual bool GetMissingValue(string varname, float &value) const;
90 
91  virtual bool IsCoordinateVariable(string varname) const;
92 
93  virtual int OpenVariableRead(
94  size_t timestep, string varname, int reflevel=0, int lod=0
95  );
96 
97  virtual int CloseVariable();
98 
99  virtual int ReadSlice(float *slice);
100 
101  NetCDFCollection *GetNetCDFCollection() const {return (_ncdfC); };
102 
103  virtual bool VariableExists(size_t ts, string varname, int i0=0, int i1=0) const {
104  return(_ncdfC->VariableExists(ts, varname));
105  }
106 
107  virtual void GetLatLonExtents(
108  size_t ts, double lon_exts[2], double lat_exts[2]
109  ) const {
110  lon_exts[0] = lon_exts[1] = lat_exts[0] = lat_exts[1] = 0.0;
111  }
112 
113 
114 private:
115  std::vector <size_t> _dims;
116  std::vector <string> _vars3d;
117  std::vector <string> _vars3dExcluded;
118  std::vector <string> _vars2dXY;
119  std::vector <string> _vars2dXZ;
120  std::vector <string> _vars2dYZ;
121  std::vector <string> _vars2dExcluded;
122  int _ovr_fd;
123 
124  NetCDFCollection *_ncdfC;
125 
126  //
127  // Get dimensions for variable, varname, flipping the order to be consistent
128  // with the VDC library
129  //
130  vector <size_t> _GetSpatialDims(string varname) const;
131 
132 
133 
134 
135 };
136 };
137 
138 #endif // _DCReaderNCDF_h_
virtual std::vector< string > GetVariables2DYZ() const
Definition: DCReaderNCDF.h:66
virtual bool VariableExists(size_t ts, string varname, int i0=0, int i1=0) const
Definition: DCReaderNCDF.h:103
#define VDF_API
Definition: common.h:61
virtual std::vector< string > GetVariables2DExcluded() const
Definition: DCReaderNCDF.h:74
NetCDFCollection * GetNetCDFCollection() const
Definition: DCReaderNCDF.h:101
virtual std::vector< string > GetVariables3DExcluded() const
Definition: DCReaderNCDF.h:70
virtual std::vector< string > GetVariables2DXY() const
Definition: DCReaderNCDF.h:58
virtual void GetLatLonExtents(size_t ts, double lon_exts[2], double lat_exts[2]) const
Definition: DCReaderNCDF.h:107
long GetNumTimeSteps() const
Definition: DCReaderNCDF.h:50
virtual std::vector< string > GetVariables3D() const
Definition: DCReaderNCDF.h:54
virtual std::vector< string > GetVariables2DXZ() const
Definition: DCReaderNCDF.h:62
Wrapper for a collection of netCDF files.