[MOAB-dev] commit/MOAB: danwu: For NC reader and writer code, always use the term "coordinate variable" instead of "dimension variable".

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Mon May 19 15:53:03 CDT 2014


1 new commit in MOAB:

https://bitbucket.org/fathomteam/moab/commits/1a9b3301bcc3/
Changeset:   1a9b3301bcc3
Branch:      master
User:        danwu
Date:        2014-05-19 22:52:51
Summary:     For NC reader and writer code, always use the term "coordinate variable" instead of "dimension variable".

Affected #:  3 files

diff --git a/src/io/NCHelper.cpp b/src/io/NCHelper.cpp
index ccca80c..950d20c 100644
--- a/src/io/NCHelper.cpp
+++ b/src/io/NCHelper.cpp
@@ -262,7 +262,7 @@ ErrorCode NCHelper::create_conventional_tags(const std::vector<int>& tstep_nums)
     std::vector<int> varAttLen;
     if (mapIter->second.numAtts < 1) {
       if (dummyVarNames.find(mapIter->first) != dummyVarNames.end()) {
-        // This variable is a dummy dimension variable
+        // This variable is a dummy coordinate variable
         varAttVal = "DUMMY_VAR";
       }
       else {
@@ -394,12 +394,10 @@ ErrorCode NCHelper::read_variable_setup(std::vector<std::string>& var_names, std
       ReadNC::VarData vd = (*mit).second;
 
       // If read all variables at once, skip ignored ones
-      // Upon creation of dummy variables, tag values have already been set
-      if (ignoredVarNames.find(vd.varName) != ignoredVarNames.end() ||
-          dummyVarNames.find(vd.varName) != dummyVarNames.end())
+      if (ignoredVarNames.find(vd.varName) != ignoredVarNames.end())
          continue;
 
-      // Dimension variables were read before creating conventional tags
+      // Coordinate variables (include dummy ones) were read to the file set by default
       if (std::find(dimNames.begin(), dimNames.end(), vd.varName) != dimNames.end())
         continue;
 
@@ -416,7 +414,7 @@ ErrorCode NCHelper::read_variable_setup(std::vector<std::string>& var_names, std
       if (mit != varInfo.end()) {
         ReadNC::VarData vd = (*mit).second;
 
-        // Upon creation of dummy variables, tag values have already been set
+        // Upon creation of dummy coordinate variables, tag values have already been set
         if (dummyVarNames.find(vd.varName) != dummyVarNames.end())
            continue;
 
@@ -836,13 +834,13 @@ ErrorCode NCHelper::create_dummy_variables()
 
   // Hack: look at all dimensions, and see if we have one that does not appear in the list of varInfo names
   // Right now, candidates are from unstructured meshes, such as ncol (HOMME) and nCells (MPAS)
-  // For each of them, create a dummy variable with a sparse tag to store the dimension length
+  // For each of them, create a dummy coordinate variable with a sparse tag to store the dimension length
   for (unsigned int i = 0; i < dimNames.size(); i++) {
     // If there is a variable with this dimension name, skip
     if (varInfo.find(dimNames[i]) != varInfo.end())
       continue;
 
-    // Create a dummy variable
+    // Create a dummy coordinate variable
     int sizeTotalVar = varInfo.size();
     std::string var_name(dimNames[i]);
     ReadNC::VarData& data = varInfo[var_name];
@@ -855,13 +853,13 @@ ErrorCode NCHelper::create_dummy_variables()
     data.numAtts = 0;
     data.entLoc = ReadNC::ENTLOCSET;
     dummyVarNames.insert(dimNames[i]);
-    dbgOut.tprintf(2, "Dummy variable created for dimension %s\n", dimNames[i].c_str());
+    dbgOut.tprintf(2, "Dummy coordinate variable created for dimension %s\n", dimNames[i].c_str());
 
     // Create a corresponding sparse tag
     Tag tagh;
     ErrorCode rval = mbImpl->tag_get_handle(dimNames[i].c_str(), 0, MB_TYPE_INTEGER, tagh,
                                             MB_TAG_CREAT | MB_TAG_SPARSE | MB_TAG_VARLEN);
-    ERRORR(rval, "Failed to create tag for a dummy dimension variable.");
+    ERRORR(rval, "Failed to create tag for a dummy coordinate variable.");
 
     // Tag value is the dimension length
     const void* ptr = &dimLens[i];

diff --git a/src/io/WriteNC.cpp b/src/io/WriteNC.cpp
index 18ce891..b4680bf 100644
--- a/src/io/WriteNC.cpp
+++ b/src/io/WriteNC.cpp
@@ -399,7 +399,7 @@ ErrorCode WriteNC::process_conventional_tags(EntityHandle fileSet)
         variableDataStruct.numAtts = 0;
       }
       else if (attribString == "DUMMY_VAR") {
-        // This variable is a dummy dimension variable
+        // This variable is a dummy coordinate variable
         variableDataStruct.numAtts = 0;
         dummyVarNames.insert(variableDataStruct.varName);
       }

diff --git a/test/io/read_ucd_nc.cpp b/test/io/read_ucd_nc.cpp
index c9309c5..561d68a 100644
--- a/test/io/read_ucd_nc.cpp
+++ b/test/io/read_ucd_nc.cpp
@@ -24,7 +24,7 @@ void test_read_onevar();
 void test_read_onetimestep();
 void test_read_nomesh();
 void test_read_novars();
-void test_read_dim_vars(); // Test reading dimension variables
+void test_read_coord_vars(); // Test reading coordinate variables
 void test_gather_onevar(); // Test gather set with one variable
 void test_read_conn(); // Test reading connectivity file only
 
@@ -47,7 +47,7 @@ int main(int argc, char* argv[])
   result += RUN_TEST(test_read_onetimestep);
   result += RUN_TEST(test_read_nomesh);
   result += RUN_TEST(test_read_novars);
-  result += RUN_TEST(test_read_dim_vars);
+  result += RUN_TEST(test_read_coord_vars);
   result += RUN_TEST(test_gather_onevar);
   result += RUN_TEST(test_read_conn);
 
@@ -234,7 +234,7 @@ void test_read_novars()
   CHECK_ERR(rval);
 }
 
-void test_read_dim_vars()
+void test_read_coord_vars()
 {
   Core moab;
   Interface& mb = moab;
@@ -255,7 +255,7 @@ void test_read_dim_vars()
   Tag var_tag;
   const void* var_data;
 
-  // Check tag for regular dimension variable lev
+  // Check tag for regular coordinate variable lev
   tag_name = "lev";
   var_len = 0;
   rval = mb.tag_get_handle(tag_name.c_str(), var_len, MB_TYPE_OPAQUE, var_tag, MB_TAG_SPARSE | MB_TAG_VARLEN);
@@ -272,7 +272,7 @@ void test_read_dim_vars()
   CHECK_REAL_EQUAL(3.54463800000002, lev_val[0], eps);
   CHECK_REAL_EQUAL(992.556100000005, lev_val[25], eps);
 
-  // Check tag for dummy dimension variable ncol
+  // Check tag for dummy coordinate variable ncol
   tag_name = "ncol";
   var_len = 0;
   rval = mb.tag_get_handle(tag_name.c_str(), var_len, MB_TYPE_OPAQUE, var_tag, MB_TAG_SPARSE | MB_TAG_VARLEN);
@@ -296,7 +296,7 @@ void test_read_dim_vars()
   rval = mb.load_file(example, &file_set2, opts.c_str());
   CHECK_ERR(rval);
 
-  // Check tag for regular dimension variable lev
+  // Check tag for regular coordinate lev
   tag_name = "lev";
   var_len = 0;
   rval = mb.tag_get_handle(tag_name.c_str(), var_len, MB_TYPE_OPAQUE, var_tag, MB_TAG_SPARSE | MB_TAG_VARLEN);
@@ -312,7 +312,7 @@ void test_read_dim_vars()
   CHECK_REAL_EQUAL(3.54463800000002, lev_val[0], eps);
   CHECK_REAL_EQUAL(992.556100000005, lev_val[25], eps);
 
-  // Check tag for dummy dimension variable ncol
+  // Check tag for dummy coordinate variable ncol
   tag_name = "ncol";
   var_len = 0;
   rval = mb.tag_get_handle(tag_name.c_str(), var_len, MB_TYPE_OPAQUE, var_tag, MB_TAG_SPARSE | MB_TAG_VARLEN);

Repository URL: https://bitbucket.org/fathomteam/moab/

--

This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.


More information about the moab-dev mailing list