VAPoR  0.1
MetadataVDC.h
Go to the documentation of this file.
1 //
2 // $Id$
3 //
4 
5 
6 #ifndef _MetadataVDC_h_
7 #define _MetadataVDC_h_
8 
9 #include <stack>
10 #include <string>
11 #include <expat.h>
12 #include <vapor/MyBase.h>
13 #include <vapor/common.h>
14 #include <vapor/Metadata.h>
15 #include <vapor/XmlNode.h>
16 #include <vapor/ExpatParseMgr.h>
17 #ifdef WIN32
18 #pragma warning(disable : 4251)
19 #endif
20 
21 namespace VAPoR {
22 
23 //
24 // Macros to check for required MetadataVDC elements
25 // Call SetErrMsg if element is not present
26 //
27 #define CHK_TS_REQ(TS, RETVAL) \
28  if (! _rootnode->GetChild(TS)) { \
29  SetErrMsg("Invalid time step : %d", TS); \
30  return(RETVAL); \
31  }
32 #define CHK_VAR_REQ(TS, VAR, RETVAL) \
33  if (! _rootnode->GetChild(TS)) { \
34  SetErrMsg("Invalid time step : %d", TS); \
35  return(RETVAL); \
36  }; \
37  if (! _rootnode->GetChild(TS)->GetChild(VAR)) { \
38  SetErrMsg("Invalid variable name : %s", VAR.c_str()); \
39  return(RETVAL); \
40  }
41 
42 //
43 // Macros to check for optional MetadataVDC elements
44 // Don't call SetErrMsg if element is not present
45 //
46 #define CHK_TS_OPT(TS, RETVAL) \
47  if (! _rootnode->HasChild(TS)) { \
48  return(RETVAL); \
49  }
50 #define CHK_VAR_OPT(TS, VAR, RETVAL) \
51  if (! _rootnode->HasChild(TS)) { \
52  return(RETVAL); \
53  }; \
54  if (! _rootnode->GetChild(TS)->HasChild(VAR)) { \
55  return(RETVAL); \
56  }
57 
58 const int VDF_VERSION = 5;
59 
60 //
92 class VDF_API MetadataVDC : public Metadata,
93  public VetsUtil::MyBase, public ParsedXml {
94 public:
95 
112  //
113  MetadataVDC(
114  const size_t dim[3], size_t numTransforms, const size_t bs[3],
115  int nFilterCoef = 1, int nLiftingCoef = 1, int msbFirst = 1,
116  int vdfVersion = VDF_VERSION
117  );
118 
128  //
129  MetadataVDC(
130  const size_t dim[3], const size_t bs[3], const vector <size_t> &cratios,
131  string wname, string wmode
132  );
133 
139  //
140  MetadataVDC(const string &metafile);
141 
148  MetadataVDC(const MetadataVDC &node);
149 
150 
151  virtual ~MetadataVDC();
152 
192  //
193  int Merge(const MetadataVDC &metadata, size_t ts = 0);
194 
205  //
206  int Merge(const string &path, size_t ts = 0);
207 
219  //
220  int MakeCurrent() const {return(0); };
221 
227  //
228  const string &GetParentDir() const { return (_metafileDirName); }
229 
235  //
236  const string &GetMetafileName() const { return (_metafileName); }
237 
244  //
245  const string &GetDataDirName() const { return (_dataDirName); }
246 
247  int ConstructFullVBase(size_t ts, const string &var, string *path) const;
248  int ConstructFullAuxBase(size_t ts, string *path) const;
249 
255  //
256  int Write(const string &path, int relative_path = 1) ;
257 
258 
263  //
264  virtual const size_t *GetBlockSize() const { return(_bs); }
265 
272  //
273  virtual void GetBlockSize(size_t bs[3], int /*reflevel*/) const {
274  for (int i=0; i<3; i++) bs[i] = _bs[i];
275  }
276 
277  virtual void GetGridDim(size_t dim[3]) const {
278  for (int i=0; i<3; i++) dim[i] = _dim[i];
279  }
280 
287  const size_t *GetDimension() const { return(_dim); }
288 
293  //
294  int GetFilterCoef() const { return(_nFilterCoef); }
295 
300  //
301  int GetLiftingCoef() const { return(_nLiftingCoef); }
302 
307  //
308  virtual int GetNumTransforms() const { return(_numTransforms); }
309 
314  //
315  int GetMSBFirst() const { return(_msbFirst); }
316 
321  //
322  int GetVDFVersion() const { return(_vdfVersion); }
323 
328  //
329  string GetWaveName() const { return(_wname); }
330 
335  //
336  string GetBoundaryMode() const { return(_wmode); }
337 
342  //
343  virtual vector <size_t> GetCRatios() const { return(_cratios); }
344 
349  //
350  int GetVDCType() const { return(_vdcType); }
351 
352 
353 
354  //------------------------------------------------------------------
355  // Metdata Attributes
356  //
357  // The methods below get, set, and possibly test various metadata
358  // attributes.
359  //
360  //
361  //------------------------------------------------------------------
362 
363 
368  //
369  int SetGridType(const string &value);
370 
376  //
377  string GetGridType() const {
378  return(_rootnode->GetElementString(_gridTypeTag));
379  };
380 
385  int IsValidGridType(const string &value) const {
386  return(
387  (VetsUtil::StrCmpNoCase(value,"regular") == 0) ||
388  (VetsUtil::StrCmpNoCase(value,"stretched") == 0) ||
389  (VetsUtil::StrCmpNoCase(value,"layered") == 0) ||
390  (VetsUtil::StrCmpNoCase(value,"block_amr") == 0)
391  );
392  }
393 
398  //
399  int SetCoordSystemType(const string &value);
400 
405  //
406  string GetCoordSystemType() const {
407  return(_rootnode->GetElementString(_coordSystemTypeTag));
408  };
409 
413  //
414  int IsValidCoordSystemType(const string &value) const {
415  return(
416  (VetsUtil::StrCmpNoCase(value,"cartesian") == 0) ||
417  (VetsUtil::StrCmpNoCase(value,"spherical") == 0)
418  );
419  }
420 
429  //
430  int SetExtents(const vector<double> &value);
431 
434  //
435  vector<double> GetExtents(size_t ts = 0) const;
436 
440  //
441  int IsValidExtents(const vector<double> &value) const;
442 
447  //
448  int SetNumTimeSteps(long value);
449 
455  //
456  long GetNumTimeSteps() const;
457 
461  //
462  int IsValidTimeStep(long value) const {
463  return(value >= 0);
464  };
465 
473  //
474  int SetVariableNames(const vector <string> &value) {
475  return (SetVariables3D(value));
476  }
477 
478 
489  //
490  int SetVariables3D(const vector <string> &value);
491 
497  //
498  vector <string> GetVariables3D() const {
499  vector <string> svec;
500  _rootnode->GetElementStringVec(_vars3DTag, svec);
501  return(svec);
502  };
503 
505  //
506  vector <string> GetCoordinateVariables() const {
507  vector <string> svec;
508  _rootnode->GetElementStringVec(_coordVarsTag, svec);
509  return(svec);
510  }
511 
521  //
522  int SetCoordinateVariables(const vector <string> &value);
523 
532  //
533  int SetVariables2DXY(const vector <string> &value);
534  int SetVariables2DXZ(const vector <string> &value);
535  int SetVariables2DYZ(const vector <string> &value);
536 
542  //
543  vector <string> GetVariables2DXY() const {
544  vector <string> svec;
545  _rootnode->GetElementStringVec(_vars2DXYTag, svec);
546  return(svec);
547  };
548  vector <string> GetVariables2DXZ() const {
549  vector <string> svec;
550  _rootnode->GetElementStringVec(_vars2DXZTag, svec);
551  return(svec);
552  };
553  vector <string> GetVariables2DYZ() const {
554  vector <string> svec;
555  _rootnode->GetElementStringVec(_vars2DYZTag, svec);
556  return(svec);
557  };
558 
559 
565  //
566  int SetComment(const string &value) {
567  _rootnode->SetElementString(_commentTag, value);
568  return(0);
569  }
570 
577  //
578  string GetComment() const {
579  return(_rootnode->GetElementString(_commentTag));
580  };
581 
588  //
589  int SetPeriodicBoundary(const vector<long> &value) {
590  _rootnode->SetElementLong(_periodicBoundaryTag, value);
591  return(0);
592  }
593 
600  //
601  vector<long> GetPeriodicBoundary() const {
602  return(_rootnode->GetElementLong(_periodicBoundaryTag));
603  };
604 
616  //
617  int SetGridPermutation(const vector<long> &value) {
618  _rootnode->SetElementLong(_gridPermutationTag, value);
619  return(0);
620  }
621 
622 
629  int SetMissingValue(double value) {
630  vector <double> valvec; valvec.push_back(value);
631  _rootnode->SetElementDouble(_missingValueTag, valvec);
632  return(0);
633  }
634 
641  _rootnode->SetElementDouble(_missingValueTag, _emptyDoubleVec);
642  return(0);
643  }
644 
650  //
651  vector<double> GetMissingValue() const {
652  return _rootnode->GetElementDouble(_missingValueTag);
653  }
654 
661  //
662  vector<long> GetGridPermutation() const {
663  return(_rootnode->GetElementLong(_gridPermutationTag));
664  };
665 
684  //
685  int SetMapProjection(const string &value) {
686  _rootnode->SetElementString(_mapProjectionTag, value);
687  return(0);
688  }
689 
698  //
699  virtual string GetMapProjection() const;
700 
707  //
708  int SetTSUserTime(size_t ts, const vector<double> &value);
709 
710 
719  //
720  double GetTSUserTime(size_t ts) const {
721  CHK_TS_OPT(ts, 0.0)
722  if (_rootnode->GetChild(ts)->GetElementDouble(_userTimeTag).size())
723  return(_rootnode->GetChild(ts)->GetElementDouble(_userTimeTag)[0]);
724  else
725  return(ts);
726  };
727 
728  int SetTSUserTimeStamp(size_t ts, const string &s);
729 
730  void GetTSUserTimeStamp(size_t ts, string &s) const {
731  if (! _rootnode->GetChild(ts)) {s.clear(); return;}
732  s = _rootnode->GetChild(ts)->GetElementString(_userTimeStampTag);
733  };
734 
735 
736 
746  //
747  string GetTSAuxBasePath(size_t ts) const {
748  CHK_TS_REQ(ts, _emptyString)
749  return(_rootnode->GetChild(ts)->GetElementString(_auxBasePathTag));
750  };
751 
761  //
762  int HasTSUserTime(size_t ts) const {
763  if (! _rootnode->HasChild(ts)) return(0);
764  return(_rootnode->GetChild(ts)->HasElementDouble(_userTimeTag));
765  };
766 
770  //
771  int IsValidUserTime(const vector<double> &value) const {
772  return(value.size() == 1);
773  };
774 
792  //
793  int SetTSXCoords(size_t ts, const vector<double> &value);
794 
804  //
805  vector<double> GetTSXCoords(size_t ts) const {
806  CHK_TS_OPT(ts, _emptyDoubleVec)
807  return(_rootnode->GetChild(ts)->GetElementDouble(_xCoordsTag));
808  };
809 
810  int SetTSYCoords(size_t ts, const vector<double> &value);
811 
812  vector<double> GetTSYCoords(size_t ts) const {
813  CHK_TS_OPT(ts, _emptyDoubleVec)
814  return(_rootnode->GetChild(ts)->GetElementDouble(_yCoordsTag));
815  }
816 
817  int SetTSZCoords(size_t ts, const vector<double> &value);
818 
819  vector<double> GetTSZCoords(size_t ts) const {
820  CHK_TS_OPT(ts, _emptyDoubleVec)
821  return(_rootnode->GetChild(ts)->GetElementDouble(_zCoordsTag));
822  }
823 
825  //
830  //
831  int SetTSComment(size_t ts, const string &value);
832 
834  //
841  //
842  string GetTSComment(size_t ts) const {
843  CHK_TS_OPT(ts, _emptyString)
844  return(_rootnode->GetChild(ts)->GetElementString(_commentTag));
845  }
846 
857  //
858  int SetTSExtents(size_t ts, const vector<double> &value);
859 
870  //
871  vector<double> GetTSExtents(size_t ts) const {return (GetExtents(ts)); }
872 
882  int SetTSMissingValue(size_t ts, double v);
883 
885  //
886  vector<double> GetTSMissingValue(size_t ts) const {
887  CHK_TS_OPT(ts, _emptyDoubleVec)
888  return(_rootnode->GetChild(ts)->GetElementDouble(_missingValueTag));
889  }
890 
898  //
899  int SetVComment(size_t ts, const string &var, const string &value);
900 
911  //
912  string GetVComment(size_t ts, const string &var) const {
913  CHK_VAR_OPT(ts, var, _emptyString)
914  return(_rootnode->GetChild(ts)->GetChild(var)->GetElementString(_commentTag));
915  }
916 
927  //
928  string GetVBasePath(size_t ts, const string &var) const;
929 
930 
931  int SetVBasePath(
932  size_t ts, const string &var, const string &value
933  );
934 
944  //
945  int SetVDataRange(size_t ts, const string &var, const vector<double> &value);
946 
957  //
958  vector<double> GetVDataRange(size_t ts, const string &var) const {
959  CHK_VAR_REQ(ts, var, _emptyDoubleVec)
960  return(_rootnode->GetChild(ts)->GetChild(var)->GetElementDouble(_dataRangeTag));
961  }
962 
963  int IsValidVDataRange(const vector<double> &value) const {
964  return(value.size() == 2);
965  }
966 
979  //
980  int SetVMissingValue(size_t ts, const string &var, double v);
981 
982  vector<double> GetVMissingValue(size_t ts, const string &var) const {
983  CHK_VAR_REQ(ts, var, _emptyDoubleVec)
984  return(_rootnode->GetChild(ts)->GetChild(var)->GetElementDouble(_missingValueTag));
985  }
986 
987  //------------------------------------------------------------------
988  // User-Defined Metdata Attributes
989  //
990  // The methods below provide a means for the user get and set user-defined
991  // attributes. The interpretation of these attributes is solely up
992  // to the user. Attributes may be set/get at three "levels"; at the
993  // top level, where they may represent global metadata; at the
994  // time step level, where the attribute is associated with a
995  // particular time step; and at the variable level, where the attribute
996  // is associated with a particular variable, *and* a particular
997  // time step.
998  //
999  // Overloaded get/set methods exist for attributes of type
1000  // vector<long>, vector<double>, and string. Addionally, for each
1001  // attribute type (long, string, or double) a method is provided for
1002  // retrieving the names of all attributes defined of that type.
1003  //
1004  // A user-defined attribute is defined whenever it is set via a Set*
1005  // method
1006  //
1007  // The valid range for the 'ts' parameters in the methods below is
1008  // [0..NumTS-1], where NumTS is the value returned by method
1009  // GetNumTimeSteps.
1010  //
1011  // Valid values for the 'var' parameter are those returned by
1012  // by the GetVariableNames() method.
1013  //
1014  //------------------------------------------------------------------
1015 
1016  //------------------------------------------------------------------
1017  // Top Level (Global) User-Defined Metdata Attributes
1018  //
1019  // The user-defined attribute access methods defined below set
1020  // and get top-level
1021  // metadata attributes - attributes that may apply to the entire
1022  // data set.
1023  //
1024  //------------------------------------------------------------------
1025 
1026 
1034  //
1035  vector<string> GetUserDataLongTags() const {return(_userDLTags);}
1036 
1046  //
1047  int SetUserDataLong(const string &tag, const vector<long> &value) {
1048  _RecordUserDataTags(_userDLTags, tag);
1049  _rootnode->SetElementLong(tag, value);
1050  return(0);
1051  }
1052 
1065  //
1066  vector<long> GetUserDataLong(const string &tag) const {
1067  return(_rootnode->GetElementLong(tag));
1068  }
1069 
1070  vector<string> GetUserDataDoubleTags() const {return(_userDDTags);}
1071 
1072  int SetUserDataDouble(const string &tag, const vector<double> &value) {
1073  _RecordUserDataTags(_userDDTags, tag);
1074  _rootnode->SetElementDouble(tag, value);
1075  return(0);
1076  }
1077  vector<double> GetUserDataDouble(const string &tag) const {
1078  return(_rootnode->GetElementDouble(tag));
1079  }
1080 
1081  vector<string> GetUserDataStringTags() const {return(_userDSTags);}
1082 
1083  int SetUserDataString(const string &tag, const string &value) {
1084  _RecordUserDataTags(_userDSTags, tag);
1085  _rootnode->SetElementString(tag, value);
1086  return(0);
1087  }
1088  string GetUserDataString(const string &tag) const {
1089  return(_rootnode->GetElementString(tag));
1090  }
1091 
1092  int SetUserDataStringVec(const string &tag, const vector <string> &value) {
1093  _RecordUserDataTags(_userDSTags, tag);
1094  _rootnode->SetElementStringVec(tag, value);
1095  return(0);
1096  }
1097  vector <string> GetUserDataStringVec(const string &tag) const {
1098  vector <string> vec;
1099  _rootnode->GetElementStringVec(tag, vec);
1100  return(vec);
1101  }
1102 
1103 
1104  //------------------------------------------------------------------
1105  // Time Step User-Defined Metdata Attributes
1106  //
1107  // The user-defined attribute access methods defined below set
1108  // and get time step
1109  // metadata attributes - attributes that may apply to a particular
1110  // time step
1111  //
1112  //
1113  //------------------------------------------------------------------
1114 
1123  //
1124  vector<string> GetTSUserDataLongTags() const {
1125  return(_timeStepUserDLTags);
1126  }
1127 
1137  //
1138  int SetTSUserDataLong(size_t ts, const string &tag, const vector<long> &value) {
1139  CHK_TS_REQ(ts, -1)
1140  _RecordUserDataTags(_timeStepUserDLTags, tag);
1141  _rootnode->GetChild(ts)->SetElementLong(tag, value);
1142  return(0);
1143  }
1144 
1158  //
1159  vector<long> GetTSUserDataLong( size_t ts, const string &tag) const {
1160  CHK_TS_OPT(ts, _emptyLongVec)
1161  return(_rootnode->GetChild(ts)->GetElementLong(tag));
1162  }
1163 
1165  size_t ts, const string &tag, const vector<double> &value
1166  ) {
1167  CHK_TS_REQ(ts, -1)
1168  _RecordUserDataTags(_timeStepUserDDTags, tag);
1169  _rootnode->GetChild(ts)->SetElementDouble(tag, value);
1170  return(0);
1171  }
1172 
1173  vector<double> GetTSUserDataDouble(size_t ts, const string &tag) const {
1174  CHK_TS_OPT(ts, _emptyDoubleVec)
1175  return(_rootnode->GetChild(ts)->GetElementDouble(tag));
1176  }
1177  vector<string> GetTSUserDataDoubleTags() const {
1178  return(_timeStepUserDDTags);
1179  }
1180 
1181 
1183  size_t ts, const string &tag, const string &value
1184  ) {
1185  CHK_TS_REQ(ts, -1)
1186  _RecordUserDataTags(_timeStepUserDSTags, tag);
1187  _rootnode->GetChild(ts)->SetElementString(tag, value);
1188  return(0);
1189  }
1190 
1191  string GetTSUserDataString(size_t ts, const string &tag) const {
1192  CHK_TS_OPT(ts, _emptyString)
1193  return(_rootnode->GetChild(ts)->GetElementString(tag));
1194  }
1195  vector<string> GetTSUserDataStringTags() const {
1196  return(_timeStepUserDSTags);
1197  }
1198 
1199  //------------------------------------------------------------------
1200  // Variable User-Defined Metdata Attributes
1201  //
1202  // The user-defined attribute access methods defined below set
1203  // and get variable
1204  // metadata attributes - attributes that may apply to a particular
1205  // variable within a given time step.
1206  // Attribute get/set methods exist for attributes of type
1207  // vector<long>, vector<double>, and string. Addionally, for each
1208  // attribute type (long, string, or double) a method is provided for
1209  // retrieving the names of all attributes defined of that type.
1210  //
1211  //------------------------------------------------------------------
1212 
1213  // Return a list of the names of user defined variable attributes
1214  // of type long.
1215  //
1223  //
1224  vector<string> GetVUserDataLongTags() const {
1225  return(_variableUserDLTags);
1226  }
1227 
1239  //
1241  size_t ts, const string &var, const string &tag, const vector<long> &value
1242  ) {
1243  CHK_VAR_REQ(ts, var, -1)
1244  _RecordUserDataTags(_variableUserDLTags, tag);
1245  _rootnode->GetChild(ts)->GetChild(var)->SetElementLong(tag, value);
1246  return(0);
1247  }
1248 
1263  //
1264  vector<long> GetVUserDataLong(
1265  size_t ts, const string &var, const string &tag
1266  ) const {
1267  CHK_VAR_OPT(ts, var, _emptyLongVec)
1268  return(_rootnode->GetChild(ts)->GetChild(var)->GetElementLong(tag));
1269  }
1270 
1271  vector<string> GetVUserDataDoubleTags() const {
1272  return(_variableUserDDTags);
1273  }
1275  size_t ts, const string &var, const string &tag, const vector<double> &value
1276  ) {
1277  CHK_VAR_REQ(ts, var, -1)
1278  _RecordUserDataTags(_variableUserDDTags, tag);
1279  _rootnode->GetChild(ts)->GetChild(var)->SetElementDouble(tag, value);
1280  return(0);
1281  }
1282 
1283  vector<double> GetVUserDataDouble(
1284  size_t ts, const string &var, const string &tag
1285  ) const {
1286  CHK_VAR_OPT(ts, var, _emptyDoubleVec)
1287  return(_rootnode->GetChild(ts)->GetChild(var)->GetElementDouble(tag));
1288  }
1289 
1291  size_t ts, const string &var, const string &tag, const string &value
1292  ) {
1293  CHK_VAR_REQ(ts,var,-1)
1294  _RecordUserDataTags(_variableUserDSTags, tag);
1295  _rootnode->GetChild(ts)->GetChild(var)->SetElementString(tag, value);
1296  return(0);
1297  }
1298 
1300  size_t ts, const string &var, const string &tag
1301  ) const {
1302  CHK_VAR_OPT(ts, var, _emptyString)
1303  return(_rootnode->GetChild(ts)->GetChild(var)->GetElementString(tag));
1304  }
1305 
1306  vector<string> GetVUserDataStringTags() const {
1307  return(_variableUserDSTags);
1308  }
1309 
1310 private:
1311  XmlNode *_rootnode; // root node of the xml tree
1312  size_t _bs[3]; // blocking factor to be used by data
1313  size_t _dim[3]; // data dimensions
1314  int _nFilterCoef; // Lifting filter coefficients
1315  int _nLiftingCoef;
1316  int _numTransforms; // Number of wavelet transforms
1317  int _msbFirst; // Most Significant Byte First storage order
1318  int _vdfVersion; // VDF file version number
1319  int _vdcType; // VDC file type (1 or 2)
1320  string _wname; // Wavelet name
1321  string _wmode; // Wavelet boundary handling mode
1322  string _metafileDirName; // path to metafile parent directory
1323  string _metafileName; // basename of path to metafile
1324  string _dataDirName; // basename of path to data directory
1325  vector <size_t> _cratios; // compression ratios
1326 
1327  vector <double> _emptyDoubleVec;
1328  vector <long> _emptyLongVec;
1329  string _emptyString;
1330 
1331 
1332  string _currentVar; // name of variable currently being processed
1333  long _currentTS; // Number of time step currently being processed
1334 
1335 
1336  // Known xml tags
1337  //
1338  static const string _childrenTag;
1339  static const string _commentTag;
1340  static const string _coordSystemTypeTag;
1341  static const string _dataRangeTag;
1342  static const string _extentsTag;
1343  static const string _gridTypeTag;
1344  static const string _numTimeStepsTag;
1345  static const string _basePathTag;
1346  static const string _auxBasePathTag;
1347  static const string _rootTag;
1348  static const string _userTimeTag;
1349  static const string _userTimeStampTag;
1350  static const string _timeStepTag;
1351  static const string _varNamesTag;
1352  static const string _vars3DTag;
1353  static const string _vars2DXYTag;
1354  static const string _vars2DXZTag;
1355  static const string _vars2DYZTag;
1356  static const string _coordVarsTag;
1357  static const string _xCoordsTag;
1358  static const string _yCoordsTag;
1359  static const string _zCoordsTag;
1360  static const string _periodicBoundaryTag;
1361  static const string _gridPermutationTag;
1362  static const string _mapProjectionTag;
1363  static const string _missingValueTag;
1364 
1365  // known xml attribute names
1366  //
1367  static const string _blockSizeAttr;
1368  static const string _dimensionLengthAttr;
1369  static const string _numTransformsAttr;
1370  static const string _filterCoefficientsAttr;
1371  static const string _liftingCoefficientsAttr;
1372  static const string _msbFirstAttr;
1373  static const string _vdfVersionAttr;
1374  static const string _numChildrenAttr;
1375  static const string _waveletNameAttr;
1376  static const string _waveletBoundaryModeAttr;
1377  static const string _vdcTypeAttr;
1378  static const string _cRatiosAttr;
1379 
1380 
1381  // Names of tags for user-defined data of type long, double, or string
1382  //
1383  vector <string> _userDLTags; // top-level long tags
1384  vector <string> _userDDTags;
1385  vector <string> _userDSTags;
1386 
1387  vector <string> _timeStepUserDLTags; // time step long tags
1388  vector <string> _timeStepUserDDTags;
1389  vector <string> _timeStepUserDSTags;
1390 
1391  vector <string> _variableUserDLTags; // variable long tags
1392  vector <string> _variableUserDDTags;
1393  vector <string> _variableUserDSTags;
1394 
1395  string _newMapProjection;
1396 
1397  int _init();
1398  int _init1(
1399  const size_t dim[3], size_t numTransforms, const size_t bs[3],
1400  int nFilterCoef = 1, int nLiftingCoef = 1, int msbFirst = 1,
1401  int vdfVersion = VDF_VERSION
1402  );
1403  int _init2(
1404  const size_t dim[3], const size_t bs[3], const vector <size_t> &cratios,
1405  string wname, string wmode, int vdfVersion = VDF_VERSION
1406  );
1407 
1408  int _SetNumTimeSteps(long value);
1409  int _setVariableTypes(
1410  const string &tag,
1411  const vector <string> &value,
1412  const vector <string> &delete_tags
1413  );
1414  int _SetVariables(XmlNode *node, long ts);
1415  int _SetVariableNames(
1416  string set_tag,
1417  const vector <string> &delete_tags,
1418  const vector <string> &value
1419  );
1420 
1421  int _RecordUserDataTags(vector <string> &keys, const string &tag);
1422 
1423 bool elementStartHandler(ExpatParseMgr*, int depth , std::string& tag, const char **attr);
1424 bool elementEndHandler(ExpatParseMgr*, int depth , std::string& );
1425 
1426  // XML Expat element handler helps. A different handler is defined
1427  // for each possible state (depth of XML tree) from 0 to 3
1428  //
1429  void _startElementHandler0(ExpatParseMgr*,const string &tag, const char **attrs);
1430  void _startElementHandler1(ExpatParseMgr*,const string &tag, const char **attrs);
1431  void _startElementHandler2(ExpatParseMgr*,const string &tag, const char **attrs);
1432  void _startElementHandler3(ExpatParseMgr*,const string &tag, const char **attrs);
1433  void _endElementHandler0(ExpatParseMgr*,const string &tag);
1434  void _endElementHandler1(ExpatParseMgr*,const string &tag);
1435  void _endElementHandler2(ExpatParseMgr*,const string &tag);
1436  void _endElementHandler3(ExpatParseMgr*,const string &tag);
1437  virtual int SetDefaults(); // Set some defaults
1438 
1439 
1440 };
1441 
1442 
1443 };
1444 
1445 #endif // _MetadataVDC_h_
const size_t * GetDimension() const
Definition: MetadataVDC.h:287
int SetUserDataString(const string &tag, const string &value)
Definition: MetadataVDC.h:1083
int SetUserDataStringVec(const string &tag, const vector< string > &value)
Definition: MetadataVDC.h:1092
virtual void GetGridDim(size_t dim[3]) const
Definition: MetadataVDC.h:277
An abstract class for managing metadata for a collection of gridded data. The data collection may sup...
Definition: Metadata.h:34
vector< long > GetTSUserDataLong(size_t ts, const string &tag) const
Definition: MetadataVDC.h:1159
string GetWaveName() const
Definition: MetadataVDC.h:329
string GetUserDataString(const string &tag) const
Definition: MetadataVDC.h:1088
vector< string > GetVariables2DYZ() const
Definition: MetadataVDC.h:553
const string & GetDataDirName() const
Definition: MetadataVDC.h:245
int SetVariableNames(const vector< string > &value)
Definition: MetadataVDC.h:474
void GetTSUserTimeStamp(size_t ts, string &s) const
Definition: MetadataVDC.h:730
vector< long > GetUserDataLong(const string &tag) const
Definition: MetadataVDC.h:1066
vector< long > GetPeriodicBoundary() const
Definition: MetadataVDC.h:601
string GetVComment(size_t ts, const string &var) const
Definition: MetadataVDC.h:912
string GetTSAuxBasePath(size_t ts) const
Definition: MetadataVDC.h:747
#define VDF_API
Definition: common.h:61
int SetTSUserDataLong(size_t ts, const string &tag, const vector< long > &value)
Definition: MetadataVDC.h:1138
vector< double > GetVUserDataDouble(size_t ts, const string &var, const string &tag) const
Definition: MetadataVDC.h:1283
#define CHK_TS_OPT(TS, RETVAL)
Definition: MetadataVDC.h:46
int IsValidUserTime(const vector< double > &value) const
Definition: MetadataVDC.h:771
vector< double > GetUserDataDouble(const string &tag) const
Definition: MetadataVDC.h:1077
vector< double > GetTSXCoords(size_t ts) const
Definition: MetadataVDC.h:805
int HasTSUserTime(size_t ts) const
Definition: MetadataVDC.h:762
virtual vector< size_t > GetCRatios() const
Definition: MetadataVDC.h:343
int GetMSBFirst() const
Definition: MetadataVDC.h:315
vector< string > GetTSUserDataStringTags() const
Definition: MetadataVDC.h:1195
int GetVDFVersion() const
Definition: MetadataVDC.h:322
const int VDF_VERSION
Definition: MetadataVDC.h:58
An Xml tree.
Definition: XmlNode.h:47
COMMON_API int StrCmpNoCase(const string &s, const string &t)
Case-insensitive string comparison.
string GetVUserDataString(size_t ts, const string &var, const string &tag) const
Definition: MetadataVDC.h:1299
int SetComment(const string &value)
Definition: MetadataVDC.h:566
int GetLiftingCoef() const
Definition: MetadataVDC.h:301
const string & GetMetafileName() const
Definition: MetadataVDC.h:236
int SetTSUserDataDouble(size_t ts, const string &tag, const vector< double > &value)
Definition: MetadataVDC.h:1164
string GetBoundaryMode() const
Definition: MetadataVDC.h:336
int IsValidGridType(const string &value) const
Definition: MetadataVDC.h:385
A class for managing data set metadata.
Definition: MetadataVDC.h:92
int GetVDCType() const
Definition: MetadataVDC.h:350
vector< string > GetTSUserDataDoubleTags() const
Definition: MetadataVDC.h:1177
int SetMissingValue(double value)
Definition: MetadataVDC.h:629
virtual int GetNumTransforms() const
Definition: MetadataVDC.h:308
virtual void GetBlockSize(size_t bs[3], int) const
Definition: MetadataVDC.h:273
virtual const size_t * GetBlockSize() const
Definition: MetadataVDC.h:264
vector< double > GetVMissingValue(size_t ts, const string &var) const
Definition: MetadataVDC.h:982
int SetVUserDataDouble(size_t ts, const string &var, const string &tag, const vector< double > &value)
Definition: MetadataVDC.h:1274
vector< string > GetUserDataStringVec(const string &tag) const
Definition: MetadataVDC.h:1097
int IsValidCoordSystemType(const string &value) const
Definition: MetadataVDC.h:414
int IsValidVDataRange(const vector< double > &value) const
Definition: MetadataVDC.h:963
const string & GetParentDir() const
Definition: MetadataVDC.h:228
int SetVUserDataLong(size_t ts, const string &var, const string &tag, const vector< long > &value)
Definition: MetadataVDC.h:1240
int SetGridPermutation(const vector< long > &value)
Definition: MetadataVDC.h:617
int MakeCurrent() const
Definition: MetadataVDC.h:220
vector< double > GetTSZCoords(size_t ts) const
Definition: MetadataVDC.h:819
vector< string > GetTSUserDataLongTags() const
Definition: MetadataVDC.h:1124
vector< double > GetTSYCoords(size_t ts) const
Definition: MetadataVDC.h:812
VetsUtil base class.
Definition: MyBase.h:68
string GetCoordSystemType() const
Definition: MetadataVDC.h:406
vector< string > GetUserDataDoubleTags() const
Definition: MetadataVDC.h:1070
string GetTSComment(size_t ts) const
Return the comment for the indicated time step, ts, if it exists.
Definition: MetadataVDC.h:842
double GetTSUserTime(size_t ts) const
Definition: MetadataVDC.h:720
#define CHK_TS_REQ(TS, RETVAL)
Definition: MetadataVDC.h:27
vector< string > GetCoordinateVariables() const
Definition: MetadataVDC.h:506
#define CHK_VAR_REQ(TS, VAR, RETVAL)
Definition: MetadataVDC.h:32
string GetComment() const
Definition: MetadataVDC.h:578
vector< string > GetVUserDataStringTags() const
Definition: MetadataVDC.h:1306
vector< double > GetVDataRange(size_t ts, const string &var) const
Definition: MetadataVDC.h:958
vector< double > GetMissingValue() const
Definition: MetadataVDC.h:651
int IsValidTimeStep(long value) const
Definition: MetadataVDC.h:462
string GetTSUserDataString(size_t ts, const string &tag) const
Definition: MetadataVDC.h:1191
#define CHK_VAR_OPT(TS, VAR, RETVAL)
Definition: MetadataVDC.h:50
int GetFilterCoef() const
Definition: MetadataVDC.h:294
vector< string > GetVariables2DXY() const
Definition: MetadataVDC.h:543
int SetVUserDataString(size_t ts, const string &var, const string &tag, const string &value)
Definition: MetadataVDC.h:1290
vector< string > GetUserDataLongTags() const
Definition: MetadataVDC.h:1035
int SetTSUserDataString(size_t ts, const string &tag, const string &value)
Definition: MetadataVDC.h:1182
vector< string > GetVUserDataLongTags() const
Definition: MetadataVDC.h:1224
int SetUserDataLong(const string &tag, const vector< long > &value)
Definition: MetadataVDC.h:1047
vector< string > GetVariables3D() const
Definition: MetadataVDC.h:498
string GetGridType() const
Definition: MetadataVDC.h:377
vector< long > GetVUserDataLong(size_t ts, const string &var, const string &tag) const
Definition: MetadataVDC.h:1264
int SetPeriodicBoundary(const vector< long > &value)
Definition: MetadataVDC.h:589
vector< string > GetVUserDataDoubleTags() const
Definition: MetadataVDC.h:1271
vector< string > GetVariables2DXZ() const
Definition: MetadataVDC.h:548
int SetMapProjection(const string &value)
Definition: MetadataVDC.h:685
vector< double > GetTSUserDataDouble(size_t ts, const string &tag) const
Definition: MetadataVDC.h:1173
vector< string > GetUserDataStringTags() const
Definition: MetadataVDC.h:1081
int SetUserDataDouble(const string &tag, const vector< double > &value)
Definition: MetadataVDC.h:1072
vector< double > GetTSMissingValue(size_t ts) const
Returns the time-varying missing value, if any.
Definition: MetadataVDC.h:886
vector< double > GetTSExtents(size_t ts) const
Definition: MetadataVDC.h:871
vector< long > GetGridPermutation() const
Definition: MetadataVDC.h:662