changeset 4139:947d79b9c675

Merged heads.
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Mon, 15 Oct 2012 16:09:12 +0200
parents 9be8d7942284 (current diff) 1d9c9a3493ea (diff)
children a9bafa5445f9 d7db9baa4e62
files
diffstat 3 files changed, 23 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Mon Oct 15 15:23:13 2012 +0200
+++ b/flys-artifacts/ChangeLog	Mon Oct 15 16:09:12 2012 +0200
@@ -1,3 +1,14 @@
+2012-10-15  Ingo Weinzierl <ingo@intevation.de>
+
+	flys/issue904
+
+	* src/main/java/de/intevation/flys/artifacts/model/DischargeTables.java:
+	  Defined two constants for converting discharge table values into [cm].
+
+	* src/main/java/de/intevation/flys/artifacts/model/Calculation6.java:
+	  Use the new constants for value conversion for master discharge table
+	  and historical discharge tables.
+
 2012-10-15  Ingo Weinzierl <ingo@intevation.de>
 
 	flys/issue548
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/Calculation6.java	Mon Oct 15 15:23:13 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/Calculation6.java	Mon Oct 15 16:09:12 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];
     }
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/DischargeTables.java	Mon Oct 15 15:23:13 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/DischargeTables.java	Mon Oct 15 16:09:12 2012 +0200
@@ -26,7 +26,11 @@
     /** Private logger. */
     private static Logger log = Logger.getLogger(DischargeTables.class);
 
-    public static final double DEFAULT_SCALE = 100.0;
+    /** Scale to convert discharge table values of master table into [cm] */
+    public static final double MASTER_SCALE = 100d;
+
+    /** Scale to convert discharge table values of historical tables into [cm] */
+    public static final double HISTORICAL_SCALE = 1d;
 
     public static final int MASTER = 0;
 
@@ -71,7 +75,7 @@
     }
 
     public double [][] getFirstTable() {
-        return getFirstTable(DEFAULT_SCALE);
+        return getFirstTable(MASTER_SCALE);
     }
 
     public double [][] getFirstTable(double scale) {
@@ -83,7 +87,7 @@
     }
 
     public Map<String, double [][]> getValues() {
-        return getValues(DEFAULT_SCALE);
+        return getValues(MASTER_SCALE);
     }
 
     public Map<String, double [][]> getValues(double scale) {

http://dive4elements.wald.intevation.org