Mercurial > dive4elements > river
diff artifacts/src/main/java/org/dive4elements/river/artifacts/model/DischargeTables.java @ 6301:20a32dbdbb59
Remove discharge table scaling but add reference system to W
- Discharge_Tables are now always W[cm] Q[m³] no need for
special case handling depending on historical / master tables
- W now has a referenceSystem value that can be CENTIMETER_AT_GAUGE or
METER_OVER_REFPOINT. The default is METER_OVER_REFPOINT as this is
the case for everything except the objects created from discharge tables
Known issue: WINFO input validation is currently broken as it still scales
the user input.
author | Andre Heinecke <aheinecke@intevation.de> |
---|---|
date | Wed, 12 Jun 2013 10:54:27 +0200 |
parents | af13ceeba52a |
children | e4606eae8ea5 |
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/DischargeTables.java Wed Jun 12 16:36:34 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/DischargeTables.java Wed Jun 12 10:54:27 2013 +0200 @@ -34,20 +34,12 @@ /** Private logger. */ private static Logger log = Logger.getLogger(DischargeTables.class); - /** 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; protected List<String> gaugeNames; protected String riverName; - protected double scale; - protected int kind; protected Map<String, double [][]> values; @@ -76,18 +68,13 @@ List<String> gaugeNames, int kind ) { - scale = Double.NaN; this.kind = kind; this.riverName = riverName; this.gaugeNames = gaugeNames; } public double [][] getFirstTable() { - return getFirstTable(MASTER_SCALE); - } - - public double [][] getFirstTable(double scale) { - Map<String, double [][]> values = getValues(scale); + Map<String, double [][]> values = getValues(); for (double [][] table: values.values()) { return table; } @@ -95,13 +82,8 @@ } public Map<String, double [][]> getValues() { - return getValues(MASTER_SCALE); - } - - public Map<String, double [][]> getValues(double scale) { - if (values == null || scale != this.scale) { - values = loadValues(scale); - this.scale = scale; + if (values == null) { + values = loadValues(); } return values; } @@ -109,7 +91,7 @@ /** * Returns mapping of gauge name to values. */ - protected Map<String, double [][]> loadValues(double scale) { + protected Map<String, double [][]> loadValues() { Map<String, double [][]> values = new HashMap<String, double [][]>(); Session session = SessionHolder.HOLDER.get(); @@ -147,7 +129,7 @@ if (table == null) { table = tables.get(0); } - double [][] vs = loadDischargeTableValues(table, scale); + double [][] vs = loadDischargeTableValues(table); values.put(gaugeName, vs); } @@ -158,14 +140,10 @@ /** * @param table The discharge table - * @param scale The scale factor to adjust W and Q values. * * @return the values of a discharge table. */ - public static double[][] loadDischargeTableValues( - DischargeTable table, - double scale - ) { + public static double[][] loadDischargeTableValues(DischargeTable table) { List<DischargeTableValue> dtvs = table.getDischargeTableValues(); final double [][] vs = new double[2][dtvs.size()]; @@ -173,8 +151,8 @@ int idx = 0; for (DischargeTableValue dtv: dtvs) { double q = dtv.getQ().doubleValue(); - vs[0][idx] = q * scale; - vs[1][idx] = dtv.getW().doubleValue() * scale; + vs[0][idx] = q; + vs[1][idx] = dtv.getW().doubleValue(); ++idx; }