[MOAB-dev] r4911 - MOAB/trunk/src/io
xbxu at mcs.anl.gov
xbxu at mcs.anl.gov
Wed Jun 1 16:35:57 CDT 2011
Author: xbxu
Date: 2011-06-01 16:35:55 -0500 (Wed, 01 Jun 2011)
New Revision: 4911
Modified:
MOAB/trunk/src/io/ReadNC.cpp
MOAB/trunk/src/io/ReadNC.hpp
Log:
Addd function to create NC Climate Data conventional tags
Modified: MOAB/trunk/src/io/ReadNC.cpp
===================================================================
--- MOAB/trunk/src/io/ReadNC.cpp 2011-06-01 20:34:51 UTC (rev 4910)
+++ MOAB/trunk/src/io/ReadNC.cpp 2011-06-01 21:35:55 UTC (rev 4911)
@@ -170,6 +170,10 @@
}
#endif
+ // create nc conventional tags
+ rval = create_tags(tstep_nums);
+ ERRORR(rval, "Trouble creating nc conventional tags.");
+
return MB_SUCCESS;
}
@@ -617,7 +621,7 @@
{
std::ostringstream tag_name;
tag_name << var_data.varName;
- if (0 != tstep_num) tag_name << tstep_num;
+ tag_name << tstep_num;
ErrorCode rval = MB_SUCCESS;
tagh = 0;
switch (var_data.varDataType) {
@@ -1077,4 +1081,174 @@
return MB_FAILURE;
}
+ErrorCode ReadNC::create_tags(const std::vector<int>& tstep_nums)
+{
+ ErrorCode rval;
+ std::string tag_name;
+
+ // <__NUM_DIMS>
+ Tag numDimsTag = 0;
+ tag_name = "__NUM_DIMS";
+ int numDims = dimNames.size();
+ rval = mbImpl->tag_create(tag_name.c_str(), sizeof(int), MB_TAG_SPARSE, MB_TYPE_INTEGER, numDimsTag, &numDims);
+ ERRORR(rval, "Trouble creating __NUM_DIMS tag.");
+ if (MB_SUCCESS == rval) dbgOut.tprintf(2, "Tag created for variable %s\n", tag_name.c_str());
+
+ // <__NUM_VARS>
+ Tag numVarsTag = 0;
+ tag_name = "__NUM_VARS";
+ int numVars = varInfo.size();
+ rval = mbImpl->tag_create(tag_name.c_str(), sizeof(int), MB_TAG_SPARSE, MB_TYPE_INTEGER, numVarsTag, &numVars);
+ ERRORR(rval, "Trouble creating __NUM_VARS tag.");
+ if (MB_SUCCESS == rval) dbgOut.tprintf(2, "Tag created for variable %s\n", tag_name.c_str());
+
+ // <__DIM_NAMES>
+ Tag dimNamesTag = 0;
More information about the moab-dev
mailing list