changeset 645:433f67a076aa

Use an explicit reference km for interpolation now. flys-artifacts/trunk@2029 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Tue, 31 May 2011 09:35:19 +0000 (2011-05-31)
parents 02c0cce0e469
children d299e220d89c
files flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/WstValueTable.java
diffstat 3 files changed, 15 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Mon May 30 11:34:06 2011 +0000
+++ b/flys-artifacts/ChangeLog	Tue May 31 09:35:19 2011 +0000
@@ -1,3 +1,9 @@
+2011-05-31	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java,
+	  src/main/java/de/intevation/flys/artifacts/model/WstValueTable.java:
+	  Use an explicit reference km for interpolation now.
+
 2011-05-30	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
 
 	* doc/conf/cache.xml: Introduced cache to store the distance info per river.
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java	Mon May 30 11:34:06 2011 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java	Tue May 31 09:35:19 2011 +0000
@@ -345,7 +345,7 @@
             double [] oqs = new double[kms.length];
             double [] ows = new double[kms.length];
             WstValueTable.QPosition qPosition =
-                wst.interpolate(qs[i], referenceIndex, kms, ows, oqs);
+                wst.interpolate(qs[i], kms[referenceIndex], kms, ows, oqs);
             if (qPosition != null) {
                 results.add(new WQKms(kms, oqs, ows));
             }
@@ -680,7 +680,7 @@
 
             QPosition qPosition = wst.interpolate(
                 iqsi[0],
-                referenceIndex,
+                boundKms[referenceIndex],
                 boundKms, boundWs, boundQs);
 
             if (qPosition == null) {
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/WstValueTable.java	Mon May 30 11:34:06 2011 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/WstValueTable.java	Tue May 31 09:35:19 2011 +0000
@@ -384,28 +384,26 @@
 
     public QPosition interpolate(
         double    q,
-        int       referenceIndex,
+        double    referenceKm,
         double [] kms,
         double [] ws,
         double [] qs
     ) {
-        Row kmKey = new Row(kms[referenceIndex]);
-
-        int rowIndex = Collections.binarySearch(rows, kmKey);
-
-        int R1 = rows.size()-1;
-
-        QPosition qPosition = getQPosition(kms[referenceIndex], q);
+        QPosition qPosition = getQPosition(referenceKm, q);
 
         if (qPosition == null) {
             // we cannot locate q at km
             return null;
         }
 
+        Row kmKey = new Row();
+
+        int R1 = rows.size()-1;
+
         for (int i = 0; i < kms.length; ++i) {
             kmKey.km = kms[i];
 
-            rowIndex = Collections.binarySearch(rows, kmKey);
+            int rowIndex = Collections.binarySearch(rows, kmKey);
 
             qs[i] = getQ(qPosition, kms[i]);
 

http://dive4elements.wald.intevation.org