Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/artifacts/model/Calculation6.java @ 8462:1127dbe95083
Remove obsolete historical discharge curve implementations.
author | Tom Gottfried <tom@intevation.de> |
---|---|
date | Thu, 30 Oct 2014 15:03:55 +0100 |
parents | 011e2290e801 |
children | 5e38e2924c07 |
comparison
equal
deleted
inserted
replaced
8461:2b4191f78ea6 | 8462:1127dbe95083 |
---|---|
125 } | 125 } |
126 | 126 |
127 ValuesCache vc = new ValuesCache(); | 127 ValuesCache vc = new ValuesCache(); |
128 | 128 |
129 WQTimerange [] wqt = prepareData(refTable, dts, vc); | 129 WQTimerange [] wqt = prepareData(refTable, dts, vc); |
130 WQKms [] wqs = prepareWQData(dts, vc); | |
131 | 130 |
132 if (debug) { | 131 if (debug) { |
133 log.debug("Number of calculation results: " + wqt.length); | 132 log.debug("Number of calculation results: " + wqt.length); |
134 } | 133 } |
135 | 134 |
136 return new CalculationResult(new HistoricalDischargeData(wqt, wqs), | 135 return new CalculationResult(new HistoricalDischargeData(wqt), |
137 this); | 136 this); |
138 } | 137 } |
139 | 138 |
140 /** The youngest discharge table of the selected set is the reference */ | 139 /** The youngest discharge table of the selected set is the reference */ |
141 protected DischargeTable fetchReferenceTable(List<DischargeTable> dts) { | 140 protected DischargeTable fetchReferenceTable(List<DischargeTable> dts) { |
192 long dtStop = ti.getStopTime() != null | 191 long dtStop = ti.getStopTime() != null |
193 ? ti.getStopTime().getTime() | 192 ? ti.getStopTime().getTime() |
194 : System.currentTimeMillis(); | 193 : System.currentTimeMillis(); |
195 | 194 |
196 return !(timerange[1] < dtStart || timerange[0] > dtStop); | 195 return !(timerange[1] < dtStart || timerange[0] > dtStop); |
197 } | |
198 | |
199 protected WQKms[] prepareWQData(List<DischargeTable> dts, ValuesCache vc) { | |
200 WQKms[] wqs = new WQKms[dts.size()]; | |
201 | |
202 for (int i = 0, N = wqs.length; i < N; ++i) { | |
203 DischargeTable dt = dts.get(i); | |
204 wqs[i] = prepareWQ(dt, vc.getValues(dts.get(i))); | |
205 } | |
206 | |
207 return wqs; | |
208 } | |
209 | |
210 protected WQKms prepareWQ(DischargeTable dt, double[][] values) { | |
211 double datum = dt.getGauge().getDatum().doubleValue(); | |
212 double km = dt.getGauge().getStation().doubleValue(); | |
213 | |
214 double[] kms = new double[values[1].length]; | |
215 Arrays.fill(kms, km); | |
216 | |
217 for (int i = 0 ; i < values[1].length; i++) { | |
218 values[1][i] = values[1][i]/100d + datum; | |
219 } | |
220 | |
221 return new HistoricalWQKms(kms, values[0], values[1], | |
222 String.valueOf(km), dt.getTimeInterval()); | |
223 } | 196 } |
224 | 197 |
225 protected String name(double value) { | 198 protected String name(double value) { |
226 return mode == EvaluationMode.W.getMode() | 199 return mode == EvaluationMode.W.getMode() |
227 ? "W=" + value | 200 ? "W=" + value |