Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java @ 2733:ac9a03ed32c1
More debugging of discharge-curve issue.
flys-artifacts/trunk@4466 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Tue, 22 May 2012 19:51:05 +0000 |
parents | f53173a8736b |
children | 832f7bd45f9e |
comparison
equal
deleted
inserted
replaced
2732:7311d0336600 | 2733:ac9a03ed32c1 |
---|---|
69 | 69 |
70 import org.w3c.dom.Document; | 70 import org.w3c.dom.Document; |
71 import org.w3c.dom.Element; | 71 import org.w3c.dom.Element; |
72 import org.w3c.dom.Node; | 72 import org.w3c.dom.Node; |
73 | 73 |
74 | |
74 /** | 75 /** |
75 * The default WINFO artifact. | 76 * The default WINFO artifact. |
76 * | 77 * |
77 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> | 78 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> |
78 */ | 79 */ |
469 double[] qs = (double[]) obj[1]; | 470 double[] qs = (double[]) obj[1]; |
470 | 471 |
471 Calculation3 calculation = new Calculation3(location, days, qs); | 472 Calculation3 calculation = new Calculation3(location, days, qs); |
472 | 473 |
473 return calculation.calculate(wst); | 474 return calculation.calculate(wst); |
474 } | |
475 | |
476 | |
477 /** | |
478 * Returns the data that is used to create discharge curves. | |
479 * | |
480 */ | |
481 public CalculationResult getDischargeCurveData() { | |
482 | |
483 River river = FLYSUtils.getRiver(this); | |
484 if (river == null) { | |
485 return error(new WQKms[0], "no.river.selected"); | |
486 } | |
487 | |
488 double [] distance = FLYSUtils.getKmRange(this); | |
489 | |
490 if (distance == null) { | |
491 return error(new WQKms[0], "no.range.found"); | |
492 } | |
493 | |
494 List<Gauge> gauges = river.determineGauges(distance[0], distance[1]); | |
495 | |
496 if (gauges.isEmpty()) { | |
497 return error(new WQKms[0], "no.gauge.selected"); | |
498 } | |
499 | |
500 String [] names = new String[gauges.size()]; | |
501 | |
502 for (int i = 0; i < names.length; ++i) { | |
503 names[i] = gauges.get(i).getName(); | |
504 } | |
505 | |
506 DischargeTables dt = new DischargeTables(river.getName(), names); | |
507 | |
508 Map<String, double [][]> map = dt.getValues(100d); | |
509 | |
510 ArrayList<WQKms> res = new ArrayList<WQKms>(); | |
511 | |
512 for (Gauge gauge: gauges) { | |
513 String name = gauge.getName(); | |
514 double [][] values = map.get(name); | |
515 if (values == null) { | |
516 continue; | |
517 } | |
518 double [] kms = new double[values[0].length]; | |
519 Arrays.fill(kms, gauge.getStation().doubleValue()); | |
520 res.add(new WQKms(kms, values[0], values[1], name)); | |
521 } | |
522 | |
523 return new CalculationResult( | |
524 res.toArray(new WQKms[res.size()]), | |
525 new Calculation()); | |
526 } | 475 } |
527 | 476 |
528 | 477 |
529 /** | 478 /** |
530 * Returns the data that is computed by a discharge curve computation. | 479 * Returns the data that is computed by a discharge curve computation. |