[MOAB-dev] commit/MOAB: danwu: Most users will never ask to read the entire dataset into memory at once. If they do so, it is OK to skip some variables. But in general, allow users to specify any variable in the netcdf file to read.

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Thu Nov 21 14:20:08 CST 2013


1 new commit in MOAB:

https://bitbucket.org/fathomteam/moab/commits/2efbbb30e014/
Changeset:   2efbbb30e014
Branch:      master
User:        danwu
Date:        2013-11-21 21:19:57
Summary:     Most users will never ask to read the entire dataset into memory at once. If they do so, it is OK to skip some variables. But in general, allow users to specify any variable in the netcdf file to read.

Affected #:  1 file

diff --git a/src/io/NCHelper.cpp b/src/io/NCHelper.cpp
index 62e7383..bb6d689 100644
--- a/src/io/NCHelper.cpp
+++ b/src/io/NCHelper.cpp
@@ -310,13 +310,13 @@ ErrorCode NCHelper::read_variable_setup(std::vector<std::string>& var_names, std
   std::map<std::string, ReadNC::VarData>& varInfo = _readNC->varInfo;
   std::map<std::string, ReadNC::VarData>::iterator mit;
 
-  // If empty read them all
+  // If empty read them all (except ignored variables)
   if (var_names.empty()) {
     for (mit = varInfo.begin(); mit != varInfo.end(); ++mit) {
       ReadNC::VarData vd = (*mit).second;
 
-      // No need to read ignored variables. Upon creation of dummy variables,
-      // tag values have already been set
+      // 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())
          continue;
@@ -328,15 +328,14 @@ ErrorCode NCHelper::read_variable_setup(std::vector<std::string>& var_names, std
     }
   }
   else {
+    // Read specified variables (might include ignored ones)
     for (unsigned int i = 0; i < var_names.size(); i++) {
       mit = varInfo.find(var_names[i]);
       if (mit != varInfo.end()) {
         ReadNC::VarData vd = (*mit).second;
 
-        // No need to read ignored variables. Upon creation of dummy variables,
-        // tag values have already been set
-        if (ignoredVarNames.find(vd.varName) != ignoredVarNames.end() ||
-            dummyVarNames.find(vd.varName) != dummyVarNames.end())
+        // Upon creation of dummy variables, tag values have already been set
+        if (dummyVarNames.find(vd.varName) != dummyVarNames.end())
            continue;
 
         if (vd.entLoc == ReadNC::ENTLOCSET)

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