diff flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/Calculation6.java @ 4138:1d9c9a3493ea

#904 Use the correct scale to convert discharge table values into [cm].
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Mon, 15 Oct 2012 16:05:20 +0200
parents b6ba9bbb5122
children b3aa91e45010
line wrap: on
line diff
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/Calculation6.java	Mon Oct 15 14:52:57 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/Calculation6.java	Mon Oct 15 16:05:20 2012 +0200
@@ -164,7 +164,7 @@
 
                 if (mode == MODE_W) {
                     w = value;
-                    q = findValueForW(dt, w);
+                    q = findValueForW(dt, w, DischargeTables.HISTORICAL_SCALE);
 
                     if (Double.isNaN(q)) {
                         logger.warn("Cannot find Q for W: " + w);
@@ -212,7 +212,7 @@
             double diff;
 
             if (refTable != null && mode == MODE_W) {
-                ref = findValueForW(refTable, value);
+                ref = findValueForW(refTable, value, DischargeTables.MASTER_SCALE);
             }
             else if (refTable != null) {
                 ref = findValueForQ(refTable, value);
@@ -230,7 +230,7 @@
 
                 if (mode == MODE_W) {
                     w    = value;
-                    q    = findValueForW(dt, w);
+                    q    = findValueForW(dt, w, DischargeTables.HISTORICAL_SCALE);
 
                     if (Double.isNaN(q)) {
                         logger.warn("Cannot find Q for W: " + w);
@@ -281,8 +281,8 @@
     }
 
 
-    protected double findValueForW(DischargeTable dt, double w) {
-        double[][] vs = DischargeTables.loadDischargeTableValues(dt, SCALE);
+    protected double findValueForW(DischargeTable dt, double w, double scale) {
+        double[][] vs = DischargeTables.loadDischargeTableValues(dt, scale);
         double [] qs = DischargeTables.getQsForW(vs, w);
         return qs.length == 0 ? Double.NaN : qs[0];
     }

http://dive4elements.wald.intevation.org