Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/FixCalculation.java @ 2783:cbb513a8f548
FixA: km indexed datastructure for delta w/t results.
flys-artifacts/trunk@4522 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Fri, 25 May 2012 13:49:27 +0000 |
parents | c1f2e792704a |
children | f9e62e76ee1f |
comparison
equal
deleted
inserted
replaced
2782:7c2b24fb0316 | 2783:cbb513a8f548 |
---|---|
221 addProblem("fix.invalid.values"); | 221 addProblem("fix.invalid.values"); |
222 results.removeNaNs(); | 222 results.removeNaNs(); |
223 } | 223 } |
224 | 224 |
225 // Calculate Delta W/t | 225 // Calculate Delta W/t |
226 List<DeltaWT> deltaWTs = calculateDeltaWTs( | 226 DeltaWTsKM deltaWTsKM = calculateDeltaWTs( |
227 func, | 227 func, |
228 overview, | 228 overview, |
229 results); | 229 results); |
230 | 230 |
231 // TODO: Add km indexed structure for deltaWTs | 231 return new CalculationResult(deltaWTsKM, this); |
232 | 232 } |
233 return new CalculationResult(deltaWTs, this); | 233 |
234 } | 234 public DeltaWTsKM calculateDeltaWTs( |
235 | |
236 public List<DeltaWT> calculateDeltaWTs( | |
237 Function function, | 235 Function function, |
238 FixingsOverview overview, | 236 FixingsOverview overview, |
239 Parameters results | 237 Parameters results |
240 ) { | 238 ) { |
241 List<DeltaWT> deltaWTs = new ArrayList<DeltaWT>(); | 239 DeltaWTsKM deltaWTsKM = new DeltaWTsKM(results.size()); |
242 | 240 |
243 Column [][] analysisColumns = getAnalysisColumns(overview); | 241 Column [][] analysisColumns = getAnalysisColumns(overview); |
244 | 242 |
245 int [] parameterIndices = | 243 int [] parameterIndices = |
246 results.columnIndices(function.getParameterNames()); | 244 results.columnIndices(function.getParameterNames()); |
251 double [] ow = new double[1]; | 249 double [] ow = new double[1]; |
252 | 250 |
253 for (int i = 0, N = results.size(); i < N; ++i) { | 251 for (int i = 0, N = results.size(); i < N; ++i) { |
254 double km = results.get(i, "km"); | 252 double km = results.get(i, "km"); |
255 results.get(i, parameterIndices, parameterValues); | 253 results.get(i, parameterIndices, parameterValues); |
254 | |
255 DeltaWTsKM.KM dwtkm = new DeltaWTsKM.KM(km); | |
256 deltaWTsKM.add(dwtkm); | |
256 | 257 |
257 // This is the paraterized function for a given km. | 258 // This is the paraterized function for a given km. |
258 de.intevation.flys.artifacts.math.Function instance = | 259 de.intevation.flys.artifacts.math.Function instance = |
259 function.instantiate(parameterValues); | 260 function.instantiate(parameterValues); |
260 | 261 |
289 DeltaWT deltaWT = new DeltaWT( | 290 DeltaWT deltaWT = new DeltaWT( |
290 deltaW, | 291 deltaW, |
291 pc.meta.getStartTime(), | 292 pc.meta.getStartTime(), |
292 pc.meta.getDescription()); | 293 pc.meta.getDescription()); |
293 | 294 |
294 deltaWTs.add(deltaWT); | 295 dwtkm.add(deltaWT); |
295 } | 296 } |
296 } | 297 } |
297 } | 298 } |
298 | 299 |
299 return deltaWTs; | 300 return deltaWTsKM; |
300 } | 301 } |
301 | 302 |
302 /** Helper class to bundle the meta information of a column | 303 /** Helper class to bundle the meta information of a column |
303 * and the real data. | 304 * and the real data. |
304 */ | 305 */ |