Mercurial > dive4elements > river
annotate artifacts/src/main/java/org/dive4elements/river/artifacts/model/fixings/FixAnalysisCalculation.java @ 9648:c5a496bf1b0b
Fixed: Duplizieren einer Fixierungsanalyse schlägt fehl.
author | Gernot Belger <g.belger@bjoernsen.de> |
---|---|
date | Wed, 04 Dec 2019 16:10:28 +0100 |
parents | 2b83d3a96703 |
children |
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:
3609
diff
changeset
|
9 package org.dive4elements.river.artifacts.model.fixings; |
3411
0ef83077c93f
FixA: Renamed FixCalculation to FixAnalysisCalculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
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.ArrayList; |
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 import java.util.Date; |
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
|
13 import java.util.List; |
3411
0ef83077c93f
FixA: Renamed FixCalculation to FixAnalysisCalculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
14 |
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
|
15 import org.apache.commons.math.stat.descriptive.moment.StandardDeviation; |
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.apache.log4j.Logger; |
9479
2b83d3a96703
i18n TODO "benutzerdefiniert" = "custom" fixed
gernotbelger
parents:
9415
diff
changeset
|
17 import org.dive4elements.artifacts.CallMeta; |
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
|
18 import org.dive4elements.river.artifacts.access.FixAnalysisAccess; |
5831
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3609
diff
changeset
|
19 import org.dive4elements.river.artifacts.math.fitting.Function; |
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3609
diff
changeset
|
20 import org.dive4elements.river.artifacts.model.CalculationResult; |
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3609
diff
changeset
|
21 import org.dive4elements.river.artifacts.model.DateRange; |
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3609
diff
changeset
|
22 import org.dive4elements.river.artifacts.model.Parameters; |
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3609
diff
changeset
|
23 import org.dive4elements.river.artifacts.model.Range; |
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
|
24 import org.dive4elements.river.artifacts.model.fixings.FixingsOverview.AndFilter; |
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
|
25 import org.dive4elements.river.artifacts.model.fixings.FixingsOverview.DateRangeFilter; |
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 import org.dive4elements.river.artifacts.model.fixings.FixingsOverview.IdsFilter; |
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 import org.dive4elements.river.artifacts.model.fixings.FixingsOverview.KmFilter; |
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
|
28 import org.dive4elements.river.artifacts.model.fixings.FixingsOverview.SectorFilter; |
5831
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3609
diff
changeset
|
29 import org.dive4elements.river.utils.DateAverager; |
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3609
diff
changeset
|
30 import org.dive4elements.river.utils.KMIndex; |
3411
0ef83077c93f
FixA: Renamed FixCalculation to FixAnalysisCalculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
31 |
3609
a16837d73130
FixA: Using trove to map int->int instead of bloated generics.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3607
diff
changeset
|
32 import gnu.trove.TIntIntHashMap; |
a16837d73130
FixA: Using trove to map int->int instead of bloated generics.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3607
diff
changeset
|
33 |
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
|
34 public class FixAnalysisCalculation extends FixCalculation { |
3411
0ef83077c93f
FixA: Renamed FixCalculation to FixAnalysisCalculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
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 private static final long serialVersionUID = 1L; |
3411
0ef83077c93f
FixA: Renamed FixCalculation to FixAnalysisCalculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
37 |
0ef83077c93f
FixA: Renamed FixCalculation to FixAnalysisCalculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
38 private static Logger log = Logger.getLogger(FixAnalysisCalculation.class); |
0ef83077c93f
FixA: Renamed FixCalculation to FixAnalysisCalculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
39 |
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
|
40 private DateRange referencePeriod; |
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
|
41 |
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
|
42 private DateRange[] analysisPeriods; |
3411
0ef83077c93f
FixA: Renamed FixCalculation to FixAnalysisCalculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
43 |
0ef83077c93f
FixA: Renamed FixCalculation to FixAnalysisCalculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
44 public FixAnalysisCalculation() { |
0ef83077c93f
FixA: Renamed FixCalculation to FixAnalysisCalculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
45 } |
0ef83077c93f
FixA: Renamed FixCalculation to FixAnalysisCalculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
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 public FixAnalysisCalculation(final FixAnalysisAccess access) { |
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
|
48 |
3419
da7cf0e3ccaa
FixA: Created a common base class for the fixing related calculations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3415
diff
changeset
|
49 super(access); |
3411
0ef83077c93f
FixA: Renamed FixCalculation to FixAnalysisCalculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
50 |
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
|
51 final DateRange referencePeriod = access.getReferencePeriod(); |
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
|
52 final DateRange[] analysisPeriods = access.getAnalysisPeriods(); |
3411
0ef83077c93f
FixA: Renamed FixCalculation to FixAnalysisCalculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
53 |
0ef83077c93f
FixA: Renamed FixCalculation to FixAnalysisCalculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
54 if (referencePeriod == null) { |
0ef83077c93f
FixA: Renamed FixCalculation to FixAnalysisCalculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
55 addProblem("fix.missing.reference.period"); |
0ef83077c93f
FixA: Renamed FixCalculation to FixAnalysisCalculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
56 } |
0ef83077c93f
FixA: Renamed FixCalculation to FixAnalysisCalculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
57 |
0ef83077c93f
FixA: Renamed FixCalculation to FixAnalysisCalculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
58 if (analysisPeriods == null || analysisPeriods.length < 1) { |
0ef83077c93f
FixA: Renamed FixCalculation to FixAnalysisCalculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
59 addProblem("fix.missing.analysis.periods"); |
0ef83077c93f
FixA: Renamed FixCalculation to FixAnalysisCalculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
60 } |
0ef83077c93f
FixA: Renamed FixCalculation to FixAnalysisCalculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
61 |
0ef83077c93f
FixA: Renamed FixCalculation to FixAnalysisCalculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
62 if (!hasProblems()) { |
0ef83077c93f
FixA: Renamed FixCalculation to FixAnalysisCalculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
63 this.referencePeriod = referencePeriod; |
0ef83077c93f
FixA: Renamed FixCalculation to FixAnalysisCalculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
64 this.analysisPeriods = analysisPeriods; |
0ef83077c93f
FixA: Renamed FixCalculation to FixAnalysisCalculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
65 } |
0ef83077c93f
FixA: Renamed FixCalculation to FixAnalysisCalculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
66 } |
0ef83077c93f
FixA: Renamed FixCalculation to FixAnalysisCalculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
67 |
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:
3435
diff
changeset
|
68 @Override |
9479
2b83d3a96703
i18n TODO "benutzerdefiniert" = "custom" fixed
gernotbelger
parents:
9415
diff
changeset
|
69 protected CalculationResult innerCalculate(final FixingsOverview overview, final Function function, final CallMeta meta) { |
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
|
70 final ColumnCache cc = new ColumnCache(); |
3411
0ef83077c93f
FixA: Renamed FixCalculation to FixAnalysisCalculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
71 |
9479
2b83d3a96703
i18n TODO "benutzerdefiniert" = "custom" fixed
gernotbelger
parents:
9415
diff
changeset
|
72 final FitResult fitResult = doFitting(overview, cc, function); |
3411
0ef83077c93f
FixA: Renamed FixCalculation to FixAnalysisCalculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
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 if (fitResult == null) |
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
|
75 return new CalculationResult(this); |
3411
0ef83077c93f
FixA: Renamed FixCalculation to FixAnalysisCalculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
76 |
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
|
77 final Parameters parameters = fitResult.getParameters(); |
6875
437856cec419
FixA: Fixed reference events mapping. TODO: Same for analysis periods.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6574
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 AnalysisPeriodEventResults eventResults = new AnalysisPeriodEventResults(); |
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
|
80 final KMIndex<AnalysisPeriod[]> kmResults = new KMIndex<>(parameters.size()); |
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 |
9479
2b83d3a96703
i18n TODO "benutzerdefiniert" = "custom" fixed
gernotbelger
parents:
9415
diff
changeset
|
82 calculateAnalysisPeriods(function, parameters, overview, cc, eventResults, kmResults); |
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
|
83 eventResults.sortAll(); |
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 kmResults.sort(); |
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
|
85 |
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
|
86 final FixAnalysisResult far = new FixAnalysisResult(parameters, fitResult.getResultColumns(), kmResults, eventResults); |
3435
262e7d7e58fe
FixA: Made curve fitting over the given calculation range reusable. Removed dead code.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3434
diff
changeset
|
87 return new CalculationResult(far, this); |
3411
0ef83077c93f
FixA: Renamed FixCalculation to FixAnalysisCalculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
88 } |
0ef83077c93f
FixA: Renamed FixCalculation to FixAnalysisCalculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
89 |
3434
1a636be7612b
FixA: Moved more common calculation code into base class.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3420
diff
changeset
|
90 @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
|
91 protected FixingColumnFilter createFilter() { |
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
|
92 final FixingColumnFilter ids = super.createFilter(); |
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
|
93 final DateRangeFilter rdf = new DateRangeFilter(this.referencePeriod.getFrom(), this.referencePeriod.getTo()); |
3434
1a636be7612b
FixA: Moved more common calculation code into base class.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3420
diff
changeset
|
94 return new AndFilter().add(rdf).add(ids); |
3411
0ef83077c93f
FixA: Renamed FixCalculation to FixAnalysisCalculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
95 } |
0ef83077c93f
FixA: Renamed FixCalculation to FixAnalysisCalculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
96 |
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
|
97 private void calculateAnalysisPeriods(final Function function, final Parameters parameters, final FixingsOverview overview, final ColumnCache cc, |
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
|
98 final AnalysisPeriodEventResults eventResults, final KMIndex<AnalysisPeriod[]> kmResults) { |
3411
0ef83077c93f
FixA: Renamed FixCalculation to FixAnalysisCalculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
99 |
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
|
100 final Range range = new Range(this.from, this.to); |
3411
0ef83077c93f
FixA: Renamed FixCalculation to FixAnalysisCalculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
101 |
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
|
102 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
|
103 final int maxQIndex = parameters.columnIndex("max_q"); |
6999
3e93f29281bc
Fix for flys/issue1479: The indices of the dates of the analysis periods where re-mapped wrong.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6891
diff
changeset
|
104 |
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
|
105 final double[] ws = new double[1]; |
6999
3e93f29281bc
Fix for flys/issue1479: The indices of the dates of the analysis periods where re-mapped wrong.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6891
diff
changeset
|
106 |
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
|
107 final int[] parameterIndices = parameters.columnIndices(function.getParameterNames()); |
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 |
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
|
109 final double[] parameterValues = new double[parameterIndices.length]; |
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 |
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 DateAverager dateAverager = new DateAverager(); |
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
|
112 |
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
|
113 final IdsFilter idsFilter = new IdsFilter(this.events); |
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
|
114 |
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 final TIntIntHashMap[] col2indices = new TIntIntHashMap[this.analysisPeriods.length]; |
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
|
116 |
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
|
117 final DateRangeFilter[] drfs = new DateRangeFilter[this.analysisPeriods.length]; |
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
|
118 |
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
|
119 final boolean debug = log.isDebugEnabled(); |
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
|
120 |
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
|
121 for (int i = 0; i < this.analysisPeriods.length; ++i) { |
3609
a16837d73130
FixA: Using trove to map int->int instead of bloated generics.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3607
diff
changeset
|
122 col2indices[i] = new TIntIntHashMap(); |
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
|
123 drfs[i] = new DateRangeFilter(this.analysisPeriods[i].getFrom(), this.analysisPeriods[i].getTo()); |
6999
3e93f29281bc
Fix for flys/issue1479: The indices of the dates of the analysis periods where re-mapped wrong.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6891
diff
changeset
|
124 |
3e93f29281bc
Fix for flys/issue1479: The indices of the dates of the analysis periods where re-mapped wrong.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6891
diff
changeset
|
125 if (debug) { |
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
|
126 log.debug("Analysis period " + (i + 1) + " date range: " + this.analysisPeriods[i].getFrom() + " - " + this.analysisPeriods[i].getTo()); |
6999
3e93f29281bc
Fix for flys/issue1479: The indices of the dates of the analysis periods where re-mapped wrong.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6891
diff
changeset
|
127 } |
3607
e0f54fab55d3
FixA: Generate indices for each analysis periods.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3605
diff
changeset
|
128 } |
3605
7196f06e0928
FixA: Made indices of analysis periods QWs zero based.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3604
diff
changeset
|
129 |
3411
0ef83077c93f
FixA: Renamed FixCalculation to FixAnalysisCalculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
130 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
|
131 final double km = parameters.get(row, kmIndex); |
3411
0ef83077c93f
FixA: Renamed FixCalculation to FixAnalysisCalculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
132 parameters.get(row, parameterIndices, parameterValues); |
0ef83077c93f
FixA: Renamed FixCalculation to FixAnalysisCalculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
133 |
6999
3e93f29281bc
Fix for flys/issue1479: The indices of the dates of the analysis periods where re-mapped wrong.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6891
diff
changeset
|
134 // This is the parameterized function for a given km. |
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 final org.dive4elements.river.artifacts.math.Function instance = function.instantiate(parameterValues); |
3411
0ef83077c93f
FixA: Renamed FixCalculation to FixAnalysisCalculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
136 |
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
|
137 final KmFilter kmFilter = new KmFilter(km); |
3607
e0f54fab55d3
FixA: Generate indices for each analysis periods.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3605
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 List<AnalysisPeriod> periodResults = new ArrayList<>(this.analysisPeriods.length); |
3411
0ef83077c93f
FixA: Renamed FixCalculation to FixAnalysisCalculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
140 |
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
|
141 for (int ap = 0; ap < this.analysisPeriods.length; ++ap) { |
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
|
142 final DateRange analysisPeriod = this.analysisPeriods[ap]; |
3411
0ef83077c93f
FixA: Renamed FixCalculation to FixAnalysisCalculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
143 |
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
|
144 final DateRangeFilter drf = drfs[ap]; |
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
|
145 |
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
|
146 final QWD[] qSectorAverages = new QWD[4]; |
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 final double[] qSectorStdDevs = new double[4]; |
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
|
148 |
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
|
149 final ArrayList<QWD> allQWDs = new ArrayList<>(); |
3411
0ef83077c93f
FixA: Renamed FixCalculation to FixAnalysisCalculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
150 |
0ef83077c93f
FixA: Renamed FixCalculation to FixAnalysisCalculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
151 // for all Q sectors. |
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
|
152 for (int qSector = this.qSectorStart; qSector <= this.qSectorEnd; ++qSector) { |
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
|
153 final FixingColumnFilter filter = new AndFilter().add(kmFilter).add(new SectorFilter(qSector)).add(drf).add(idsFilter); |
3411
0ef83077c93f
FixA: Renamed FixCalculation to FixAnalysisCalculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
154 |
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
|
155 final List<FixingColumn> metas = overview.filter(range, filter); |
3411
0ef83077c93f
FixA: Renamed FixCalculation to FixAnalysisCalculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
156 |
0ef83077c93f
FixA: Renamed FixCalculation to FixAnalysisCalculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
157 if (metas.isEmpty()) { |
0ef83077c93f
FixA: Renamed FixCalculation to FixAnalysisCalculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
158 // No fixings for km and analysis period |
0ef83077c93f
FixA: Renamed FixCalculation to FixAnalysisCalculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
159 continue; |
0ef83077c93f
FixA: Renamed FixCalculation to FixAnalysisCalculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
160 } |
0ef83077c93f
FixA: Renamed FixCalculation to FixAnalysisCalculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
161 |
0ef83077c93f
FixA: Renamed FixCalculation to FixAnalysisCalculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
162 double sumQ = 0.0; |
0ef83077c93f
FixA: Renamed FixCalculation to FixAnalysisCalculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
163 double sumW = 0.0; |
0ef83077c93f
FixA: Renamed FixCalculation to FixAnalysisCalculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
164 |
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
|
165 final StandardDeviation stdDev = new StandardDeviation(); |
3411
0ef83077c93f
FixA: Renamed FixCalculation to FixAnalysisCalculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
166 |
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
|
167 final List<QWD> qwds = new ArrayList<>(metas.size()); |
3411
0ef83077c93f
FixA: Renamed FixCalculation to FixAnalysisCalculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
168 |
0ef83077c93f
FixA: Renamed FixCalculation to FixAnalysisCalculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
169 dateAverager.clear(); |
0ef83077c93f
FixA: Renamed FixCalculation to FixAnalysisCalculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
170 |
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
|
171 for (final FixingColumn meta : metas) { |
3411
0ef83077c93f
FixA: Renamed FixCalculation to FixAnalysisCalculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
172 if (meta.findQSector(km) != qSector) { |
0ef83077c93f
FixA: Renamed FixCalculation to FixAnalysisCalculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
173 // Ignore not matching sectors. |
0ef83077c93f
FixA: Renamed FixCalculation to FixAnalysisCalculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
174 continue; |
0ef83077c93f
FixA: Renamed FixCalculation to FixAnalysisCalculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
175 } |
0ef83077c93f
FixA: Renamed FixCalculation to FixAnalysisCalculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
176 |
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
|
177 final FixingColumnWithData column = cc.getColumn(meta); |
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
|
178 if (column == null) |
9325
094ed9d1f2ad
Fixed: change of point style of interpolated data did not change in WQ chart of fixanalysis
gernotbelger
parents:
8856
diff
changeset
|
179 continue; |
094ed9d1f2ad
Fixed: change of point style of interpolated data did not change in WQ chart of fixanalysis
gernotbelger
parents:
8856
diff
changeset
|
180 |
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
|
181 final double q = column.getQ(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
|
182 final boolean interpolated = !column.getW(km, ws, 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
|
183 final double w = ws[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
|
184 |
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
|
185 if (Double.isNaN(w) || Double.isNaN(q)) |
3411
0ef83077c93f
FixA: Renamed FixCalculation to FixAnalysisCalculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
186 continue; |
0ef83077c93f
FixA: Renamed FixCalculation to FixAnalysisCalculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
187 |
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
|
188 final double fw = instance.value(q); |
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
|
189 if (Double.isNaN(fw)) |
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
|
190 continue; |
3411
0ef83077c93f
FixA: Renamed FixCalculation to FixAnalysisCalculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
191 |
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
|
192 final double dw = (w - fw) * 100.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
|
193 |
3411
0ef83077c93f
FixA: Renamed FixCalculation to FixAnalysisCalculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
194 stdDev.increment(dw); |
0ef83077c93f
FixA: Renamed FixCalculation to FixAnalysisCalculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
195 |
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
|
196 final Date date = column.getDate(); |
3411
0ef83077c93f
FixA: Renamed FixCalculation to FixAnalysisCalculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
197 |
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
|
198 final QWD qwd = new QWD(q, w, date, interpolated, dw, false); |
3411
0ef83077c93f
FixA: Renamed FixCalculation to FixAnalysisCalculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
199 qwds.add(qwd); |
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
|
200 eventResults.addQWD(ap, km, column, qwd); |
3411
0ef83077c93f
FixA: Renamed FixCalculation to FixAnalysisCalculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
201 |
9325
094ed9d1f2ad
Fixed: change of point style of interpolated data did not change in WQ chart of fixanalysis
gernotbelger
parents:
8856
diff
changeset
|
202 sumW += w; |
094ed9d1f2ad
Fixed: change of point style of interpolated data did not change in WQ chart of fixanalysis
gernotbelger
parents:
8856
diff
changeset
|
203 sumQ += q; |
3411
0ef83077c93f
FixA: Renamed FixCalculation to FixAnalysisCalculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
204 |
0ef83077c93f
FixA: Renamed FixCalculation to FixAnalysisCalculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
205 dateAverager.add(date); |
0ef83077c93f
FixA: Renamed FixCalculation to FixAnalysisCalculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
206 } |
0ef83077c93f
FixA: Renamed FixCalculation to FixAnalysisCalculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
207 |
0ef83077c93f
FixA: Renamed FixCalculation to FixAnalysisCalculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
208 // Calulate average per Q sector. |
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
|
209 final int N = qwds.size(); |
3411
0ef83077c93f
FixA: Renamed FixCalculation to FixAnalysisCalculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
210 if (N > 0) { |
0ef83077c93f
FixA: Renamed FixCalculation to FixAnalysisCalculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
211 allQWDs.addAll(qwds); |
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
|
212 final double avgW = sumW / N; |
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
|
213 final double avgQ = sumQ / N; |
3411
0ef83077c93f
FixA: Renamed FixCalculation to FixAnalysisCalculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
214 |
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
|
215 final double avgFw = instance.value(avgQ); |
3411
0ef83077c93f
FixA: Renamed FixCalculation to FixAnalysisCalculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
216 if (!Double.isNaN(avgFw)) { |
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
|
217 final double avgDw = (avgW - avgFw) * 100.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
|
218 final Date avgDate = dateAverager.getAverage(); |
3411
0ef83077c93f
FixA: Renamed FixCalculation to FixAnalysisCalculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
219 |
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
|
220 final QWD avgQWD = new QWD(avgQ, avgW, avgDate, true, avgDw, false); |
3411
0ef83077c93f
FixA: Renamed FixCalculation to FixAnalysisCalculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
221 |
0ef83077c93f
FixA: Renamed FixCalculation to FixAnalysisCalculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
222 qSectorAverages[qSector] = avgQWD; |
0ef83077c93f
FixA: Renamed FixCalculation to FixAnalysisCalculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
223 } |
0ef83077c93f
FixA: Renamed FixCalculation to FixAnalysisCalculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
224 qSectorStdDevs[qSector] = stdDev.getResult(); |
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
|
225 } else { |
3411
0ef83077c93f
FixA: Renamed FixCalculation to FixAnalysisCalculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
226 qSectorStdDevs[qSector] = Double.NaN; |
0ef83077c93f
FixA: Renamed FixCalculation to FixAnalysisCalculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
227 } |
0ef83077c93f
FixA: Renamed FixCalculation to FixAnalysisCalculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
228 } // for all Q sectors |
0ef83077c93f
FixA: Renamed FixCalculation to FixAnalysisCalculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
229 |
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
|
230 /* calculate max q for this period */ |
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
|
231 double maxQ = -Double.MAX_VALUE; |
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
|
232 for (final QWD qwd : allQWDs) { |
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
|
233 if (qwd.getQ() > maxQ) |
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
|
234 maxQ = qwd.getQ(); |
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
|
235 } |
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
|
236 for (final QWD qwd : qSectorAverages) { |
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
|
237 if (qwd != null && qwd.getQ() > maxQ) |
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
|
238 maxQ = qwd.getQ(); |
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
|
239 } |
3411
0ef83077c93f
FixA: Renamed FixCalculation to FixAnalysisCalculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
240 |
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
|
241 final AnalysisPeriod periodResult = new AnalysisPeriod(analysisPeriod, qSectorAverages, qSectorStdDevs, maxQ); |
3411
0ef83077c93f
FixA: Renamed FixCalculation to FixAnalysisCalculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
242 periodResults.add(periodResult); |
0ef83077c93f
FixA: Renamed FixCalculation to FixAnalysisCalculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
243 } |
0ef83077c93f
FixA: Renamed FixCalculation to FixAnalysisCalculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
244 |
0ef83077c93f
FixA: Renamed FixCalculation to FixAnalysisCalculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
245 double maxQ = -Double.MAX_VALUE; |
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
|
246 for (final AnalysisPeriod ap : periodResults) { |
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
|
247 final double q = ap.getMaxQ(); |
3411
0ef83077c93f
FixA: Renamed FixCalculation to FixAnalysisCalculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
248 if (q > maxQ) { |
0ef83077c93f
FixA: Renamed FixCalculation to FixAnalysisCalculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
249 maxQ = q; |
0ef83077c93f
FixA: Renamed FixCalculation to FixAnalysisCalculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
250 } |
0ef83077c93f
FixA: Renamed FixCalculation to FixAnalysisCalculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
251 } |
0ef83077c93f
FixA: Renamed FixCalculation to FixAnalysisCalculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
252 |
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
|
253 final double oldMaxQ = parameters.get(row, maxQIndex); |
3411
0ef83077c93f
FixA: Renamed FixCalculation to FixAnalysisCalculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
254 if (oldMaxQ < maxQ) { |
0ef83077c93f
FixA: Renamed FixCalculation to FixAnalysisCalculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
255 parameters.set(row, maxQIndex, maxQ); |
0ef83077c93f
FixA: Renamed FixCalculation to FixAnalysisCalculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
256 } |
0ef83077c93f
FixA: Renamed FixCalculation to FixAnalysisCalculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
257 |
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
|
258 final AnalysisPeriod[] rap = new AnalysisPeriod[periodResults.size()]; |
6999
3e93f29281bc
Fix for flys/issue1479: The indices of the dates of the analysis periods where re-mapped wrong.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6891
diff
changeset
|
259 periodResults.toArray(rap); |
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
|
260 kmResults.add(km, rap); |
3411
0ef83077c93f
FixA: Renamed FixCalculation to FixAnalysisCalculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
261 } |
0ef83077c93f
FixA: Renamed FixCalculation to FixAnalysisCalculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
262 } |
9479
2b83d3a96703
i18n TODO "benutzerdefiniert" = "custom" fixed
gernotbelger
parents:
9415
diff
changeset
|
263 |
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
|
264 } |