[MOAB-dev] commit/MOAB: danwu: In ScdNCHelper::read_scd_variable_to_nonset(), the values of ni and nj are incorrectly swapped. Fortunately, this have not caused any bugs so far, as we can verify or even prove that kji_to_jik(ni, nj, nk, ...) produces the same result as kji_to_jik(nj, ni, nk, ...). For code clarity and consistency, ni, nj and nk are set such that ni stands for lon (or slon), nj stands for lat (or slat) and nk stands for lev.

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Tue Nov 26 11:26:15 CST 2013


1 new commit in MOAB:

https://bitbucket.org/fathomteam/moab/commits/7ab7461255d7/
Changeset:   7ab7461255d7
Branch:      master
User:        danwu
Date:        2013-11-26 18:25:56
Summary:     In ScdNCHelper::read_scd_variable_to_nonset(), the values of ni and nj are incorrectly swapped. Fortunately, this have not caused any bugs so far, as we can verify or even prove that kji_to_jik(ni, nj, nk, ...) produces the same result as kji_to_jik(nj, ni, nk, ...). For code clarity and consistency, ni, nj and nk are set such that ni stands for lon (or slon), nj stands for lat (or slat) and nk stands for lev.

Affected #:  1 file

diff --git a/src/io/NCHelper.cpp b/src/io/NCHelper.cpp
index 0f8a7fa..61a209c 100644
--- a/src/io/NCHelper.cpp
+++ b/src/io/NCHelper.cpp
@@ -1170,9 +1170,11 @@ ErrorCode ScdNCHelper::read_scd_variable_to_nonset(std::vector<ReadNC::VarData>&
 
     for (unsigned int t = 0; t < tstep_nums.size(); t++) {
       void* data = vdatas[i].varDatas[t];
-      size_t ni = vdatas[i].readCounts[t][2];
-      size_t nj = vdatas[i].readCounts[t][3];
-      size_t nk = vdatas[i].readCounts[t][1];
+      // A typical variable: float T(time, lev, lat, lon)
+      // For tag values, need transpose kji to jik, i.e. (lev, lat, lon) to (lat, lon, lev)
+      size_t ni = vdatas[i].readCounts[t][3]; // lon or slon
+      size_t nj = vdatas[i].readCounts[t][2]; // lat or slat
+      size_t nk = vdatas[i].readCounts[t][1]; // lev
 
       switch (vdatas[i].varDataType) {
         case NC_BYTE:

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