Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/Calculation6.java @ 5257:46e984a3d576
Break long lines in FLYS statements.
author | Sascha L. Teichmann <teichmann@intevation.de> |
---|---|
date | Mon, 11 Mar 2013 12:55:09 +0100 |
parents | 7b6c31390427 |
children | 1b73b731f7bd |
rev | line source |
---|---|
2215
ebbb18ed78c4
Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.artifacts.model; |
ebbb18ed78c4
Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
2 |
2228
4db19a88bddb
Implemented the first step of Calculation6; create Facets for each calculation results.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2219
diff
changeset
|
3 import java.util.ArrayList; |
4241
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
4 import java.util.Arrays; |
2228
4db19a88bddb
Implemented the first step of Calculation6; create Facets for each calculation results.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2219
diff
changeset
|
5 import java.util.Date; |
4db19a88bddb
Implemented the first step of Calculation6; create Facets for each calculation results.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2219
diff
changeset
|
6 import java.util.List; |
4db19a88bddb
Implemented the first step of Calculation6; create Facets for each calculation results.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2219
diff
changeset
|
7 |
2215
ebbb18ed78c4
Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
8 import org.apache.log4j.Logger; |
ebbb18ed78c4
Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
9 |
2228
4db19a88bddb
Implemented the first step of Calculation6; create Facets for each calculation results.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2219
diff
changeset
|
10 import de.intevation.flys.model.DischargeTable; |
2219
4b6e9b377a84
Fetch parameters for 'historical discharge curve' calculation; call Calculation6 with those information and check input parameters.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2215
diff
changeset
|
11 import de.intevation.flys.model.Gauge; |
2228
4db19a88bddb
Implemented the first step of Calculation6; create Facets for each calculation results.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2219
diff
changeset
|
12 import de.intevation.flys.model.TimeInterval; |
2219
4b6e9b377a84
Fetch parameters for 'historical discharge curve' calculation; call Calculation6 with those information and check input parameters.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2215
diff
changeset
|
13 |
2215
ebbb18ed78c4
Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
14 |
ebbb18ed78c4
Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
15 /** |
ebbb18ed78c4
Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
16 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> |
ebbb18ed78c4
Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
17 */ |
ebbb18ed78c4
Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
18 public class Calculation6 extends Calculation { |
ebbb18ed78c4
Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
19 |
ebbb18ed78c4
Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
20 private static final Logger logger = Logger.getLogger(Calculation6.class); |
ebbb18ed78c4
Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
21 |
4232
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4138
diff
changeset
|
22 private int mode; |
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4138
diff
changeset
|
23 private long[] timerange; |
2219
4b6e9b377a84
Fetch parameters for 'historical discharge curve' calculation; call Calculation6 with those information and check input parameters.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2215
diff
changeset
|
24 private double[] values; |
2215
ebbb18ed78c4
Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
25 |
2219
4b6e9b377a84
Fetch parameters for 'historical discharge curve' calculation; call Calculation6 with those information and check input parameters.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2215
diff
changeset
|
26 public static final int MODE_W = 0; |
4b6e9b377a84
Fetch parameters for 'historical discharge curve' calculation; call Calculation6 with those information and check input parameters.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2215
diff
changeset
|
27 public static final int MODE_Q = 1; |
4b6e9b377a84
Fetch parameters for 'historical discharge curve' calculation; call Calculation6 with those information and check input parameters.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2215
diff
changeset
|
28 |
4136
b6ba9bbb5122
#548 Fetch historical discharge table values with SCALE=1.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3452
diff
changeset
|
29 public static final double SCALE = 1d; |
2230
59af81364eb1
Improved the 'historical discharge' calculation: implemented findValueForW().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2228
diff
changeset
|
30 |
2228
4db19a88bddb
Implemented the first step of Calculation6; create Facets for each calculation results.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2219
diff
changeset
|
31 public Calculation6(int mode, long[] timerange, double[] values) { |
4232
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4138
diff
changeset
|
32 this.mode = mode; |
2219
4b6e9b377a84
Fetch parameters for 'historical discharge curve' calculation; call Calculation6 with those information and check input parameters.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2215
diff
changeset
|
33 this.timerange = timerange; |
4232
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4138
diff
changeset
|
34 this.values = values; |
2215
ebbb18ed78c4
Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
35 } |
ebbb18ed78c4
Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
36 |
2219
4b6e9b377a84
Fetch parameters for 'historical discharge curve' calculation; call Calculation6 with those information and check input parameters.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2215
diff
changeset
|
37 public CalculationResult calculate(Gauge gauge) { |
4b6e9b377a84
Fetch parameters for 'historical discharge curve' calculation; call Calculation6 with those information and check input parameters.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2215
diff
changeset
|
38 if (!checkParameters() || gauge == null) { |
4b6e9b377a84
Fetch parameters for 'historical discharge curve' calculation; call Calculation6 with those information and check input parameters.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2215
diff
changeset
|
39 logger.warn("Parameters not valid for calculation."); |
4b6e9b377a84
Fetch parameters for 'historical discharge curve' calculation; call Calculation6 with those information and check input parameters.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2215
diff
changeset
|
40 |
4b6e9b377a84
Fetch parameters for 'historical discharge curve' calculation; call Calculation6 with those information and check input parameters.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2215
diff
changeset
|
41 return null; |
4b6e9b377a84
Fetch parameters for 'historical discharge curve' calculation; call Calculation6 with those information and check input parameters.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2215
diff
changeset
|
42 } |
4b6e9b377a84
Fetch parameters for 'historical discharge curve' calculation; call Calculation6 with those information and check input parameters.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2215
diff
changeset
|
43 |
4b6e9b377a84
Fetch parameters for 'historical discharge curve' calculation; call Calculation6 with those information and check input parameters.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2215
diff
changeset
|
44 if (logger.isDebugEnabled()) { |
4b6e9b377a84
Fetch parameters for 'historical discharge curve' calculation; call Calculation6 with those information and check input parameters.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2215
diff
changeset
|
45 debug(); |
4b6e9b377a84
Fetch parameters for 'historical discharge curve' calculation; call Calculation6 with those information and check input parameters.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2215
diff
changeset
|
46 } |
4b6e9b377a84
Fetch parameters for 'historical discharge curve' calculation; call Calculation6 with those information and check input parameters.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2215
diff
changeset
|
47 |
4232
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4138
diff
changeset
|
48 DischargeTable refTable = fetchReferenceTable(gauge); |
2228
4db19a88bddb
Implemented the first step of Calculation6; create Facets for each calculation results.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2219
diff
changeset
|
49 List<DischargeTable> dts = fetchDischargeTables(gauge); |
2219
4b6e9b377a84
Fetch parameters for 'historical discharge curve' calculation; call Calculation6 with those information and check input parameters.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2215
diff
changeset
|
50 |
2304
abb390101595
#483 Display error message in calculation report for empty historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2250
diff
changeset
|
51 int numTables = dts.size(); |
abb390101595
#483 Display error message in calculation report for empty historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2250
diff
changeset
|
52 |
abb390101595
#483 Display error message in calculation report for empty historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2250
diff
changeset
|
53 logger.debug("Take " + numTables + " into account."); |
abb390101595
#483 Display error message in calculation report for empty historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2250
diff
changeset
|
54 |
abb390101595
#483 Display error message in calculation report for empty historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2250
diff
changeset
|
55 if (numTables == 0) { |
abb390101595
#483 Display error message in calculation report for empty historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2250
diff
changeset
|
56 addProblem("cannot.find.hist.q.tables"); |
abb390101595
#483 Display error message in calculation report for empty historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2250
diff
changeset
|
57 } |
2228
4db19a88bddb
Implemented the first step of Calculation6; create Facets for each calculation results.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2219
diff
changeset
|
58 |
4241
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
59 WQTimerange[] wqt = prepareTimerangeData(refTable, dts); |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
60 WQKms[] wqs = prepareWQData(dts); |
2228
4db19a88bddb
Implemented the first step of Calculation6; create Facets for each calculation results.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2219
diff
changeset
|
61 |
2250
40608c82e9cb
Bugfix: create a report facet for historical discharge curves even if no data has been computed.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2244
diff
changeset
|
62 logger.debug("Number of calculation results: " + wqt.length); |
40608c82e9cb
Bugfix: create a report facet for historical discharge curves even if no data has been computed.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2244
diff
changeset
|
63 |
4241
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
64 return new CalculationResult(new HistoricalDischargeData(wqt, wqs), |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
65 this); |
2215
ebbb18ed78c4
Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
66 } |
2219
4b6e9b377a84
Fetch parameters for 'historical discharge curve' calculation; call Calculation6 with those information and check input parameters.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2215
diff
changeset
|
67 |
4b6e9b377a84
Fetch parameters for 'historical discharge curve' calculation; call Calculation6 with those information and check input parameters.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2215
diff
changeset
|
68 protected boolean checkParameters() { |
4b6e9b377a84
Fetch parameters for 'historical discharge curve' calculation; call Calculation6 with those information and check input parameters.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2215
diff
changeset
|
69 if (!(mode == MODE_W || mode == MODE_Q)) { |
4b6e9b377a84
Fetch parameters for 'historical discharge curve' calculation; call Calculation6 with those information and check input parameters.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2215
diff
changeset
|
70 logger.warn("Invalid mode '" + mode + "' for calculation."); |
4b6e9b377a84
Fetch parameters for 'historical discharge curve' calculation; call Calculation6 with those information and check input parameters.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2215
diff
changeset
|
71 return false; |
4b6e9b377a84
Fetch parameters for 'historical discharge curve' calculation; call Calculation6 with those information and check input parameters.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2215
diff
changeset
|
72 } |
4b6e9b377a84
Fetch parameters for 'historical discharge curve' calculation; call Calculation6 with those information and check input parameters.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2215
diff
changeset
|
73 |
4b6e9b377a84
Fetch parameters for 'historical discharge curve' calculation; call Calculation6 with those information and check input parameters.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2215
diff
changeset
|
74 if (timerange == null || timerange.length < 2) { |
4b6e9b377a84
Fetch parameters for 'historical discharge curve' calculation; call Calculation6 with those information and check input parameters.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2215
diff
changeset
|
75 logger.warn("Invalid timerange for calculation."); |
4b6e9b377a84
Fetch parameters for 'historical discharge curve' calculation; call Calculation6 with those information and check input parameters.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2215
diff
changeset
|
76 return false; |
4b6e9b377a84
Fetch parameters for 'historical discharge curve' calculation; call Calculation6 with those information and check input parameters.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2215
diff
changeset
|
77 } |
4b6e9b377a84
Fetch parameters for 'historical discharge curve' calculation; call Calculation6 with those information and check input parameters.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2215
diff
changeset
|
78 |
4b6e9b377a84
Fetch parameters for 'historical discharge curve' calculation; call Calculation6 with those information and check input parameters.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2215
diff
changeset
|
79 if (values == null || values.length == 0) { |
4b6e9b377a84
Fetch parameters for 'historical discharge curve' calculation; call Calculation6 with those information and check input parameters.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2215
diff
changeset
|
80 logger.warn("No values for W or Q specified."); |
4b6e9b377a84
Fetch parameters for 'historical discharge curve' calculation; call Calculation6 with those information and check input parameters.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2215
diff
changeset
|
81 return false; |
4b6e9b377a84
Fetch parameters for 'historical discharge curve' calculation; call Calculation6 with those information and check input parameters.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2215
diff
changeset
|
82 } |
4b6e9b377a84
Fetch parameters for 'historical discharge curve' calculation; call Calculation6 with those information and check input parameters.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2215
diff
changeset
|
83 |
4b6e9b377a84
Fetch parameters for 'historical discharge curve' calculation; call Calculation6 with those information and check input parameters.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2215
diff
changeset
|
84 return true; |
4b6e9b377a84
Fetch parameters for 'historical discharge curve' calculation; call Calculation6 with those information and check input parameters.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2215
diff
changeset
|
85 } |
4b6e9b377a84
Fetch parameters for 'historical discharge curve' calculation; call Calculation6 with those information and check input parameters.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2215
diff
changeset
|
86 |
2311
b8df8d1476ba
Compute differences between discharge table values and reference discharge table values in historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2304
diff
changeset
|
87 protected DischargeTable fetchReferenceTable(Gauge gauge) { |
b8df8d1476ba
Compute differences between discharge table values and reference discharge table values in historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2304
diff
changeset
|
88 return gauge.fetchMasterDischargeTable(); |
b8df8d1476ba
Compute differences between discharge table values and reference discharge table values in historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2304
diff
changeset
|
89 } |
b8df8d1476ba
Compute differences between discharge table values and reference discharge table values in historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2304
diff
changeset
|
90 |
2228
4db19a88bddb
Implemented the first step of Calculation6; create Facets for each calculation results.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2219
diff
changeset
|
91 protected List<DischargeTable> fetchDischargeTables(Gauge gauge) { |
4db19a88bddb
Implemented the first step of Calculation6; create Facets for each calculation results.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2219
diff
changeset
|
92 List<DischargeTable> relevant = new ArrayList<DischargeTable>(); |
4232
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4138
diff
changeset
|
93 List<DischargeTable> all = gauge.getDischargeTables(); |
2228
4db19a88bddb
Implemented the first step of Calculation6; create Facets for each calculation results.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2219
diff
changeset
|
94 |
4232
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4138
diff
changeset
|
95 for (DischargeTable dt : all) { |
2228
4db19a88bddb
Implemented the first step of Calculation6; create Facets for each calculation results.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2219
diff
changeset
|
96 if (isDischargeTableRelevant(dt)) { |
4db19a88bddb
Implemented the first step of Calculation6; create Facets for each calculation results.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2219
diff
changeset
|
97 relevant.add(dt); |
4db19a88bddb
Implemented the first step of Calculation6; create Facets for each calculation results.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2219
diff
changeset
|
98 } |
4db19a88bddb
Implemented the first step of Calculation6; create Facets for each calculation results.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2219
diff
changeset
|
99 } |
4db19a88bddb
Implemented the first step of Calculation6; create Facets for each calculation results.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2219
diff
changeset
|
100 |
4db19a88bddb
Implemented the first step of Calculation6; create Facets for each calculation results.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2219
diff
changeset
|
101 return relevant; |
4db19a88bddb
Implemented the first step of Calculation6; create Facets for each calculation results.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2219
diff
changeset
|
102 } |
4db19a88bddb
Implemented the first step of Calculation6; create Facets for each calculation results.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2219
diff
changeset
|
103 |
4db19a88bddb
Implemented the first step of Calculation6; create Facets for each calculation results.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2219
diff
changeset
|
104 protected boolean isDischargeTableRelevant(DischargeTable dt) { |
4db19a88bddb
Implemented the first step of Calculation6; create Facets for each calculation results.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2219
diff
changeset
|
105 TimeInterval ti = dt.getTimeInterval(); |
4db19a88bddb
Implemented the first step of Calculation6; create Facets for each calculation results.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2219
diff
changeset
|
106 |
2598
e96bf6c47c12
Improved selecting discharge tables for historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2418
diff
changeset
|
107 if (dt.getKind() == Gauge.MASTER_DISCHARGE_TABLE || ti == null) { |
2315
c0dfa36add96
Some bugfixes and improvements in the calculation of historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2311
diff
changeset
|
108 return false; |
c0dfa36add96
Some bugfixes and improvements in the calculation of historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2311
diff
changeset
|
109 } |
c0dfa36add96
Some bugfixes and improvements in the calculation of historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2311
diff
changeset
|
110 |
4232
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4138
diff
changeset
|
111 Date start = ti.getStartTime(); |
2228
4db19a88bddb
Implemented the first step of Calculation6; create Facets for each calculation results.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2219
diff
changeset
|
112 long startTime = start.getTime(); |
4db19a88bddb
Implemented the first step of Calculation6; create Facets for each calculation results.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2219
diff
changeset
|
113 |
4db19a88bddb
Implemented the first step of Calculation6; create Facets for each calculation results.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2219
diff
changeset
|
114 if (startTime >= timerange[0] && startTime <= timerange[1]) { |
4db19a88bddb
Implemented the first step of Calculation6; create Facets for each calculation results.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2219
diff
changeset
|
115 return true; |
4db19a88bddb
Implemented the first step of Calculation6; create Facets for each calculation results.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2219
diff
changeset
|
116 } |
4db19a88bddb
Implemented the first step of Calculation6; create Facets for each calculation results.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2219
diff
changeset
|
117 |
4232
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4138
diff
changeset
|
118 Date stop = ti.getStopTime(); |
2228
4db19a88bddb
Implemented the first step of Calculation6; create Facets for each calculation results.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2219
diff
changeset
|
119 long stopTime = stop != null ? stop.getTime() : -1l; |
4db19a88bddb
Implemented the first step of Calculation6; create Facets for each calculation results.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2219
diff
changeset
|
120 |
4db19a88bddb
Implemented the first step of Calculation6; create Facets for each calculation results.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2219
diff
changeset
|
121 if (stopTime >= timerange[0] && stopTime <= timerange[1]) { |
4db19a88bddb
Implemented the first step of Calculation6; create Facets for each calculation results.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2219
diff
changeset
|
122 return true; |
4db19a88bddb
Implemented the first step of Calculation6; create Facets for each calculation results.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2219
diff
changeset
|
123 } |
4db19a88bddb
Implemented the first step of Calculation6; create Facets for each calculation results.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2219
diff
changeset
|
124 |
4db19a88bddb
Implemented the first step of Calculation6; create Facets for each calculation results.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2219
diff
changeset
|
125 logger.debug("DischargeTable not in range: " + start + " -> " + stop); |
4db19a88bddb
Implemented the first step of Calculation6; create Facets for each calculation results.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2219
diff
changeset
|
126 |
4db19a88bddb
Implemented the first step of Calculation6; create Facets for each calculation results.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2219
diff
changeset
|
127 return false; |
4db19a88bddb
Implemented the first step of Calculation6; create Facets for each calculation results.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2219
diff
changeset
|
128 } |
4db19a88bddb
Implemented the first step of Calculation6; create Facets for each calculation results.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2219
diff
changeset
|
129 |
4241
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
130 protected WQTimerange[] prepareTimerangeData(DischargeTable refTable, |
4232
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4138
diff
changeset
|
131 List<DischargeTable> dts) { |
2311
b8df8d1476ba
Compute differences between discharge table values and reference discharge table values in historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2304
diff
changeset
|
132 if (refTable == null) { |
b8df8d1476ba
Compute differences between discharge table values and reference discharge table values in historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2304
diff
changeset
|
133 addProblem("cannot.find.hist.q.reftable"); |
b8df8d1476ba
Compute differences between discharge table values and reference discharge table values in historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2304
diff
changeset
|
134 return prepareSimpleData(dts); |
b8df8d1476ba
Compute differences between discharge table values and reference discharge table values in historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2304
diff
changeset
|
135 } |
b8df8d1476ba
Compute differences between discharge table values and reference discharge table values in historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2304
diff
changeset
|
136 else { |
b8df8d1476ba
Compute differences between discharge table values and reference discharge table values in historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2304
diff
changeset
|
137 return prepareData(refTable, dts); |
b8df8d1476ba
Compute differences between discharge table values and reference discharge table values in historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2304
diff
changeset
|
138 } |
b8df8d1476ba
Compute differences between discharge table values and reference discharge table values in historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2304
diff
changeset
|
139 } |
b8df8d1476ba
Compute differences between discharge table values and reference discharge table values in historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2304
diff
changeset
|
140 |
4241
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
141 protected WQKms[] prepareWQData(List<DischargeTable> dts) { |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
142 WQKms[] wqs = new WQKms[dts.size()]; |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
143 |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
144 int idx = 0; |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
145 |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
146 for (DischargeTable dt : dts) { |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
147 double[][] values = null; |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
148 |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
149 if (dt.getKind() == DischargeTables.MASTER) { |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
150 values = DischargeTables.loadDischargeTableValues(dt, |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
151 DischargeTables.MASTER_SCALE); |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
152 |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
153 } |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
154 else { |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
155 values = DischargeTables.loadDischargeTableValues(dt, |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
156 DischargeTables.HISTORICAL_SCALE); |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
157 |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
158 } |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
159 |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
160 wqs[idx++] = prepareWQ(dt, values); |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
161 } |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
162 |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
163 return wqs; |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
164 } |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
165 |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
166 protected WQKms prepareWQ(DischargeTable dt, double[][] values) { |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
167 double km = dt.getGauge().getStation().doubleValue(); |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
168 |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
169 double[] kms = new double[values[0].length]; |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
170 Arrays.fill(kms, km); |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
171 |
4281
7b6c31390427
Fixed interchanged Ws and Qs in Historical Discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4241
diff
changeset
|
172 return new HistoricalWQKms(kms, values[0], values[1], |
4241
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
173 String.valueOf(km), dt.getTimeInterval()); |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
174 } |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
175 |
2311
b8df8d1476ba
Compute differences between discharge table values and reference discharge table values in historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2304
diff
changeset
|
176 protected WQTimerange[] prepareSimpleData(List<DischargeTable> dts) { |
4232
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4138
diff
changeset
|
177 List<WQTimerange> wqts = new ArrayList<WQTimerange>(values.length); |
2228
4db19a88bddb
Implemented the first step of Calculation6; create Facets for each calculation results.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2219
diff
changeset
|
178 |
4232
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4138
diff
changeset
|
179 for (double value : values) { |
2228
4db19a88bddb
Implemented the first step of Calculation6; create Facets for each calculation results.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2219
diff
changeset
|
180 logger.debug("Prepare data for value: " + value); |
4db19a88bddb
Implemented the first step of Calculation6; create Facets for each calculation results.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2219
diff
changeset
|
181 |
4232
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4138
diff
changeset
|
182 String name = mode == MODE_W ? "W=" + value : "Q=" + value; |
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4138
diff
changeset
|
183 WQTimerange wqt = null; |
2228
4db19a88bddb
Implemented the first step of Calculation6; create Facets for each calculation results.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2219
diff
changeset
|
184 |
4232
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4138
diff
changeset
|
185 for (DischargeTable dt : dts) { |
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4138
diff
changeset
|
186 Date[] ti = prepareTimeInterval(dt); |
2315
c0dfa36add96
Some bugfixes and improvements in the calculation of historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2311
diff
changeset
|
187 Timerange t = new Timerange(ti[0], ti[1]); |
4232
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4138
diff
changeset
|
188 double w; |
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4138
diff
changeset
|
189 double q; |
2228
4db19a88bddb
Implemented the first step of Calculation6; create Facets for each calculation results.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2219
diff
changeset
|
190 |
4db19a88bddb
Implemented the first step of Calculation6; create Facets for each calculation results.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2219
diff
changeset
|
191 if (mode == MODE_W) { |
4db19a88bddb
Implemented the first step of Calculation6; create Facets for each calculation results.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2219
diff
changeset
|
192 w = value; |
4138
1d9c9a3493ea
#904 Use the correct scale to convert discharge table values into [cm].
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4136
diff
changeset
|
193 q = findValueForW(dt, w, DischargeTables.HISTORICAL_SCALE); |
2244
7335c526befd
Added an error report for historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2230
diff
changeset
|
194 |
7335c526befd
Added an error report for historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2230
diff
changeset
|
195 if (Double.isNaN(q)) { |
7335c526befd
Added an error report for historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2230
diff
changeset
|
196 logger.warn("Cannot find Q for W: " + w); |
2315
c0dfa36add96
Some bugfixes and improvements in the calculation of historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2311
diff
changeset
|
197 addProblem("cannot.find.hist.q.for.w", w, ti[0], ti[1]); |
2244
7335c526befd
Added an error report for historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2230
diff
changeset
|
198 continue; |
7335c526befd
Added an error report for historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2230
diff
changeset
|
199 } |
2228
4db19a88bddb
Implemented the first step of Calculation6; create Facets for each calculation results.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2219
diff
changeset
|
200 } |
4db19a88bddb
Implemented the first step of Calculation6; create Facets for each calculation results.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2219
diff
changeset
|
201 else { |
4db19a88bddb
Implemented the first step of Calculation6; create Facets for each calculation results.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2219
diff
changeset
|
202 q = value; |
4232
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4138
diff
changeset
|
203 w = findValueForQ(dt, q, DischargeTables.HISTORICAL_SCALE); |
2228
4db19a88bddb
Implemented the first step of Calculation6; create Facets for each calculation results.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2219
diff
changeset
|
204 } |
4db19a88bddb
Implemented the first step of Calculation6; create Facets for each calculation results.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2219
diff
changeset
|
205 |
2315
c0dfa36add96
Some bugfixes and improvements in the calculation of historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2311
diff
changeset
|
206 logger.debug("Q=" + q + " | W=" + w); |
2230
59af81364eb1
Improved the 'historical discharge' calculation: implemented findValueForW().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2228
diff
changeset
|
207 |
2244
7335c526befd
Added an error report for historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2230
diff
changeset
|
208 if (wqt == null) { |
7335c526befd
Added an error report for historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2230
diff
changeset
|
209 wqt = new WQTimerange(name); |
7335c526befd
Added an error report for historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2230
diff
changeset
|
210 } |
7335c526befd
Added an error report for historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2230
diff
changeset
|
211 |
2228
4db19a88bddb
Implemented the first step of Calculation6; create Facets for each calculation results.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2219
diff
changeset
|
212 wqt.add(w, q, t); |
4db19a88bddb
Implemented the first step of Calculation6; create Facets for each calculation results.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2219
diff
changeset
|
213 } |
4db19a88bddb
Implemented the first step of Calculation6; create Facets for each calculation results.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2219
diff
changeset
|
214 |
2244
7335c526befd
Added an error report for historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2230
diff
changeset
|
215 if (wqt != null) { |
7335c526befd
Added an error report for historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2230
diff
changeset
|
216 wqts.add(wqt); |
7335c526befd
Added an error report for historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2230
diff
changeset
|
217 } |
2228
4db19a88bddb
Implemented the first step of Calculation6; create Facets for each calculation results.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2219
diff
changeset
|
218 } |
4db19a88bddb
Implemented the first step of Calculation6; create Facets for each calculation results.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2219
diff
changeset
|
219 |
3452
200e70f31f6f
Removed some superfluous casts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2598
diff
changeset
|
220 return wqts.toArray(new WQTimerange[wqts.size()]); |
2228
4db19a88bddb
Implemented the first step of Calculation6; create Facets for each calculation results.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2219
diff
changeset
|
221 } |
4db19a88bddb
Implemented the first step of Calculation6; create Facets for each calculation results.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2219
diff
changeset
|
222 |
4232
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4138
diff
changeset
|
223 protected HistoricalWQTimerange[] prepareData(DischargeTable refTable, |
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4138
diff
changeset
|
224 List<DischargeTable> dts) { |
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4138
diff
changeset
|
225 List<HistoricalWQTimerange> wqts = new ArrayList<HistoricalWQTimerange>( |
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4138
diff
changeset
|
226 values.length); |
2228
4db19a88bddb
Implemented the first step of Calculation6; create Facets for each calculation results.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2219
diff
changeset
|
227 |
4232
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4138
diff
changeset
|
228 for (double value : values) { |
2311
b8df8d1476ba
Compute differences between discharge table values and reference discharge table values in historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2304
diff
changeset
|
229 logger.debug("Prepare data plus diff for value: " + value); |
b8df8d1476ba
Compute differences between discharge table values and reference discharge table values in historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2304
diff
changeset
|
230 |
b8df8d1476ba
Compute differences between discharge table values and reference discharge table values in historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2304
diff
changeset
|
231 String name = mode == MODE_W ? "W=" + value : "Q=" + value; |
4232
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4138
diff
changeset
|
232 HistoricalWQTimerange wqt = null; |
2311
b8df8d1476ba
Compute differences between discharge table values and reference discharge table values in historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2304
diff
changeset
|
233 |
b8df8d1476ba
Compute differences between discharge table values and reference discharge table values in historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2304
diff
changeset
|
234 double ref; |
2315
c0dfa36add96
Some bugfixes and improvements in the calculation of historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2311
diff
changeset
|
235 double diff; |
2311
b8df8d1476ba
Compute differences between discharge table values and reference discharge table values in historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2304
diff
changeset
|
236 |
b8df8d1476ba
Compute differences between discharge table values and reference discharge table values in historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2304
diff
changeset
|
237 if (refTable != null && mode == MODE_W) { |
4232
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4138
diff
changeset
|
238 ref = findValueForW(refTable, value, |
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4138
diff
changeset
|
239 DischargeTables.MASTER_SCALE); |
2311
b8df8d1476ba
Compute differences between discharge table values and reference discharge table values in historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2304
diff
changeset
|
240 } |
b8df8d1476ba
Compute differences between discharge table values and reference discharge table values in historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2304
diff
changeset
|
241 else if (refTable != null) { |
4232
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4138
diff
changeset
|
242 ref = findValueForQ(refTable, value, |
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4138
diff
changeset
|
243 DischargeTables.MASTER_SCALE); |
2311
b8df8d1476ba
Compute differences between discharge table values and reference discharge table values in historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2304
diff
changeset
|
244 } |
b8df8d1476ba
Compute differences between discharge table values and reference discharge table values in historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2304
diff
changeset
|
245 else { |
b8df8d1476ba
Compute differences between discharge table values and reference discharge table values in historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2304
diff
changeset
|
246 ref = Double.NaN; |
b8df8d1476ba
Compute differences between discharge table values and reference discharge table values in historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2304
diff
changeset
|
247 } |
b8df8d1476ba
Compute differences between discharge table values and reference discharge table values in historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2304
diff
changeset
|
248 |
4232
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4138
diff
changeset
|
249 for (DischargeTable dt : dts) { |
2315
c0dfa36add96
Some bugfixes and improvements in the calculation of historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2311
diff
changeset
|
250 Date[] ti = prepareTimeInterval(dt); |
2311
b8df8d1476ba
Compute differences between discharge table values and reference discharge table values in historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2304
diff
changeset
|
251 |
4232
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4138
diff
changeset
|
252 Timerange t = new Timerange(ti[0], ti[1]); |
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4138
diff
changeset
|
253 double w; |
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4138
diff
changeset
|
254 double q; |
2311
b8df8d1476ba
Compute differences between discharge table values and reference discharge table values in historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2304
diff
changeset
|
255 |
b8df8d1476ba
Compute differences between discharge table values and reference discharge table values in historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2304
diff
changeset
|
256 if (mode == MODE_W) { |
4232
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4138
diff
changeset
|
257 w = value; |
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4138
diff
changeset
|
258 q = findValueForW(dt, w, DischargeTables.HISTORICAL_SCALE); |
2311
b8df8d1476ba
Compute differences between discharge table values and reference discharge table values in historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2304
diff
changeset
|
259 |
b8df8d1476ba
Compute differences between discharge table values and reference discharge table values in historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2304
diff
changeset
|
260 if (Double.isNaN(q)) { |
b8df8d1476ba
Compute differences between discharge table values and reference discharge table values in historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2304
diff
changeset
|
261 logger.warn("Cannot find Q for W: " + w); |
2315
c0dfa36add96
Some bugfixes and improvements in the calculation of historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2311
diff
changeset
|
262 addProblem("cannot.find.hist.q.for.w", w, ti[0], ti[1]); |
2311
b8df8d1476ba
Compute differences between discharge table values and reference discharge table values in historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2304
diff
changeset
|
263 continue; |
b8df8d1476ba
Compute differences between discharge table values and reference discharge table values in historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2304
diff
changeset
|
264 } |
2315
c0dfa36add96
Some bugfixes and improvements in the calculation of historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2311
diff
changeset
|
265 |
4232
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4138
diff
changeset
|
266 diff = ref - q; |
2311
b8df8d1476ba
Compute differences between discharge table values and reference discharge table values in historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2304
diff
changeset
|
267 } |
b8df8d1476ba
Compute differences between discharge table values and reference discharge table values in historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2304
diff
changeset
|
268 else { |
4232
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4138
diff
changeset
|
269 q = value; |
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4138
diff
changeset
|
270 w = findValueForQ(dt, q, DischargeTables.HISTORICAL_SCALE); |
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4138
diff
changeset
|
271 |
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4138
diff
changeset
|
272 if (Double.isNaN(w)) { |
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4138
diff
changeset
|
273 logger.warn("Cannot find W for Q: " + q); |
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4138
diff
changeset
|
274 addProblem("cannot.find.hist.w.for.q", q, ti[0], ti[1]); |
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4138
diff
changeset
|
275 continue; |
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4138
diff
changeset
|
276 } |
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4138
diff
changeset
|
277 diff = ref - w; |
2311
b8df8d1476ba
Compute differences between discharge table values and reference discharge table values in historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2304
diff
changeset
|
278 } |
b8df8d1476ba
Compute differences between discharge table values and reference discharge table values in historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2304
diff
changeset
|
279 |
2315
c0dfa36add96
Some bugfixes and improvements in the calculation of historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2311
diff
changeset
|
280 logger.debug("Q=" + q + " | W=" + w + " | Ref = " + ref); |
2311
b8df8d1476ba
Compute differences between discharge table values and reference discharge table values in historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2304
diff
changeset
|
281 |
b8df8d1476ba
Compute differences between discharge table values and reference discharge table values in historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2304
diff
changeset
|
282 if (wqt == null) { |
b8df8d1476ba
Compute differences between discharge table values and reference discharge table values in historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2304
diff
changeset
|
283 wqt = new HistoricalWQTimerange(name); |
b8df8d1476ba
Compute differences between discharge table values and reference discharge table values in historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2304
diff
changeset
|
284 } |
b8df8d1476ba
Compute differences between discharge table values and reference discharge table values in historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2304
diff
changeset
|
285 |
2315
c0dfa36add96
Some bugfixes and improvements in the calculation of historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2311
diff
changeset
|
286 wqt.add(w, q, diff, t); |
2311
b8df8d1476ba
Compute differences between discharge table values and reference discharge table values in historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2304
diff
changeset
|
287 } |
b8df8d1476ba
Compute differences between discharge table values and reference discharge table values in historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2304
diff
changeset
|
288 |
b8df8d1476ba
Compute differences between discharge table values and reference discharge table values in historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2304
diff
changeset
|
289 if (wqt != null) { |
b8df8d1476ba
Compute differences between discharge table values and reference discharge table values in historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2304
diff
changeset
|
290 wqts.add(wqt); |
b8df8d1476ba
Compute differences between discharge table values and reference discharge table values in historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2304
diff
changeset
|
291 } |
b8df8d1476ba
Compute differences between discharge table values and reference discharge table values in historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2304
diff
changeset
|
292 } |
b8df8d1476ba
Compute differences between discharge table values and reference discharge table values in historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2304
diff
changeset
|
293 |
4232
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4138
diff
changeset
|
294 return (HistoricalWQTimerange[]) wqts |
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4138
diff
changeset
|
295 .toArray(new HistoricalWQTimerange[wqts.size()]); |
2311
b8df8d1476ba
Compute differences between discharge table values and reference discharge table values in historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2304
diff
changeset
|
296 } |
b8df8d1476ba
Compute differences between discharge table values and reference discharge table values in historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2304
diff
changeset
|
297 |
2315
c0dfa36add96
Some bugfixes and improvements in the calculation of historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2311
diff
changeset
|
298 protected Date[] prepareTimeInterval(DischargeTable dt) { |
c0dfa36add96
Some bugfixes and improvements in the calculation of historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2311
diff
changeset
|
299 TimeInterval ti = dt.getTimeInterval(); |
c0dfa36add96
Some bugfixes and improvements in the calculation of historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2311
diff
changeset
|
300 |
c0dfa36add96
Some bugfixes and improvements in the calculation of historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2311
diff
changeset
|
301 Date start = ti.getStartTime(); |
4232
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4138
diff
changeset
|
302 Date end = ti.getStopTime(); |
2315
c0dfa36add96
Some bugfixes and improvements in the calculation of historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2311
diff
changeset
|
303 |
c0dfa36add96
Some bugfixes and improvements in the calculation of historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2311
diff
changeset
|
304 if (end == null) { |
c0dfa36add96
Some bugfixes and improvements in the calculation of historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2311
diff
changeset
|
305 logger.warn("TimeInterval has no stop time set!"); |
c0dfa36add96
Some bugfixes and improvements in the calculation of historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2311
diff
changeset
|
306 |
c0dfa36add96
Some bugfixes and improvements in the calculation of historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2311
diff
changeset
|
307 end = new Date(); |
c0dfa36add96
Some bugfixes and improvements in the calculation of historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2311
diff
changeset
|
308 } |
c0dfa36add96
Some bugfixes and improvements in the calculation of historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2311
diff
changeset
|
309 |
c0dfa36add96
Some bugfixes and improvements in the calculation of historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2311
diff
changeset
|
310 return new Date[] { start, end }; |
c0dfa36add96
Some bugfixes and improvements in the calculation of historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2311
diff
changeset
|
311 } |
c0dfa36add96
Some bugfixes and improvements in the calculation of historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2311
diff
changeset
|
312 |
4138
1d9c9a3493ea
#904 Use the correct scale to convert discharge table values into [cm].
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4136
diff
changeset
|
313 protected double findValueForW(DischargeTable dt, double w, double scale) { |
1d9c9a3493ea
#904 Use the correct scale to convert discharge table values into [cm].
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4136
diff
changeset
|
314 double[][] vs = DischargeTables.loadDischargeTableValues(dt, scale); |
4232
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4138
diff
changeset
|
315 double[] qs = DischargeTables.getQsForW(vs, w); |
2418
899ca89f497e
Another partial fix for flys/issue499: Do the W to Q conversions
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2315
diff
changeset
|
316 return qs.length == 0 ? Double.NaN : qs[0]; |
2228
4db19a88bddb
Implemented the first step of Calculation6; create Facets for each calculation results.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2219
diff
changeset
|
317 } |
4db19a88bddb
Implemented the first step of Calculation6; create Facets for each calculation results.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2219
diff
changeset
|
318 |
4232
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4138
diff
changeset
|
319 protected double findValueForQ(DischargeTable dt, double q, double scale) { |
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4138
diff
changeset
|
320 double[][] vs = DischargeTables.loadDischargeTableValues(dt, scale); |
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4138
diff
changeset
|
321 double[] ws = DischargeTables.getWsForQ(vs, q); |
2228
4db19a88bddb
Implemented the first step of Calculation6; create Facets for each calculation results.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2219
diff
changeset
|
322 |
4232
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4138
diff
changeset
|
323 return ws.length == 0 ? Double.NaN : ws[0]; |
2228
4db19a88bddb
Implemented the first step of Calculation6; create Facets for each calculation results.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2219
diff
changeset
|
324 } |
4db19a88bddb
Implemented the first step of Calculation6; create Facets for each calculation results.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2219
diff
changeset
|
325 |
2219
4b6e9b377a84
Fetch parameters for 'historical discharge curve' calculation; call Calculation6 with those information and check input parameters.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2215
diff
changeset
|
326 /** |
4b6e9b377a84
Fetch parameters for 'historical discharge curve' calculation; call Calculation6 with those information and check input parameters.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2215
diff
changeset
|
327 * Writes the parameters used for this calculation to logger. |
4b6e9b377a84
Fetch parameters for 'historical discharge curve' calculation; call Calculation6 with those information and check input parameters.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2215
diff
changeset
|
328 */ |
4b6e9b377a84
Fetch parameters for 'historical discharge curve' calculation; call Calculation6 with those information and check input parameters.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2215
diff
changeset
|
329 public void debug() { |
4b6e9b377a84
Fetch parameters for 'historical discharge curve' calculation; call Calculation6 with those information and check input parameters.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2215
diff
changeset
|
330 StringBuilder sb = new StringBuilder(); |
4232
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4138
diff
changeset
|
331 for (double value : values) { |
2219
4b6e9b377a84
Fetch parameters for 'historical discharge curve' calculation; call Calculation6 with those information and check input parameters.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2215
diff
changeset
|
332 sb.append(String.valueOf(value) + " "); |
4b6e9b377a84
Fetch parameters for 'historical discharge curve' calculation; call Calculation6 with those information and check input parameters.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2215
diff
changeset
|
333 } |
4b6e9b377a84
Fetch parameters for 'historical discharge curve' calculation; call Calculation6 with those information and check input parameters.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2215
diff
changeset
|
334 |
4b6e9b377a84
Fetch parameters for 'historical discharge curve' calculation; call Calculation6 with those information and check input parameters.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2215
diff
changeset
|
335 logger.debug("========== Calculation6 =========="); |
4b6e9b377a84
Fetch parameters for 'historical discharge curve' calculation; call Calculation6 with those information and check input parameters.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2215
diff
changeset
|
336 logger.debug(" Mode: " + mode); |
4b6e9b377a84
Fetch parameters for 'historical discharge curve' calculation; call Calculation6 with those information and check input parameters.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2215
diff
changeset
|
337 logger.debug(" Timerange: " + timerange[0] + " - " + timerange[1]); |
4b6e9b377a84
Fetch parameters for 'historical discharge curve' calculation; call Calculation6 with those information and check input parameters.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2215
diff
changeset
|
338 logger.debug(" Input values: " + sb.toString()); |
4b6e9b377a84
Fetch parameters for 'historical discharge curve' calculation; call Calculation6 with those information and check input parameters.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2215
diff
changeset
|
339 logger.debug("=================================="); |
4b6e9b377a84
Fetch parameters for 'historical discharge curve' calculation; call Calculation6 with those information and check input parameters.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2215
diff
changeset
|
340 } |
2215
ebbb18ed78c4
Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
341 } |
ebbb18ed78c4
Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
342 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |