Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/artifacts/model/WQ.java @ 8362:839032ac1523
Purge obsolete representation of reference system for discharge tables.
author | Tom Gottfried <tom@intevation.de> |
---|---|
date | Wed, 01 Oct 2014 15:54:47 +0200 |
parents | d3a4b0d5bcd8 |
children | 0a5239a1e46e |
comparison
equal
deleted
inserted
replaced
8361:c494f9a61490 | 8362:839032ac1523 |
---|---|
119 | 119 |
120 /** Returns either a modified copy or the same Object with fixed W values. | 120 /** Returns either a modified copy or the same Object with fixed W values. |
121 * If a conversion takes place converted is set to true | 121 * If a conversion takes place converted is set to true |
122 */ | 122 */ |
123 public static WQ getFixedWQforExportAtGauge(WQ wq, BigDecimal datum) { | 123 public static WQ getFixedWQforExportAtGauge(WQ wq, BigDecimal datum) { |
124 if (wq.getReferenceSystem() == W.CENTIMETER_AT_GAUGE) { | |
125 // Do nothing | |
126 return wq; | |
127 } | |
128 // If we convert we work on a copy to avoid side effects. | 124 // If we convert we work on a copy to avoid side effects. |
129 WQ ret = new WQ(wq.size(), wq.getName()); | 125 WQ ret = new WQ(wq.size(), wq.getName()); |
130 ret.setReferenceSystem(W.CENTIMETER_AT_GAUGE); | |
131 | 126 |
132 // When we convert and have a datum we have a calculated | |
133 // result at a gauge so we must subtract the datum. | |
134 double subtractDatum = datum == null ? 0 : datum.doubleValue(); | 127 double subtractDatum = datum == null ? 0 : datum.doubleValue(); |
135 double [] data = new double[8]; | 128 double [] data = new double[8]; |
136 for (int i = 0, WQ = wq.size(); i < WQ; i++) { | 129 for (int i = 0, WQ = wq.size(); i < WQ; i++) { |
137 wq.get(i, data); | 130 wq.get(i, data); |
138 ret.add((data[0] - subtractDatum)*100d, data[1]); | 131 ret.add((data[0] - subtractDatum)*100d, data[1]); |
139 } | 132 } |
140 log.debug("Converted W values to centimeter and substracted: " + subtractDatum); | |
141 return ret; | 133 return ret; |
142 } | 134 } |
143 } | 135 } |
144 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : | 136 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |