Mercurial > dive4elements > river
comparison 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 |
comparison
equal
deleted
inserted
replaced
4136:b6ba9bbb5122 | 4138:1d9c9a3493ea |
---|---|
162 double w; | 162 double w; |
163 double q; | 163 double q; |
164 | 164 |
165 if (mode == MODE_W) { | 165 if (mode == MODE_W) { |
166 w = value; | 166 w = value; |
167 q = findValueForW(dt, w); | 167 q = findValueForW(dt, w, DischargeTables.HISTORICAL_SCALE); |
168 | 168 |
169 if (Double.isNaN(q)) { | 169 if (Double.isNaN(q)) { |
170 logger.warn("Cannot find Q for W: " + w); | 170 logger.warn("Cannot find Q for W: " + w); |
171 addProblem("cannot.find.hist.q.for.w", w, ti[0], ti[1]); | 171 addProblem("cannot.find.hist.q.for.w", w, ti[0], ti[1]); |
172 continue; | 172 continue; |
210 | 210 |
211 double ref; | 211 double ref; |
212 double diff; | 212 double diff; |
213 | 213 |
214 if (refTable != null && mode == MODE_W) { | 214 if (refTable != null && mode == MODE_W) { |
215 ref = findValueForW(refTable, value); | 215 ref = findValueForW(refTable, value, DischargeTables.MASTER_SCALE); |
216 } | 216 } |
217 else if (refTable != null) { | 217 else if (refTable != null) { |
218 ref = findValueForQ(refTable, value); | 218 ref = findValueForQ(refTable, value); |
219 } | 219 } |
220 else { | 220 else { |
228 double w; | 228 double w; |
229 double q; | 229 double q; |
230 | 230 |
231 if (mode == MODE_W) { | 231 if (mode == MODE_W) { |
232 w = value; | 232 w = value; |
233 q = findValueForW(dt, w); | 233 q = findValueForW(dt, w, DischargeTables.HISTORICAL_SCALE); |
234 | 234 |
235 if (Double.isNaN(q)) { | 235 if (Double.isNaN(q)) { |
236 logger.warn("Cannot find Q for W: " + w); | 236 logger.warn("Cannot find Q for W: " + w); |
237 addProblem("cannot.find.hist.q.for.w", w, ti[0], ti[1]); | 237 addProblem("cannot.find.hist.q.for.w", w, ti[0], ti[1]); |
238 continue; | 238 continue; |
279 | 279 |
280 return new Date[] { start, end }; | 280 return new Date[] { start, end }; |
281 } | 281 } |
282 | 282 |
283 | 283 |
284 protected double findValueForW(DischargeTable dt, double w) { | 284 protected double findValueForW(DischargeTable dt, double w, double scale) { |
285 double[][] vs = DischargeTables.loadDischargeTableValues(dt, SCALE); | 285 double[][] vs = DischargeTables.loadDischargeTableValues(dt, scale); |
286 double [] qs = DischargeTables.getQsForW(vs, w); | 286 double [] qs = DischargeTables.getQsForW(vs, w); |
287 return qs.length == 0 ? Double.NaN : qs[0]; | 287 return qs.length == 0 ? Double.NaN : qs[0]; |
288 } | 288 } |
289 | 289 |
290 | 290 |