# HG changeset patch # User Sascha L. Teichmann # Date 1306834519 0 # Node ID 433f67a076aa7f443a0a5ce106b08bff0483159a # Parent 02c0cce0e469fce763cc7c0e56e16847c7c41e69 Use an explicit reference km for interpolation now. flys-artifacts/trunk@2029 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r 02c0cce0e469 -r 433f67a076aa flys-artifacts/ChangeLog --- 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 + + * 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 * doc/conf/cache.xml: Introduced cache to store the distance info per river. diff -r 02c0cce0e469 -r 433f67a076aa flys-artifacts/src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java --- 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) { diff -r 02c0cce0e469 -r 433f67a076aa flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/WstValueTable.java --- 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]);