Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/Calculation6.java @ 5659:47c07faf388a
configured zoom-scale for river Rhein
author | Tom Gottfried <tom@intevation.de> |
---|---|
date | Thu, 11 Apr 2013 16:39:29 +0200 |
parents | 1b73b731f7bd |
children |
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 /** |
5339
1b73b731f7bd
Doc, debug fix.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4281
diff
changeset
|
16 * Historical Discharge Calculation. |
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
|
17 * @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
|
18 */ |
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 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
|
20 |
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 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
|
22 |
4232
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4138
diff
changeset
|
23 private int mode; |
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4138
diff
changeset
|
24 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
|
25 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
|
26 |
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
|
27 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
|
28 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
|
29 |
4136
b6ba9bbb5122
#548 Fetch historical discharge table values with SCALE=1.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3452
diff
changeset
|
30 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
|
31 |
2228
4db19a88bddb
Implemented the first step of Calculation6; create Facets for each calculation results.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2219
diff
changeset
|
32 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
|
33 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
|
34 this.timerange = timerange; |
4232
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4138
diff
changeset
|
35 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
|
36 } |
ebbb18ed78c4
Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
37 |
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
|
38 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
|
39 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
|
40 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
|
41 |
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 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
|
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 |
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 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
|
46 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
|
47 } |
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
|
48 |
4232
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4138
diff
changeset
|
49 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
|
50 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
|
51 |
2304
abb390101595
#483 Display error message in calculation report for empty historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2250
diff
changeset
|
52 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
|
53 |
abb390101595
#483 Display error message in calculation report for empty historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2250
diff
changeset
|
54 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
|
55 |
abb390101595
#483 Display error message in calculation report for empty historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2250
diff
changeset
|
56 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
|
57 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
|
58 } |
2228
4db19a88bddb
Implemented the first step of Calculation6; create Facets for each calculation results.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2219
diff
changeset
|
59 |
4241
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
60 WQTimerange[] wqt = prepareTimerangeData(refTable, dts); |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
61 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
|
62 |
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
|
63 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
|
64 |
4241
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
65 return new CalculationResult(new HistoricalDischargeData(wqt, wqs), |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
66 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
|
67 } |
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
|
68 |
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 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
|
70 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
|
71 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
|
72 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
|
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 |
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 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
|
76 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
|
77 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
|
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 |
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 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
|
81 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
|
82 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
|
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 |
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 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
|
86 } |
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
|
87 |
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
|
88 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
|
89 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
|
90 } |
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
|
91 |
2228
4db19a88bddb
Implemented the first step of Calculation6; create Facets for each calculation results.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2219
diff
changeset
|
92 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
|
93 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
|
94 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
|
95 |
4232
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4138
diff
changeset
|
96 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
|
97 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
|
98 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
|
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 |
4db19a88bddb
Implemented the first step of Calculation6; create Facets for each calculation results.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2219
diff
changeset
|
102 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
|
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 |
5339
1b73b731f7bd
Doc, debug fix.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4281
diff
changeset
|
105 /** True if timerange of given discharge table overlaps with timerange. */ |
2228
4db19a88bddb
Implemented the first step of Calculation6; create Facets for each calculation results.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2219
diff
changeset
|
106 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
|
107 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
|
108 |
2598
e96bf6c47c12
Improved selecting discharge tables for historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2418
diff
changeset
|
109 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
|
110 return false; |
c0dfa36add96
Some bugfixes and improvements in the calculation of historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2311
diff
changeset
|
111 } |
c0dfa36add96
Some bugfixes and improvements in the calculation of historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2311
diff
changeset
|
112 |
4232
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4138
diff
changeset
|
113 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
|
114 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
|
115 |
4db19a88bddb
Implemented the first step of Calculation6; create Facets for each calculation results.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2219
diff
changeset
|
116 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
|
117 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
|
118 } |
4db19a88bddb
Implemented the first step of Calculation6; create Facets for each calculation results.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2219
diff
changeset
|
119 |
4232
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4138
diff
changeset
|
120 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
|
121 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
|
122 |
4db19a88bddb
Implemented the first step of Calculation6; create Facets for each calculation results.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2219
diff
changeset
|
123 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
|
124 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
|
125 } |
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 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
|
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 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
|
130 } |
4db19a88bddb
Implemented the first step of Calculation6; create Facets for each calculation results.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2219
diff
changeset
|
131 |
4241
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
132 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
|
133 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
|
134 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
|
135 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
|
136 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
|
137 } |
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 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
|
139 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
|
140 } |
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
|
141 } |
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
|
142 |
4241
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
143 protected WQKms[] prepareWQData(List<DischargeTable> dts) { |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
144 WQKms[] wqs = new WQKms[dts.size()]; |
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 int idx = 0; |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
147 |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
148 for (DischargeTable dt : dts) { |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
149 double[][] values = null; |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
150 |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
151 if (dt.getKind() == DischargeTables.MASTER) { |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
152 values = DischargeTables.loadDischargeTableValues(dt, |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
153 DischargeTables.MASTER_SCALE); |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
154 |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
155 } |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
156 else { |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
157 values = DischargeTables.loadDischargeTableValues(dt, |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
158 DischargeTables.HISTORICAL_SCALE); |
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 } |
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 wqs[idx++] = prepareWQ(dt, values); |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
163 } |
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 return wqs; |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
166 } |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
167 |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
168 protected WQKms prepareWQ(DischargeTable dt, double[][] values) { |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
169 double km = dt.getGauge().getStation().doubleValue(); |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
170 |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
171 double[] kms = new double[values[0].length]; |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
172 Arrays.fill(kms, km); |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
173 |
4281
7b6c31390427
Fixed interchanged Ws and Qs in Historical Discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4241
diff
changeset
|
174 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
|
175 String.valueOf(km), dt.getTimeInterval()); |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
176 } |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
177 |
5339
1b73b731f7bd
Doc, debug fix.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4281
diff
changeset
|
178 /** Without reference. */ |
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
|
179 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
|
180 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
|
181 |
4232
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4138
diff
changeset
|
182 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
|
183 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
|
184 |
4232
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4138
diff
changeset
|
185 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
|
186 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
|
187 |
4232
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4138
diff
changeset
|
188 for (DischargeTable dt : dts) { |
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4138
diff
changeset
|
189 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
|
190 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
|
191 double w; |
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4138
diff
changeset
|
192 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
|
193 |
4db19a88bddb
Implemented the first step of Calculation6; create Facets for each calculation results.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2219
diff
changeset
|
194 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
|
195 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
|
196 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
|
197 |
7335c526befd
Added an error report for historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2230
diff
changeset
|
198 if (Double.isNaN(q)) { |
7335c526befd
Added an error report for historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2230
diff
changeset
|
199 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
|
200 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
|
201 continue; |
7335c526befd
Added an error report for historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2230
diff
changeset
|
202 } |
2228
4db19a88bddb
Implemented the first step of Calculation6; create Facets for each calculation results.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2219
diff
changeset
|
203 } |
4db19a88bddb
Implemented the first step of Calculation6; create Facets for each calculation results.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2219
diff
changeset
|
204 else { |
4db19a88bddb
Implemented the first step of Calculation6; create Facets for each calculation results.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2219
diff
changeset
|
205 q = value; |
4232
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4138
diff
changeset
|
206 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
|
207 } |
4db19a88bddb
Implemented the first step of Calculation6; create Facets for each calculation results.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2219
diff
changeset
|
208 |
2315
c0dfa36add96
Some bugfixes and improvements in the calculation of historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2311
diff
changeset
|
209 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
|
210 |
2244
7335c526befd
Added an error report for historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2230
diff
changeset
|
211 if (wqt == null) { |
7335c526befd
Added an error report for historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2230
diff
changeset
|
212 wqt = new WQTimerange(name); |
7335c526befd
Added an error report for historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2230
diff
changeset
|
213 } |
7335c526befd
Added an error report for historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2230
diff
changeset
|
214 |
2228
4db19a88bddb
Implemented the first step of Calculation6; create Facets for each calculation results.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2219
diff
changeset
|
215 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
|
216 } |
4db19a88bddb
Implemented the first step of Calculation6; create Facets for each calculation results.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2219
diff
changeset
|
217 |
2244
7335c526befd
Added an error report for historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2230
diff
changeset
|
218 if (wqt != null) { |
7335c526befd
Added an error report for historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2230
diff
changeset
|
219 wqts.add(wqt); |
7335c526befd
Added an error report for historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2230
diff
changeset
|
220 } |
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 |
3452
200e70f31f6f
Removed some superfluous casts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2598
diff
changeset
|
223 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
|
224 } |
4db19a88bddb
Implemented the first step of Calculation6; create Facets for each calculation results.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2219
diff
changeset
|
225 |
5339
1b73b731f7bd
Doc, debug fix.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4281
diff
changeset
|
226 /** With reference. */ |
4232
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4138
diff
changeset
|
227 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
|
228 List<DischargeTable> dts) { |
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4138
diff
changeset
|
229 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
|
230 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
|
231 |
4232
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4138
diff
changeset
|
232 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
|
233 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
|
234 |
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
|
235 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
|
236 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
|
237 |
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
|
238 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
|
239 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
|
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 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
|
242 ref = findValueForW(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 if (refTable != null) { |
4232
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4138
diff
changeset
|
246 ref = findValueForQ(refTable, value, |
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4138
diff
changeset
|
247 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
|
248 } |
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
|
249 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
|
250 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
|
251 } |
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
|
252 |
4232
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4138
diff
changeset
|
253 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
|
254 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
|
255 |
4232
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4138
diff
changeset
|
256 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
|
257 double w; |
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4138
diff
changeset
|
258 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
|
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 (mode == MODE_W) { |
4232
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4138
diff
changeset
|
261 w = value; |
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4138
diff
changeset
|
262 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
|
263 |
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 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
|
265 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
|
266 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
|
267 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
|
268 } |
2315
c0dfa36add96
Some bugfixes and improvements in the calculation of historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2311
diff
changeset
|
269 |
4232
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4138
diff
changeset
|
270 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
|
271 } |
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
|
272 else { |
4232
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4138
diff
changeset
|
273 q = value; |
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4138
diff
changeset
|
274 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
|
275 |
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4138
diff
changeset
|
276 if (Double.isNaN(w)) { |
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4138
diff
changeset
|
277 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
|
278 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
|
279 continue; |
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4138
diff
changeset
|
280 } |
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4138
diff
changeset
|
281 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
|
282 } |
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 |
2315
c0dfa36add96
Some bugfixes and improvements in the calculation of historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2311
diff
changeset
|
284 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
|
285 |
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
|
286 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
|
287 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
|
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 |
2315
c0dfa36add96
Some bugfixes and improvements in the calculation of historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2311
diff
changeset
|
290 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
|
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 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
|
294 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
|
295 } |
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 |
4232
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4138
diff
changeset
|
298 return (HistoricalWQTimerange[]) wqts |
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4138
diff
changeset
|
299 .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
|
300 } |
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
|
301 |
5339
1b73b731f7bd
Doc, debug fix.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4281
diff
changeset
|
302 /** Returns discharge table interval as Date[]. */ |
2315
c0dfa36add96
Some bugfixes and improvements in the calculation of historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2311
diff
changeset
|
303 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
|
304 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
|
305 |
c0dfa36add96
Some bugfixes and improvements in the calculation of historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2311
diff
changeset
|
306 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
|
307 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
|
308 |
c0dfa36add96
Some bugfixes and improvements in the calculation of historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2311
diff
changeset
|
309 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
|
310 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
|
311 |
c0dfa36add96
Some bugfixes and improvements in the calculation of historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2311
diff
changeset
|
312 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
|
313 } |
c0dfa36add96
Some bugfixes and improvements in the calculation of historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2311
diff
changeset
|
314 |
c0dfa36add96
Some bugfixes and improvements in the calculation of historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2311
diff
changeset
|
315 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
|
316 } |
c0dfa36add96
Some bugfixes and improvements in the calculation of historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2311
diff
changeset
|
317 |
4138
1d9c9a3493ea
#904 Use the correct scale to convert discharge table values into [cm].
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4136
diff
changeset
|
318 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
|
319 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
|
320 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
|
321 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
|
322 } |
4db19a88bddb
Implemented the first step of Calculation6; create Facets for each calculation results.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2219
diff
changeset
|
323 |
4232
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4138
diff
changeset
|
324 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
|
325 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
|
326 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
|
327 |
4232
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4138
diff
changeset
|
328 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
|
329 } |
4db19a88bddb
Implemented the first step of Calculation6; create Facets for each calculation results.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2219
diff
changeset
|
330 |
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
|
331 /** |
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 * 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
|
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 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
|
335 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
|
336 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
|
337 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
|
338 } |
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 |
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 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
|
341 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
|
342 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
|
343 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
|
344 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
|
345 } |
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
|
346 } |
ebbb18ed78c4
Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
347 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |