annotate artifacts/src/main/java/org/dive4elements/river/artifacts/model/fixings/FixRealizingCalculation.java @ 9415:9744ce3c3853

Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets. The facets also put the valid station range into their xml-metadata
author gernotbelger
date Thu, 16 Aug 2018 16:27:53 +0200
parents ddcd52d239cd
children 2b83d3a96703
rev   line source
5863
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
1 /* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
2 * Software engineering by Intevation GmbH
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
3 *
5994
af13ceeba52a Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5863
diff changeset
4 * This file is Free Software under the GNU AGPL (>=v3)
5863
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
5 * and comes with ABSOLUTELY NO WARRANTY! Check out the
5994
af13ceeba52a Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5863
diff changeset
6 * documentation coming with Dive4Elements River for details.
5863
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
7 */
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
8
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5150
diff changeset
9 package org.dive4elements.river.artifacts.model.fixings;
3437
e111902834d3 FixA: Made calculation base class abstract. Sub classes are called with fixings overview an function to fit.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3420
diff changeset
10
9415
9744ce3c3853 Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents: 9360
diff changeset
11 import java.util.List;
9744ce3c3853 Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents: 9360
diff changeset
12
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5150
diff changeset
13 import org.dive4elements.river.artifacts.access.FixRealizingAccess;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5150
diff changeset
14 import org.dive4elements.river.artifacts.math.fitting.Function;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5150
diff changeset
15 import org.dive4elements.river.artifacts.model.CalculationResult;
9415
9744ce3c3853 Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents: 9360
diff changeset
16 import org.dive4elements.river.artifacts.model.Parameters;
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5150
diff changeset
17 import org.dive4elements.river.artifacts.model.RiverFactory;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5150
diff changeset
18 import org.dive4elements.river.artifacts.model.Segment;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5150
diff changeset
19 import org.dive4elements.river.artifacts.model.WQKms;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5150
diff changeset
20 import org.dive4elements.river.model.River;
3419
da7cf0e3ccaa FixA: Created a common base class for the fixing related calculations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3414
diff changeset
21
5150
345f3bba6f15 Doc fixes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4968
diff changeset
22 /** Calculation for FixRealize (german: ausgel. WSPL). */
9415
9744ce3c3853 Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents: 9360
diff changeset
23 public class FixRealizingCalculation extends FixCalculation {
9744ce3c3853 Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents: 9360
diff changeset
24 private static final long serialVersionUID = 1L;
3414
1bb6fb621167 FixA: Added stub for the "Ausgelagerte Wasserspiegellagen" calculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
25
9415
9744ce3c3853 Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents: 9360
diff changeset
26 protected boolean isQ;
9744ce3c3853 Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents: 9360
diff changeset
27
3419
da7cf0e3ccaa FixA: Created a common base class for the fixing related calculations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3414
diff changeset
28 protected List<Segment> segments;
da7cf0e3ccaa FixA: Created a common base class for the fixing related calculations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3414
diff changeset
29
3414
1bb6fb621167 FixA: Added stub for the "Ausgelagerte Wasserspiegellagen" calculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
30 public FixRealizingCalculation() {
1bb6fb621167 FixA: Added stub for the "Ausgelagerte Wasserspiegellagen" calculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
31 }
1bb6fb621167 FixA: Added stub for the "Ausgelagerte Wasserspiegellagen" calculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
32
9415
9744ce3c3853 Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents: 9360
diff changeset
33 public FixRealizingCalculation(final FixRealizingAccess access) {
3420
7f7ab030a4e3 FixA: Minor refactoring
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3419
diff changeset
34 super(access);
7f7ab030a4e3 FixA: Minor refactoring
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3419
diff changeset
35
9415
9744ce3c3853 Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents: 9360
diff changeset
36 final Boolean isQ = access.isQ();
9744ce3c3853 Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents: 9360
diff changeset
37 final List<Segment> segments = access.getSegments();
3419
da7cf0e3ccaa FixA: Created a common base class for the fixing related calculations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3414
diff changeset
38
da7cf0e3ccaa FixA: Created a common base class for the fixing related calculations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3414
diff changeset
39 if (isQ == null) {
da7cf0e3ccaa FixA: Created a common base class for the fixing related calculations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3414
diff changeset
40 addProblem("fix.realize.missing.is.q");
da7cf0e3ccaa FixA: Created a common base class for the fixing related calculations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3414
diff changeset
41 }
da7cf0e3ccaa FixA: Created a common base class for the fixing related calculations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3414
diff changeset
42
da7cf0e3ccaa FixA: Created a common base class for the fixing related calculations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3414
diff changeset
43 if (segments == null || segments.isEmpty()) {
da7cf0e3ccaa FixA: Created a common base class for the fixing related calculations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3414
diff changeset
44 addProblem("fix.realize.missing.segments");
da7cf0e3ccaa FixA: Created a common base class for the fixing related calculations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3414
diff changeset
45 }
da7cf0e3ccaa FixA: Created a common base class for the fixing related calculations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3414
diff changeset
46
9415
9744ce3c3853 Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents: 9360
diff changeset
47 final River r = RiverFactory.getRiver(this.river);
3449
fc351f12b906 FixA: Vollmer. Calculated the Q -> Ws. TODO: Produce result.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3437
diff changeset
48
fc351f12b906 FixA: Vollmer. Calculated the Q -> Ws. TODO: Produce result.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3437
diff changeset
49 if (r == null) {
fc351f12b906 FixA: Vollmer. Calculated the Q -> Ws. TODO: Produce result.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3437
diff changeset
50 addProblem("fix.no.such.river");
fc351f12b906 FixA: Vollmer. Calculated the Q -> Ws. TODO: Produce result.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3437
diff changeset
51 }
fc351f12b906 FixA: Vollmer. Calculated the Q -> Ws. TODO: Produce result.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3437
diff changeset
52
3419
da7cf0e3ccaa FixA: Created a common base class for the fixing related calculations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3414
diff changeset
53 if (!hasProblems()) {
9415
9744ce3c3853 Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents: 9360
diff changeset
54 this.isQ = isQ;
3419
da7cf0e3ccaa FixA: Created a common base class for the fixing related calculations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3414
diff changeset
55 this.segments = segments;
3449
fc351f12b906 FixA: Vollmer. Calculated the Q -> Ws. TODO: Produce result.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3437
diff changeset
56
fc351f12b906 FixA: Vollmer. Calculated the Q -> Ws. TODO: Produce result.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3437
diff changeset
57 // Convert from W to Q
fc351f12b906 FixA: Vollmer. Calculated the Q -> Ws. TODO: Produce result.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3437
diff changeset
58 Segment.setReferencePointConvertQ(segments, r, isQ, this);
3419
da7cf0e3ccaa FixA: Created a common base class for the fixing related calculations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3414
diff changeset
59 }
3414
1bb6fb621167 FixA: Added stub for the "Ausgelagerte Wasserspiegellagen" calculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
60 }
1bb6fb621167 FixA: Added stub for the "Ausgelagerte Wasserspiegellagen" calculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
61
3437
e111902834d3 FixA: Made calculation base class abstract. Sub classes are called with fixings overview an function to fit.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3420
diff changeset
62 @Override
9415
9744ce3c3853 Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents: 9360
diff changeset
63 protected CalculationResult innerCalculate(final FixingsOverview overview, final Function func) {
9744ce3c3853 Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents: 9360
diff changeset
64 final ColumnCache cc = new ColumnCache();
9744ce3c3853 Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents: 9360
diff changeset
65 final FitResult fitResult = doFitting(overview, cc, func);
3449
fc351f12b906 FixA: Vollmer. Calculated the Q -> Ws. TODO: Produce result.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3437
diff changeset
66
fc351f12b906 FixA: Vollmer. Calculated the Q -> Ws. TODO: Produce result.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3437
diff changeset
67 if (fitResult == null) {
fc351f12b906 FixA: Vollmer. Calculated the Q -> Ws. TODO: Produce result.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3437
diff changeset
68 return new CalculationResult(this);
fc351f12b906 FixA: Vollmer. Calculated the Q -> Ws. TODO: Produce result.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3437
diff changeset
69 }
fc351f12b906 FixA: Vollmer. Calculated the Q -> Ws. TODO: Produce result.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3437
diff changeset
70
9415
9744ce3c3853 Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents: 9360
diff changeset
71 Segment segment = this.segments.get(0);
9744ce3c3853 Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents: 9360
diff changeset
72 final int numResults = segment.numValues();
3449
fc351f12b906 FixA: Vollmer. Calculated the Q -> Ws. TODO: Produce result.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3437
diff changeset
73
9415
9744ce3c3853 Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents: 9360
diff changeset
74 final WQKms[] results = new WQKms[numResults];
3449
fc351f12b906 FixA: Vollmer. Calculated the Q -> Ws. TODO: Produce result.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3437
diff changeset
75 for (int i = 0; i < results.length; ++i) {
fc351f12b906 FixA: Vollmer. Calculated the Q -> Ws. TODO: Produce result.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3437
diff changeset
76 results[i] = new WQKms();
fc351f12b906 FixA: Vollmer. Calculated the Q -> Ws. TODO: Produce result.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3437
diff changeset
77 }
fc351f12b906 FixA: Vollmer. Calculated the Q -> Ws. TODO: Produce result.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3437
diff changeset
78
9415
9744ce3c3853 Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents: 9360
diff changeset
79 final Parameters parameters = fitResult.getParameters();
3449
fc351f12b906 FixA: Vollmer. Calculated the Q -> Ws. TODO: Produce result.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3437
diff changeset
80
9415
9744ce3c3853 Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents: 9360
diff changeset
81 final int kmIndex = parameters.columnIndex("km");
9744ce3c3853 Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents: 9360
diff changeset
82 final int[] parameterIndices = parameters.columnIndices(func.getParameterNames());
3449
fc351f12b906 FixA: Vollmer. Calculated the Q -> Ws. TODO: Produce result.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3437
diff changeset
83
9415
9744ce3c3853 Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents: 9360
diff changeset
84 final double[] parameterValues = new double[parameterIndices.length];
3449
fc351f12b906 FixA: Vollmer. Calculated the Q -> Ws. TODO: Produce result.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3437
diff changeset
85
fc351f12b906 FixA: Vollmer. Calculated the Q -> Ws. TODO: Produce result.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3437
diff changeset
86 for (int row = 0, R = parameters.size(); row < R; ++row) {
9415
9744ce3c3853 Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents: 9360
diff changeset
87 final double km = parameters.get(row, kmIndex);
3449
fc351f12b906 FixA: Vollmer. Calculated the Q -> Ws. TODO: Produce result.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3437
diff changeset
88
fc351f12b906 FixA: Vollmer. Calculated the Q -> Ws. TODO: Produce result.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3437
diff changeset
89 if (!segment.inside(km)) {
fc351f12b906 FixA: Vollmer. Calculated the Q -> Ws. TODO: Produce result.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3437
diff changeset
90 Segment nextSeg = null;
9415
9744ce3c3853 Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents: 9360
diff changeset
91 for (final Segment seg : this.segments) {
3449
fc351f12b906 FixA: Vollmer. Calculated the Q -> Ws. TODO: Produce result.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3437
diff changeset
92 if (seg.inside(km)) {
fc351f12b906 FixA: Vollmer. Calculated the Q -> Ws. TODO: Produce result.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3437
diff changeset
93 nextSeg = seg;
fc351f12b906 FixA: Vollmer. Calculated the Q -> Ws. TODO: Produce result.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3437
diff changeset
94 break;
fc351f12b906 FixA: Vollmer. Calculated the Q -> Ws. TODO: Produce result.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3437
diff changeset
95 }
fc351f12b906 FixA: Vollmer. Calculated the Q -> Ws. TODO: Produce result.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3437
diff changeset
96 }
fc351f12b906 FixA: Vollmer. Calculated the Q -> Ws. TODO: Produce result.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3437
diff changeset
97 if (nextSeg == null) {
fc351f12b906 FixA: Vollmer. Calculated the Q -> Ws. TODO: Produce result.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3437
diff changeset
98 addProblem(km, "fix.cannot.find.segment");
fc351f12b906 FixA: Vollmer. Calculated the Q -> Ws. TODO: Produce result.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3437
diff changeset
99 continue;
fc351f12b906 FixA: Vollmer. Calculated the Q -> Ws. TODO: Produce result.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3437
diff changeset
100 }
fc351f12b906 FixA: Vollmer. Calculated the Q -> Ws. TODO: Produce result.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3437
diff changeset
101 segment = nextSeg;
fc351f12b906 FixA: Vollmer. Calculated the Q -> Ws. TODO: Produce result.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3437
diff changeset
102 }
fc351f12b906 FixA: Vollmer. Calculated the Q -> Ws. TODO: Produce result.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3437
diff changeset
103
fc351f12b906 FixA: Vollmer. Calculated the Q -> Ws. TODO: Produce result.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3437
diff changeset
104 parameters.get(row, parameterIndices, parameterValues);
fc351f12b906 FixA: Vollmer. Calculated the Q -> Ws. TODO: Produce result.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3437
diff changeset
105
9415
9744ce3c3853 Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents: 9360
diff changeset
106 final org.dive4elements.river.artifacts.math.Function instance = func.instantiate(parameterValues);
3449
fc351f12b906 FixA: Vollmer. Calculated the Q -> Ws. TODO: Produce result.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3437
diff changeset
107
9415
9744ce3c3853 Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents: 9360
diff changeset
108 final double[] values = segment.getValues();
3449
fc351f12b906 FixA: Vollmer. Calculated the Q -> Ws. TODO: Produce result.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3437
diff changeset
109 for (int i = 0; i < numResults; ++i) {
9415
9744ce3c3853 Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents: 9360
diff changeset
110 final double q = values[i];
9744ce3c3853 Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents: 9360
diff changeset
111 final double w = instance.value(q);
3449
fc351f12b906 FixA: Vollmer. Calculated the Q -> Ws. TODO: Produce result.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3437
diff changeset
112
fc351f12b906 FixA: Vollmer. Calculated the Q -> Ws. TODO: Produce result.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3437
diff changeset
113 if (Double.isNaN(w)) {
fc351f12b906 FixA: Vollmer. Calculated the Q -> Ws. TODO: Produce result.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3437
diff changeset
114 addProblem(km, "fix.cannot.calculate.function", q);
9415
9744ce3c3853 Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents: 9360
diff changeset
115 } else {
3449
fc351f12b906 FixA: Vollmer. Calculated the Q -> Ws. TODO: Produce result.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3437
diff changeset
116 results[i].add(w, q, km);
fc351f12b906 FixA: Vollmer. Calculated the Q -> Ws. TODO: Produce result.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3437
diff changeset
117 }
fc351f12b906 FixA: Vollmer. Calculated the Q -> Ws. TODO: Produce result.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3437
diff changeset
118 }
fc351f12b906 FixA: Vollmer. Calculated the Q -> Ws. TODO: Produce result.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3437
diff changeset
119 }
fc351f12b906 FixA: Vollmer. Calculated the Q -> Ws. TODO: Produce result.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3437
diff changeset
120
5150
345f3bba6f15 Doc fixes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4968
diff changeset
121 // Name the curves.
9360
ddcd52d239cd Outliers in fixation calculation are now shown within the other 'B' event themes and get a separate symbol (triangle).
gernotbelger
parents: 7546
diff changeset
122 for (int i = 0; i < results.length; ++i)
3449
fc351f12b906 FixA: Vollmer. Calculated the Q -> Ws. TODO: Produce result.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3437
diff changeset
123 results[i].setName(createName(i));
fc351f12b906 FixA: Vollmer. Calculated the Q -> Ws. TODO: Produce result.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3437
diff changeset
124
9415
9744ce3c3853 Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents: 9360
diff changeset
125 final FixRealizingResult frr = new FixRealizingResult(parameters, fitResult.getResultColumns(), results);
3450
22790758b132 FixA/Vollmer: return the result now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3449
diff changeset
126
22790758b132 FixA/Vollmer: return the result now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3449
diff changeset
127 return new CalculationResult(frr, this);
3414
1bb6fb621167 FixA: Added stub for the "Ausgelagerte Wasserspiegellagen" calculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
128 }
3449
fc351f12b906 FixA: Vollmer. Calculated the Q -> Ws. TODO: Produce result.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3437
diff changeset
129
4968
d76705b68e73 FixRealizingCalculation: TODO/issue comment.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3603
diff changeset
130 // TODO: issue1109/2
9415
9744ce3c3853 Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents: 9360
diff changeset
131 protected String createName(final int index) {
3449
fc351f12b906 FixA: Vollmer. Calculated the Q -> Ws. TODO: Produce result.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3437
diff changeset
132 // TODO: i18n
9415
9744ce3c3853 Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents: 9360
diff changeset
133 final StringBuilder sb = new StringBuilder(this.isQ ? "Q" : "W");
3449
fc351f12b906 FixA: Vollmer. Calculated the Q -> Ws. TODO: Produce result.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3437
diff changeset
134 sb.append(" benutzerdefiniert (");
9415
9744ce3c3853 Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents: 9360
diff changeset
135 for (int i = 0, N = this.segments.size(); i < N; ++i) {
3449
fc351f12b906 FixA: Vollmer. Calculated the Q -> Ws. TODO: Produce result.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3437
diff changeset
136 if (i > 0) {
fc351f12b906 FixA: Vollmer. Calculated the Q -> Ws. TODO: Produce result.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3437
diff changeset
137 sb.append("; ");
fc351f12b906 FixA: Vollmer. Calculated the Q -> Ws. TODO: Produce result.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3437
diff changeset
138 }
9415
9744ce3c3853 Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents: 9360
diff changeset
139 final Segment segment = this.segments.get(i);
9744ce3c3853 Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents: 9360
diff changeset
140 final double[] backup = segment.getBackup();
9744ce3c3853 Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents: 9360
diff changeset
141 final double[] values = segment.getValues();
3449
fc351f12b906 FixA: Vollmer. Calculated the Q -> Ws. TODO: Produce result.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3437
diff changeset
142 sb.append((backup != null ? backup : values)[index]);
fc351f12b906 FixA: Vollmer. Calculated the Q -> Ws. TODO: Produce result.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3437
diff changeset
143 }
fc351f12b906 FixA: Vollmer. Calculated the Q -> Ws. TODO: Produce result.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3437
diff changeset
144 sb.append(')');
fc351f12b906 FixA: Vollmer. Calculated the Q -> Ws. TODO: Produce result.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3437
diff changeset
145 return sb.toString();
fc351f12b906 FixA: Vollmer. Calculated the Q -> Ws. TODO: Produce result.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3437
diff changeset
146 }
9415
9744ce3c3853 Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents: 9360
diff changeset
147 }

http://dive4elements.wald.intevation.org