Mercurial > dive4elements > river
changeset 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 | 947d79b9c675 |
files | flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/Calculation6.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/DischargeTables.java |
diffstat | 3 files changed, 23 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog Mon Oct 15 14:52:57 2012 +0200 +++ b/flys-artifacts/ChangeLog Mon Oct 15 16:05:20 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 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]; }
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/DischargeTables.java Mon Oct 15 14:52:57 2012 +0200 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/DischargeTables.java Mon Oct 15 16:05:20 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) {