Mercurial > dive4elements > river
annotate artifacts/src/main/java/org/dive4elements/river/artifacts/model/Calculation6.java @ 5914:1058b3436dad
D4E river artifacts: Removed historical discharge calculation from WINFO artifact and use access instead.
author | Sascha L. Teichmann <teichmann@intevation.de> |
---|---|
date | Tue, 07 May 2013 17:32:33 +0200 |
parents | 4897a58c8746 |
children | 46e85199b667 |
rev | line source |
---|---|
5863
4897a58c8746
River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
1 /* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde |
4897a58c8746
River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
2 * Software engineering by Intevation GmbH |
4897a58c8746
River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
3 * |
4897a58c8746
River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
4 * This file is Free Software under the GNU AGPL (>=v3) |
4897a58c8746
River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
5 * and comes with ABSOLUTELY NO WARRANTY! Check out the |
4897a58c8746
River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
6 * documentation coming with Dive4Elements River for details. |
4897a58c8746
River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
7 */ |
4897a58c8746
River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
8 |
5831
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5339
diff
changeset
|
9 package org.dive4elements.river.artifacts.model; |
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
|
10 |
2228
4db19a88bddb
Implemented the first step of Calculation6; create Facets for each calculation results.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2219
diff
changeset
|
11 import java.util.ArrayList; |
4241
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
12 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
|
13 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
|
14 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
|
15 |
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
|
16 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
|
17 |
5831
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5339
diff
changeset
|
18 import org.dive4elements.river.model.DischargeTable; |
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5339
diff
changeset
|
19 import org.dive4elements.river.model.Gauge; |
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5339
diff
changeset
|
20 import org.dive4elements.river.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
|
21 |
5914
1058b3436dad
D4E river artifacts: Removed historical discharge calculation from WINFO artifact and use access instead.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
22 import org.dive4elements.river.artifacts.access.HistoricalDischargeAccess; |
1058b3436dad
D4E river artifacts: Removed historical discharge calculation from WINFO artifact and use access instead.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
23 import org.dive4elements.river.artifacts.access.HistoricalDischargeAccess.EvaluationMode; |
1058b3436dad
D4E river artifacts: Removed historical discharge calculation from WINFO artifact and use access instead.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
24 |
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 |
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 /** |
5339
1b73b731f7bd
Doc, debug fix.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4281
diff
changeset
|
27 * 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
|
28 * @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
|
29 */ |
ebbb18ed78c4
Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
30 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
|
31 |
5914
1058b3436dad
D4E river artifacts: Removed historical discharge calculation from WINFO artifact and use access instead.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
32 private static final Logger log = Logger.getLogger(Calculation6.class); |
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
|
33 |
5914
1058b3436dad
D4E river artifacts: Removed historical discharge calculation from WINFO artifact and use access instead.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
34 private int mode; |
1058b3436dad
D4E river artifacts: Removed historical discharge calculation from WINFO artifact and use access instead.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
35 private long [] timerange; |
1058b3436dad
D4E river artifacts: Removed historical discharge calculation from WINFO artifact and use access instead.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
36 private double [] values; |
1058b3436dad
D4E river artifacts: Removed historical discharge calculation from WINFO artifact and use access instead.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
37 private Long officialGaugeNumber; |
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
|
38 |
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
|
39 |
4136
b6ba9bbb5122
#548 Fetch historical discharge table values with SCALE=1.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3452
diff
changeset
|
40 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
|
41 |
5914
1058b3436dad
D4E river artifacts: Removed historical discharge calculation from WINFO artifact and use access instead.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
42 public Calculation6(HistoricalDischargeAccess access) { |
1058b3436dad
D4E river artifacts: Removed historical discharge calculation from WINFO artifact and use access instead.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
43 EvaluationMode mode = access.getEvaluationMode(); |
1058b3436dad
D4E river artifacts: Removed historical discharge calculation from WINFO artifact and use access instead.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
44 Timerange tr = access.getEvaluationTimerange(); |
1058b3436dad
D4E river artifacts: Removed historical discharge calculation from WINFO artifact and use access instead.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
45 double [] vs = mode != null && mode == EvaluationMode.W |
1058b3436dad
D4E river artifacts: Removed historical discharge calculation from WINFO artifact and use access instead.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
46 ? access.getWs() |
1058b3436dad
D4E river artifacts: Removed historical discharge calculation from WINFO artifact and use access instead.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
47 : access.getQs(); |
1058b3436dad
D4E river artifacts: Removed historical discharge calculation from WINFO artifact and use access instead.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
48 |
1058b3436dad
D4E river artifacts: Removed historical discharge calculation from WINFO artifact and use access instead.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
49 Long officialGaugeNumber = access.getOfficialGaugeNumber(); |
1058b3436dad
D4E river artifacts: Removed historical discharge calculation from WINFO artifact and use access instead.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
50 |
1058b3436dad
D4E river artifacts: Removed historical discharge calculation from WINFO artifact and use access instead.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
51 if (mode == null) { |
1058b3436dad
D4E river artifacts: Removed historical discharge calculation from WINFO artifact and use access instead.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
52 // TODO: i18n |
1058b3436dad
D4E river artifacts: Removed historical discharge calculation from WINFO artifact and use access instead.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
53 addProblem("hist.discharge.mode.not.set"); |
1058b3436dad
D4E river artifacts: Removed historical discharge calculation from WINFO artifact and use access instead.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
54 } |
1058b3436dad
D4E river artifacts: Removed historical discharge calculation from WINFO artifact and use access instead.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
55 if (tr == null) { |
1058b3436dad
D4E river artifacts: Removed historical discharge calculation from WINFO artifact and use access instead.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
56 // TODO: i18n |
1058b3436dad
D4E river artifacts: Removed historical discharge calculation from WINFO artifact and use access instead.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
57 addProblem("hist.discharge.time.interval.not.set"); |
1058b3436dad
D4E river artifacts: Removed historical discharge calculation from WINFO artifact and use access instead.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
58 } |
1058b3436dad
D4E river artifacts: Removed historical discharge calculation from WINFO artifact and use access instead.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
59 if (vs == null || vs.length == 0) { |
1058b3436dad
D4E river artifacts: Removed historical discharge calculation from WINFO artifact and use access instead.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
60 // TODO: i18n |
1058b3436dad
D4E river artifacts: Removed historical discharge calculation from WINFO artifact and use access instead.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
61 addProblem("hist.discharge.values.not.set"); |
1058b3436dad
D4E river artifacts: Removed historical discharge calculation from WINFO artifact and use access instead.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
62 } |
1058b3436dad
D4E river artifacts: Removed historical discharge calculation from WINFO artifact and use access instead.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
63 |
1058b3436dad
D4E river artifacts: Removed historical discharge calculation from WINFO artifact and use access instead.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
64 if (officialGaugeNumber == null) { |
1058b3436dad
D4E river artifacts: Removed historical discharge calculation from WINFO artifact and use access instead.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
65 // TODO: i18n |
1058b3436dad
D4E river artifacts: Removed historical discharge calculation from WINFO artifact and use access instead.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
66 addProblem("hist.discharge.reference.gauge.not.set"); |
1058b3436dad
D4E river artifacts: Removed historical discharge calculation from WINFO artifact and use access instead.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
67 } |
1058b3436dad
D4E river artifacts: Removed historical discharge calculation from WINFO artifact and use access instead.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
68 |
1058b3436dad
D4E river artifacts: Removed historical discharge calculation from WINFO artifact and use access instead.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
69 if (!hasProblems()) { |
1058b3436dad
D4E river artifacts: Removed historical discharge calculation from WINFO artifact and use access instead.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
70 set( |
1058b3436dad
D4E river artifacts: Removed historical discharge calculation from WINFO artifact and use access instead.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
71 mode.getMode(), |
1058b3436dad
D4E river artifacts: Removed historical discharge calculation from WINFO artifact and use access instead.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
72 new long [] { tr.getStart(), tr.getEnd()}, |
1058b3436dad
D4E river artifacts: Removed historical discharge calculation from WINFO artifact and use access instead.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
73 values, |
1058b3436dad
D4E river artifacts: Removed historical discharge calculation from WINFO artifact and use access instead.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
74 officialGaugeNumber); |
1058b3436dad
D4E river artifacts: Removed historical discharge calculation from WINFO artifact and use access instead.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
75 } |
1058b3436dad
D4E river artifacts: Removed historical discharge calculation from WINFO artifact and use access instead.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
76 } |
1058b3436dad
D4E river artifacts: Removed historical discharge calculation from WINFO artifact and use access instead.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
77 |
1058b3436dad
D4E river artifacts: Removed historical discharge calculation from WINFO artifact and use access instead.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
78 protected void set( |
1058b3436dad
D4E river artifacts: Removed historical discharge calculation from WINFO artifact and use access instead.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
79 int mode, |
1058b3436dad
D4E river artifacts: Removed historical discharge calculation from WINFO artifact and use access instead.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
80 long [] timerange, |
1058b3436dad
D4E river artifacts: Removed historical discharge calculation from WINFO artifact and use access instead.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
81 double [] values, |
1058b3436dad
D4E river artifacts: Removed historical discharge calculation from WINFO artifact and use access instead.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
82 Long officialGaugeNumber |
1058b3436dad
D4E river artifacts: Removed historical discharge calculation from WINFO artifact and use access instead.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
83 ) { |
1058b3436dad
D4E river artifacts: Removed historical discharge calculation from WINFO artifact and use access instead.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
84 this.mode = mode; |
1058b3436dad
D4E river artifacts: Removed historical discharge calculation from WINFO artifact and use access instead.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
85 this.timerange = timerange; |
1058b3436dad
D4E river artifacts: Removed historical discharge calculation from WINFO artifact and use access instead.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
86 this.values = values; |
1058b3436dad
D4E river artifacts: Removed historical discharge calculation from WINFO artifact and use access instead.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
87 this.officialGaugeNumber = officialGaugeNumber; |
1058b3436dad
D4E river artifacts: Removed historical discharge calculation from WINFO artifact and use access instead.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
88 } |
1058b3436dad
D4E river artifacts: Removed historical discharge calculation from WINFO artifact and use access instead.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
89 |
2228
4db19a88bddb
Implemented the first step of Calculation6; create Facets for each calculation results.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2219
diff
changeset
|
90 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
|
91 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
|
92 this.timerange = timerange; |
4232
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4138
diff
changeset
|
93 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
|
94 } |
ebbb18ed78c4
Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
95 |
5914
1058b3436dad
D4E river artifacts: Removed historical discharge calculation from WINFO artifact and use access instead.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
96 public CalculationResult calculate() { |
1058b3436dad
D4E river artifacts: Removed historical discharge calculation from WINFO artifact and use access instead.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
97 if (hasProblems()) { |
1058b3436dad
D4E river artifacts: Removed historical discharge calculation from WINFO artifact and use access instead.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
98 log.warn("Parameters not valid for calculation."); |
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
|
99 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
|
100 } |
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
|
101 |
5914
1058b3436dad
D4E river artifacts: Removed historical discharge calculation from WINFO artifact and use access instead.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
102 Gauge gauge = Gauge.getGaugeByOfficialNumber(officialGaugeNumber); |
1058b3436dad
D4E river artifacts: Removed historical discharge calculation from WINFO artifact and use access instead.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
103 if (gauge == null) { |
1058b3436dad
D4E river artifacts: Removed historical discharge calculation from WINFO artifact and use access instead.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
104 // TODO: i18n |
1058b3436dad
D4E river artifacts: Removed historical discharge calculation from WINFO artifact and use access instead.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
105 addProblem("hist.discharge.gauge.not.found"); |
1058b3436dad
D4E river artifacts: Removed historical discharge calculation from WINFO artifact and use access instead.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
106 return null; |
1058b3436dad
D4E river artifacts: Removed historical discharge calculation from WINFO artifact and use access instead.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
107 } |
1058b3436dad
D4E river artifacts: Removed historical discharge calculation from WINFO artifact and use access instead.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
108 |
1058b3436dad
D4E river artifacts: Removed historical discharge calculation from WINFO artifact and use access instead.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
109 if (log.isDebugEnabled()) { |
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
|
110 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
|
111 } |
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
|
112 |
4232
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4138
diff
changeset
|
113 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
|
114 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
|
115 |
2304
abb390101595
#483 Display error message in calculation report for empty historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2250
diff
changeset
|
116 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
|
117 |
5914
1058b3436dad
D4E river artifacts: Removed historical discharge calculation from WINFO artifact and use access instead.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
118 log.debug("Take " + numTables + " into account."); |
2304
abb390101595
#483 Display error message in calculation report for empty historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2250
diff
changeset
|
119 |
abb390101595
#483 Display error message in calculation report for empty historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2250
diff
changeset
|
120 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
|
121 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
|
122 } |
2228
4db19a88bddb
Implemented the first step of Calculation6; create Facets for each calculation results.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2219
diff
changeset
|
123 |
4241
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
124 WQTimerange[] wqt = prepareTimerangeData(refTable, dts); |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
125 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
|
126 |
5914
1058b3436dad
D4E river artifacts: Removed historical discharge calculation from WINFO artifact and use access instead.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
127 log.debug("Number of calculation results: " + wqt.length); |
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
|
128 |
4241
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
129 return new CalculationResult(new HistoricalDischargeData(wqt, wqs), |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
130 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
|
131 } |
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
|
132 |
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
|
133 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
|
134 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
|
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 |
2228
4db19a88bddb
Implemented the first step of Calculation6; create Facets for each calculation results.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2219
diff
changeset
|
137 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
|
138 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
|
139 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
|
140 |
4232
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4138
diff
changeset
|
141 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
|
142 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
|
143 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
|
144 } |
4db19a88bddb
Implemented the first step of Calculation6; create Facets for each calculation results.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2219
diff
changeset
|
145 } |
4db19a88bddb
Implemented the first step of Calculation6; create Facets for each calculation results.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2219
diff
changeset
|
146 |
4db19a88bddb
Implemented the first step of Calculation6; create Facets for each calculation results.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2219
diff
changeset
|
147 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
|
148 } |
4db19a88bddb
Implemented the first step of Calculation6; create Facets for each calculation results.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2219
diff
changeset
|
149 |
5339
1b73b731f7bd
Doc, debug fix.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4281
diff
changeset
|
150 /** 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
|
151 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
|
152 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
|
153 |
2598
e96bf6c47c12
Improved selecting discharge tables for historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2418
diff
changeset
|
154 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
|
155 return false; |
c0dfa36add96
Some bugfixes and improvements in the calculation of historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2311
diff
changeset
|
156 } |
c0dfa36add96
Some bugfixes and improvements in the calculation of historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2311
diff
changeset
|
157 |
4232
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4138
diff
changeset
|
158 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
|
159 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
|
160 |
4db19a88bddb
Implemented the first step of Calculation6; create Facets for each calculation results.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2219
diff
changeset
|
161 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
|
162 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
|
163 } |
4db19a88bddb
Implemented the first step of Calculation6; create Facets for each calculation results.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2219
diff
changeset
|
164 |
4232
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4138
diff
changeset
|
165 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
|
166 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
|
167 |
4db19a88bddb
Implemented the first step of Calculation6; create Facets for each calculation results.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2219
diff
changeset
|
168 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
|
169 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
|
170 } |
4db19a88bddb
Implemented the first step of Calculation6; create Facets for each calculation results.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2219
diff
changeset
|
171 |
5914
1058b3436dad
D4E river artifacts: Removed historical discharge calculation from WINFO artifact and use access instead.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
172 log.debug("DischargeTable not in range: " + start + " -> " + stop); |
2228
4db19a88bddb
Implemented the first step of Calculation6; create Facets for each calculation results.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2219
diff
changeset
|
173 |
4db19a88bddb
Implemented the first step of Calculation6; create Facets for each calculation results.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2219
diff
changeset
|
174 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
|
175 } |
4db19a88bddb
Implemented the first step of Calculation6; create Facets for each calculation results.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2219
diff
changeset
|
176 |
4241
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
177 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
|
178 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
|
179 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
|
180 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
|
181 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
|
182 } |
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
|
183 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
|
184 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
|
185 } |
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
|
186 } |
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
|
187 |
4241
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
188 protected WQKms[] prepareWQData(List<DischargeTable> dts) { |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
189 WQKms[] wqs = new WQKms[dts.size()]; |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
190 |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
191 int idx = 0; |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
192 |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
193 for (DischargeTable dt : dts) { |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
194 double[][] values = null; |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
195 |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
196 if (dt.getKind() == DischargeTables.MASTER) { |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
197 values = DischargeTables.loadDischargeTableValues(dt, |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
198 DischargeTables.MASTER_SCALE); |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
199 |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
200 } |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
201 else { |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
202 values = DischargeTables.loadDischargeTableValues(dt, |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
203 DischargeTables.HISTORICAL_SCALE); |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
204 |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
205 } |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
206 |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
207 wqs[idx++] = prepareWQ(dt, values); |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
208 } |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
209 |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
210 return wqs; |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
211 } |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
212 |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
213 protected WQKms prepareWQ(DischargeTable dt, double[][] values) { |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
214 double km = dt.getGauge().getStation().doubleValue(); |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
215 |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
216 double[] kms = new double[values[0].length]; |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
217 Arrays.fill(kms, km); |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
218 |
4281
7b6c31390427
Fixed interchanged Ws and Qs in Historical Discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4241
diff
changeset
|
219 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
|
220 String.valueOf(km), dt.getTimeInterval()); |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
221 } |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
222 |
5339
1b73b731f7bd
Doc, debug fix.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4281
diff
changeset
|
223 /** 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
|
224 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
|
225 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
|
226 |
4232
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4138
diff
changeset
|
227 for (double value : values) { |
5914
1058b3436dad
D4E river artifacts: Removed historical discharge calculation from WINFO artifact and use access instead.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
228 log.debug("Prepare data for value: " + value); |
2228
4db19a88bddb
Implemented the first step of Calculation6; create Facets for each calculation results.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2219
diff
changeset
|
229 |
5914
1058b3436dad
D4E river artifacts: Removed historical discharge calculation from WINFO artifact and use access instead.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
230 String name = mode == EvaluationMode.W.getMode() |
1058b3436dad
D4E river artifacts: Removed historical discharge calculation from WINFO artifact and use access instead.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
231 ? "W=" + value |
1058b3436dad
D4E river artifacts: Removed historical discharge calculation from WINFO artifact and use access instead.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
232 : "Q=" + value; |
1058b3436dad
D4E river artifacts: Removed historical discharge calculation from WINFO artifact and use access instead.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
233 |
4232
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4138
diff
changeset
|
234 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
|
235 |
4232
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4138
diff
changeset
|
236 for (DischargeTable dt : dts) { |
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4138
diff
changeset
|
237 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
|
238 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
|
239 double w; |
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4138
diff
changeset
|
240 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
|
241 |
5914
1058b3436dad
D4E river artifacts: Removed historical discharge calculation from WINFO artifact and use access instead.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
242 if (mode == EvaluationMode.W.getMode()) { |
2228
4db19a88bddb
Implemented the first step of Calculation6; create Facets for each calculation results.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2219
diff
changeset
|
243 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
|
244 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
|
245 |
7335c526befd
Added an error report for historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2230
diff
changeset
|
246 if (Double.isNaN(q)) { |
5914
1058b3436dad
D4E river artifacts: Removed historical discharge calculation from WINFO artifact and use access instead.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
247 log.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
|
248 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
|
249 continue; |
7335c526befd
Added an error report for historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2230
diff
changeset
|
250 } |
2228
4db19a88bddb
Implemented the first step of Calculation6; create Facets for each calculation results.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2219
diff
changeset
|
251 } |
4db19a88bddb
Implemented the first step of Calculation6; create Facets for each calculation results.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2219
diff
changeset
|
252 else { |
4db19a88bddb
Implemented the first step of Calculation6; create Facets for each calculation results.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2219
diff
changeset
|
253 q = value; |
4232
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4138
diff
changeset
|
254 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
|
255 } |
4db19a88bddb
Implemented the first step of Calculation6; create Facets for each calculation results.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2219
diff
changeset
|
256 |
5914
1058b3436dad
D4E river artifacts: Removed historical discharge calculation from WINFO artifact and use access instead.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
257 log.debug("Q=" + q + " | W=" + w); |
2230
59af81364eb1
Improved the 'historical discharge' calculation: implemented findValueForW().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2228
diff
changeset
|
258 |
2244
7335c526befd
Added an error report for historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2230
diff
changeset
|
259 if (wqt == null) { |
7335c526befd
Added an error report for historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2230
diff
changeset
|
260 wqt = new WQTimerange(name); |
7335c526befd
Added an error report for historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2230
diff
changeset
|
261 } |
7335c526befd
Added an error report for historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2230
diff
changeset
|
262 |
2228
4db19a88bddb
Implemented the first step of Calculation6; create Facets for each calculation results.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2219
diff
changeset
|
263 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
|
264 } |
4db19a88bddb
Implemented the first step of Calculation6; create Facets for each calculation results.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2219
diff
changeset
|
265 |
2244
7335c526befd
Added an error report for historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2230
diff
changeset
|
266 if (wqt != null) { |
7335c526befd
Added an error report for historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2230
diff
changeset
|
267 wqts.add(wqt); |
7335c526befd
Added an error report for historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2230
diff
changeset
|
268 } |
2228
4db19a88bddb
Implemented the first step of Calculation6; create Facets for each calculation results.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2219
diff
changeset
|
269 } |
4db19a88bddb
Implemented the first step of Calculation6; create Facets for each calculation results.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2219
diff
changeset
|
270 |
3452
200e70f31f6f
Removed some superfluous casts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2598
diff
changeset
|
271 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
|
272 } |
4db19a88bddb
Implemented the first step of Calculation6; create Facets for each calculation results.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2219
diff
changeset
|
273 |
5339
1b73b731f7bd
Doc, debug fix.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4281
diff
changeset
|
274 /** With reference. */ |
4232
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4138
diff
changeset
|
275 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
|
276 List<DischargeTable> dts) { |
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4138
diff
changeset
|
277 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
|
278 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
|
279 |
4232
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4138
diff
changeset
|
280 for (double value : values) { |
5914
1058b3436dad
D4E river artifacts: Removed historical discharge calculation from WINFO artifact and use access instead.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
281 log.debug("Prepare data plus diff for value: " + value); |
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 |
5914
1058b3436dad
D4E river artifacts: Removed historical discharge calculation from WINFO artifact and use access instead.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
283 String name = mode == EvaluationMode.W.getMode() |
1058b3436dad
D4E river artifacts: Removed historical discharge calculation from WINFO artifact and use access instead.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
284 ? "W=" + value |
1058b3436dad
D4E river artifacts: Removed historical discharge calculation from WINFO artifact and use access instead.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
285 : "Q=" + value; |
4232
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4138
diff
changeset
|
286 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
|
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 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
|
289 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
|
290 |
5914
1058b3436dad
D4E river artifacts: Removed historical discharge calculation from WINFO artifact and use access instead.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
291 if (refTable != null && mode == EvaluationMode.W.getMode()) { |
4232
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4138
diff
changeset
|
292 ref = findValueForW(refTable, value, |
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4138
diff
changeset
|
293 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
|
294 } |
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 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
|
296 ref = findValueForQ(refTable, value, |
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4138
diff
changeset
|
297 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
|
298 } |
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
|
299 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
|
300 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
|
301 } |
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
|
302 |
4232
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4138
diff
changeset
|
303 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
|
304 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
|
305 |
4232
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4138
diff
changeset
|
306 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
|
307 double w; |
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4138
diff
changeset
|
308 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
|
309 |
5914
1058b3436dad
D4E river artifacts: Removed historical discharge calculation from WINFO artifact and use access instead.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
310 if (mode == EvaluationMode.W.getMode()) { |
4232
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4138
diff
changeset
|
311 w = value; |
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4138
diff
changeset
|
312 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
|
313 |
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
|
314 if (Double.isNaN(q)) { |
5914
1058b3436dad
D4E river artifacts: Removed historical discharge calculation from WINFO artifact and use access instead.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
315 log.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
|
316 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
|
317 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
|
318 } |
2315
c0dfa36add96
Some bugfixes and improvements in the calculation of historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2311
diff
changeset
|
319 |
4232
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4138
diff
changeset
|
320 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
|
321 } |
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
|
322 else { |
4232
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4138
diff
changeset
|
323 q = value; |
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4138
diff
changeset
|
324 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
|
325 |
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4138
diff
changeset
|
326 if (Double.isNaN(w)) { |
5914
1058b3436dad
D4E river artifacts: Removed historical discharge calculation from WINFO artifact and use access instead.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
327 log.warn("Cannot find W for Q: " + q); |
4232
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4138
diff
changeset
|
328 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
|
329 continue; |
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4138
diff
changeset
|
330 } |
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4138
diff
changeset
|
331 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
|
332 } |
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
|
333 |
5914
1058b3436dad
D4E river artifacts: Removed historical discharge calculation from WINFO artifact and use access instead.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
334 log.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
|
335 |
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
|
336 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
|
337 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
|
338 } |
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
|
339 |
2315
c0dfa36add96
Some bugfixes and improvements in the calculation of historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2311
diff
changeset
|
340 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
|
341 } |
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
|
342 |
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
|
343 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
|
344 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
|
345 } |
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
|
346 } |
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
|
347 |
4232
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4138
diff
changeset
|
348 return (HistoricalWQTimerange[]) wqts |
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4138
diff
changeset
|
349 .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
|
350 } |
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
|
351 |
5339
1b73b731f7bd
Doc, debug fix.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4281
diff
changeset
|
352 /** 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
|
353 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
|
354 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
|
355 |
c0dfa36add96
Some bugfixes and improvements in the calculation of historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2311
diff
changeset
|
356 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
|
357 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
|
358 |
c0dfa36add96
Some bugfixes and improvements in the calculation of historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2311
diff
changeset
|
359 if (end == null) { |
5914
1058b3436dad
D4E river artifacts: Removed historical discharge calculation from WINFO artifact and use access instead.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
360 log.warn("TimeInterval has no stop time set!"); |
2315
c0dfa36add96
Some bugfixes and improvements in the calculation of historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2311
diff
changeset
|
361 |
c0dfa36add96
Some bugfixes and improvements in the calculation of historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2311
diff
changeset
|
362 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
|
363 } |
c0dfa36add96
Some bugfixes and improvements in the calculation of historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2311
diff
changeset
|
364 |
c0dfa36add96
Some bugfixes and improvements in the calculation of historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2311
diff
changeset
|
365 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
|
366 } |
c0dfa36add96
Some bugfixes and improvements in the calculation of historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2311
diff
changeset
|
367 |
4138
1d9c9a3493ea
#904 Use the correct scale to convert discharge table values into [cm].
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4136
diff
changeset
|
368 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
|
369 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
|
370 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
|
371 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
|
372 } |
4db19a88bddb
Implemented the first step of Calculation6; create Facets for each calculation results.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2219
diff
changeset
|
373 |
4232
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4138
diff
changeset
|
374 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
|
375 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
|
376 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
|
377 |
4232
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4138
diff
changeset
|
378 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
|
379 } |
4db19a88bddb
Implemented the first step of Calculation6; create Facets for each calculation results.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2219
diff
changeset
|
380 |
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
|
381 /** |
5914
1058b3436dad
D4E river artifacts: Removed historical discharge calculation from WINFO artifact and use access instead.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
382 * Writes the parameters used for this calculation to log. |
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
|
383 */ |
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
|
384 public void debug() { |
5914
1058b3436dad
D4E river artifacts: Removed historical discharge calculation from WINFO artifact and use access instead.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
385 log.debug("========== Calculation6 =========="); |
1058b3436dad
D4E river artifacts: Removed historical discharge calculation from WINFO artifact and use access instead.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
386 log.debug(" Mode: " + mode); |
1058b3436dad
D4E river artifacts: Removed historical discharge calculation from WINFO artifact and use access instead.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
387 log.debug(" Timerange: " + timerange[0] + " - " + timerange[1]); |
1058b3436dad
D4E river artifacts: Removed historical discharge calculation from WINFO artifact and use access instead.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
388 log.debug(" Input values: " + Arrays.toString(values)); |
1058b3436dad
D4E river artifacts: Removed historical discharge calculation from WINFO artifact and use access instead.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
389 log.debug("=================================="); |
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
|
390 } |
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
|
391 } |
ebbb18ed78c4
Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
392 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |