[cig-commits] r12934 - in cs/spatialdata-0.1/trunk: libsrc/spatialdb tests/libtests/spatialdb
brad at geodynamics.org
brad at geodynamics.org
Sun Sep 21 20:25:41 PDT 2008
Author: brad
Date: 2008-09-21 20:25:41 -0700 (Sun, 21 Sep 2008)
New Revision: 12934
Modified:
cs/spatialdata-0.1/trunk/libsrc/spatialdb/GocadVoxet.cc
cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSCECCVMH.cc
Log:
Added unit test for case when SCEC CVM-H voxet file contains 'no data value' for location.
Modified: cs/spatialdata-0.1/trunk/libsrc/spatialdb/GocadVoxet.cc
===================================================================
--- cs/spatialdata-0.1/trunk/libsrc/spatialdb/GocadVoxet.cc 2008-09-22 00:04:49 UTC (rev 12933)
+++ cs/spatialdata-0.1/trunk/libsrc/spatialdb/GocadVoxet.cc 2008-09-22 03:25:41 UTC (rev 12934)
@@ -148,6 +148,24 @@
int indexV = indexZ*numY*numX + indexY*numX + indexX;
*value = _data[indexV];
+#if 0
+ // If voxet value is "no data value"
+ if (fabs(1.0 - *value / _property.noDataValue) < 1.0e-6) {
+ // If near indexZ=0, retry with indexZ+1, otherwise if near
+ // indexZ=numZ, retry with indexZ-1.
+ const int dz = (indexZ < numZ/2) ? +1 : -1;
+ const int maxRetries = 32;
+ for (int iTry=0; iTry < maxRetries; ++iTry) {
+ const int indexZNew = indexZ + dz*iTry;
+ assert(indexZNew >= 0 && indexZNew < numZ);
+ indexV = indexZNew*numY*numX + indexY*numX + indexX;
+ *value = _data[indexV];
+ if (fabs(1.0 - *value / _property.noDataValue) > 1.0e-6)
+ break;
+ } // for
+ } // if
+#endif
+
return flag;
} // queryNearest
Modified: cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSCECCVMH.cc
===================================================================
--- cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSCECCVMH.cc 2008-09-22 00:04:49 UTC (rev 12933)
+++ cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSCECCVMH.cc 2008-09-22 03:25:41 UTC (rev 12934)
@@ -148,7 +148,7 @@
cs.datumVert("mean sea level");
cs.initialize();
- const int numLocs = 17;
+ const int numLocs = 18;
const int spaceDim = 3;
const double lonlatelev[] = {
-118.560000, 32.550000, -2450.00,
@@ -171,6 +171,7 @@
-117.989344, 34.034148, 5000.00, // above domain
-117.989344, 34.034148, -500000.0, // below domain
+ -117.682186, 34.357760, 1793.81,
};
const double tolerance = 1.0e-06;
@@ -208,12 +209,14 @@
-28512.111328, 93.515053, 0.0, -2860.919189, 6649.152832, 3496.384277, 3838.102107,
-28512.111328, 93.515053, 0.0, -2860.919189, 8159.479492, 3999.826497, 4751.5155415,
+ -34629.367188, 2266.779785, 2.0, 2001.1707764, 4491.211426, 2777.070475, 2664.4122143,
};
const int flags[] = {
0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0,
- 0, 0
+ 0, 0,
+ 0
};
db.queryVals(queryNames, querySize);
@@ -258,12 +261,14 @@
3494.035156, 2.0,
3496.384277, 0.0,
3999.826497, 0.0,
+ 2777.070475, 2.0,
};
const int flags[] = {
0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0,
- 0, 0
+ 0, 0,
+ 0
};
db.queryVals(queryNames, querySize);
@@ -310,12 +315,14 @@
3838.102107,
4751.5155415,
+ 2664.4122143,
};
const int flags[] = {
0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0,
- 0, 0
+ 0, 0,
+ 0
};
db.queryVals(queryNames, querySize);
@@ -353,7 +360,7 @@
cs.datumVert("mean sea level");
cs.initialize();
- const int numLocs = 17;
+ const int numLocs = 18;
const int spaceDim = 3;
const double lonlatelev[] = {
-118.560000, 32.550000, -2450.00,
@@ -376,6 +383,7 @@
-117.989344, 34.034148, 5000.00, // above domain
-117.989344, 34.034148, -500000.0, // below domain
+ -117.682186, 34.357760, 1793.81,
};
const double tolerance = 1.0e-06;
@@ -413,12 +421,14 @@
-28512.111328, 93.515053, 0.0, -2860.919189, 6649.152832, 3496.384277, 3838.102107,
-28512.111328, 93.515053, 0.0, -2860.919189, 8159.479492, 3999.826497, 4751.5155415,
+ -34629.367188, 2266.779785, 4.0, 2001.1707764, 3705.773438, 2515.257812, 2022.2184806,
};
const int flags[] = {
0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0,
- 0, 0
+ 0, 0,
+ 0
};
db.squash(true);
More information about the cig-commits
mailing list