Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/HistoricalDischargeComputeState.java @ 4357:11cf29eb002c
FacetTypes: New type: exreme_wq_curve_base (for the Stuetz-Q-Poits).
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Fri, 02 Nov 2012 11:58:11 +0100 |
parents | e4a415773b0a |
children | b195fede1c3b |
rev | line source |
---|---|
2191
f28844a57fed
Added states (work is not finished yet) for the 'historical discharge curve' calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.artifacts.states; |
f28844a57fed
Added states (work is not finished yet) for the 'historical discharge curve' calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
2 |
2215
ebbb18ed78c4
Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2191
diff
changeset
|
3 import java.util.List; |
2191
f28844a57fed
Added states (work is not finished yet) for the 'historical discharge curve' calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
4 |
4232
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4144
diff
changeset
|
5 import org.apache.log4j.Logger; |
2191
f28844a57fed
Added states (work is not finished yet) for the 'historical discharge curve' calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
6 import org.w3c.dom.Element; |
f28844a57fed
Added states (work is not finished yet) for the 'historical discharge curve' calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
7 |
4232
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4144
diff
changeset
|
8 import de.intevation.artifactdatabase.state.Facet; |
2191
f28844a57fed
Added states (work is not finished yet) for the 'historical discharge curve' calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
9 import de.intevation.artifacts.Artifact; |
f28844a57fed
Added states (work is not finished yet) for the 'historical discharge curve' calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
10 import de.intevation.artifacts.CallContext; |
f28844a57fed
Added states (work is not finished yet) for the 'historical discharge curve' calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
11 import de.intevation.artifacts.common.utils.XMLUtils.ElementCreator; |
2215
ebbb18ed78c4
Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2191
diff
changeset
|
12 import de.intevation.flys.artifacts.FLYSArtifact; |
ebbb18ed78c4
Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2191
diff
changeset
|
13 import de.intevation.flys.artifacts.WINFOArtifact; |
4232
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4144
diff
changeset
|
14 import de.intevation.flys.artifacts.access.HistoricalDischargeAccess; |
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4144
diff
changeset
|
15 import de.intevation.flys.artifacts.access.HistoricalDischargeAccess.EvaluationMode; |
2215
ebbb18ed78c4
Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2191
diff
changeset
|
16 import de.intevation.flys.artifacts.model.CalculationResult; |
2258
ea173e4c07c7
Added a CSV export for historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2250
diff
changeset
|
17 import de.intevation.flys.artifacts.model.DataFacet; |
2215
ebbb18ed78c4
Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2191
diff
changeset
|
18 import de.intevation.flys.artifacts.model.FacetTypes; |
4241
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
19 import de.intevation.flys.artifacts.model.HistoricalDischargeCurveFacet; |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
20 import de.intevation.flys.artifacts.model.HistoricalDischargeData; |
4232
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4144
diff
changeset
|
21 import de.intevation.flys.artifacts.model.HistoricalDischargeDifferenceFacet; |
2215
ebbb18ed78c4
Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2191
diff
changeset
|
22 import de.intevation.flys.artifacts.model.HistoricalDischargeFacet; |
4241
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
23 import de.intevation.flys.artifacts.model.HistoricalDischargeWQFacet; |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
24 import de.intevation.flys.artifacts.model.HistoricalWQKms; |
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:
2258
diff
changeset
|
25 import de.intevation.flys.artifacts.model.HistoricalWQTimerange; |
2244
7335c526befd
Added an error report for historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2228
diff
changeset
|
26 import de.intevation.flys.artifacts.model.ReportFacet; |
4241
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
27 import de.intevation.flys.artifacts.model.WQKms; |
2228
4db19a88bddb
Implemented the first step of Calculation6; create Facets for each calculation results.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2215
diff
changeset
|
28 import de.intevation.flys.artifacts.model.WQTimerange; |
4241
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
29 import de.intevation.flys.artifacts.resources.Resources; |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
30 import de.intevation.flys.model.TimeInterval; |
2191
f28844a57fed
Added states (work is not finished yet) for the 'historical discharge curve' calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
31 |
f28844a57fed
Added states (work is not finished yet) for the 'historical discharge curve' calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
32 |
f28844a57fed
Added states (work is not finished yet) for the 'historical discharge curve' calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
33 /** |
3047
d20215a0afd8
Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2311
diff
changeset
|
34 * State to calculate historical discharge curves. |
4232
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4144
diff
changeset
|
35 * |
2191
f28844a57fed
Added states (work is not finished yet) for the 'historical discharge curve' calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
36 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> |
f28844a57fed
Added states (work is not finished yet) for the 'historical discharge curve' calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
37 */ |
4232
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4144
diff
changeset
|
38 public class HistoricalDischargeComputeState extends DefaultState implements |
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4144
diff
changeset
|
39 FacetTypes { |
2215
ebbb18ed78c4
Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2191
diff
changeset
|
40 |
4232
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4144
diff
changeset
|
41 private static final Logger logger = Logger |
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4144
diff
changeset
|
42 .getLogger(HistoricalDischargeComputeState.class); |
2215
ebbb18ed78c4
Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2191
diff
changeset
|
43 |
4144
d7db9baa4e62
#930 Added unit [cm] of discharge tables to the facet description of historical discharge curves if calculation mode is W.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3047
diff
changeset
|
44 public static final String DEFAULT_UNIT = "cm"; |
4241
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
45 public static final String I18N_WQ_CURVE_FACET_RANGE = "historical_discharge.wq.curve_range"; |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
46 public static final String I18N_WQ_CURVE_FACET_SINCE = "historical_discharge.wq.curve_since"; |
4144
d7db9baa4e62
#930 Added unit [cm] of discharge tables to the facet description of historical discharge curves if calculation mode is W.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3047
diff
changeset
|
47 |
2191
f28844a57fed
Added states (work is not finished yet) for the 'historical discharge curve' calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
48 @Override |
4232
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4144
diff
changeset
|
49 protected void appendItems(Artifact artifact, ElementCreator creator, |
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4144
diff
changeset
|
50 String name, CallContext context, Element select) { |
2191
f28844a57fed
Added states (work is not finished yet) for the 'historical discharge curve' calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
51 // TODO IMPLEMENT ME |
f28844a57fed
Added states (work is not finished yet) for the 'historical discharge curve' calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
52 } |
2215
ebbb18ed78c4
Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2191
diff
changeset
|
53 |
ebbb18ed78c4
Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2191
diff
changeset
|
54 @Override |
4232
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4144
diff
changeset
|
55 public Object computeAdvance(FLYSArtifact artifact, String hash, |
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4144
diff
changeset
|
56 CallContext context, List<Facet> facets, Object old) { |
2215
ebbb18ed78c4
Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2191
diff
changeset
|
57 logger.debug("HistoricalDischargeComputeState.computeAdvance"); |
ebbb18ed78c4
Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2191
diff
changeset
|
58 |
ebbb18ed78c4
Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2191
diff
changeset
|
59 WINFOArtifact winfo = (WINFOArtifact) artifact; |
ebbb18ed78c4
Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2191
diff
changeset
|
60 |
4232
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4144
diff
changeset
|
61 CalculationResult res = old instanceof CalculationResult ? (CalculationResult) old |
2215
ebbb18ed78c4
Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2191
diff
changeset
|
62 : winfo.getHistoricalDischargeData(); |
ebbb18ed78c4
Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2191
diff
changeset
|
63 |
ebbb18ed78c4
Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2191
diff
changeset
|
64 if (facets == null) { |
ebbb18ed78c4
Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2191
diff
changeset
|
65 return res; |
ebbb18ed78c4
Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2191
diff
changeset
|
66 } |
ebbb18ed78c4
Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2191
diff
changeset
|
67 |
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
|
68 if (res.getReport().hasProblems()) { |
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
|
69 facets.add(new ReportFacet(ComputeType.ADVANCE, hash, id)); |
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
|
70 } |
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
|
71 |
4241
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
72 HistoricalDischargeData data = (HistoricalDischargeData) res.getData(); |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
73 HistoricalDischargeAccess access = new HistoricalDischargeAccess( |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
74 artifact); |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
75 |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
76 WQTimerange[] wqts = (WQTimerange[]) data.getWQTimeranges(); |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
77 if (wqts != null && wqts.length > 0) { |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
78 facets.add(new DataFacet(CSV, "CSV data", ComputeType.ADVANCE, |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
79 hash, id)); |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
80 |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
81 facets.add(new DataFacet(PDF, "PDF data", ComputeType.ADVANCE, |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
82 hash, id)); |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
83 |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
84 prepareFacets(facets, wqts, access); |
2228
4db19a88bddb
Implemented the first step of Calculation6; create Facets for each calculation results.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2215
diff
changeset
|
85 } |
2215
ebbb18ed78c4
Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2191
diff
changeset
|
86 |
4241
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
87 WQKms[] wqs = (WQKms[]) data.getWQs(); |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
88 if (wqs != null && wqs.length > 0) { |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
89 prepareWQFacets(context, facets, wqs, access, hash); |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
90 } |
2215
ebbb18ed78c4
Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2191
diff
changeset
|
91 |
ebbb18ed78c4
Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2191
diff
changeset
|
92 return res; |
ebbb18ed78c4
Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2191
diff
changeset
|
93 } |
2228
4db19a88bddb
Implemented the first step of Calculation6; create Facets for each calculation results.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2215
diff
changeset
|
94 |
4232
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4144
diff
changeset
|
95 protected void prepareFacets(List<Facet> facets, WQTimerange[] wqts, |
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4144
diff
changeset
|
96 HistoricalDischargeAccess access) { |
2228
4db19a88bddb
Implemented the first step of Calculation6; create Facets for each calculation results.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2215
diff
changeset
|
97 int i = 0; |
4db19a88bddb
Implemented the first step of Calculation6; create Facets for each calculation results.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2215
diff
changeset
|
98 |
4232
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4144
diff
changeset
|
99 for (WQTimerange wqt : wqts) { |
2228
4db19a88bddb
Implemented the first step of Calculation6; create Facets for each calculation results.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2215
diff
changeset
|
100 logger.debug("Prepare facet for: " + wqt.getName()); |
4db19a88bddb
Implemented the first step of Calculation6; create Facets for each calculation results.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2215
diff
changeset
|
101 |
4232
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4144
diff
changeset
|
102 EvaluationMode evalMode = access.getEvaluationMode(); |
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4144
diff
changeset
|
103 if (evalMode == EvaluationMode.W) { |
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4144
diff
changeset
|
104 facets.add(new HistoricalDischargeFacet(i, |
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4144
diff
changeset
|
105 HISTORICAL_DISCHARGE_Q, createFacetTitle(wqt))); |
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:
2258
diff
changeset
|
106 |
4232
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4144
diff
changeset
|
107 if (wqt instanceof HistoricalWQTimerange) { |
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4144
diff
changeset
|
108 logger |
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4144
diff
changeset
|
109 .debug("Create another facet for historical differences."); |
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:
2258
diff
changeset
|
110 |
4232
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4144
diff
changeset
|
111 // TODO CREATE BETTER TITLE FOR FACETS |
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4144
diff
changeset
|
112 facets.add(new HistoricalDischargeDifferenceFacet(i, |
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4144
diff
changeset
|
113 HISTORICAL_DISCHARGE_Q_DIFF, "DIFF: " + wqt.getName())); |
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4144
diff
changeset
|
114 } |
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4144
diff
changeset
|
115 } |
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4144
diff
changeset
|
116 else { |
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4144
diff
changeset
|
117 facets.add(new HistoricalDischargeFacet(i, |
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4144
diff
changeset
|
118 HISTORICAL_DISCHARGE_W, createFacetTitle(wqt))); |
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4144
diff
changeset
|
119 |
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4144
diff
changeset
|
120 if (wqt instanceof HistoricalWQTimerange) { |
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4144
diff
changeset
|
121 logger |
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4144
diff
changeset
|
122 .debug("Create another facet for historical differences."); |
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4144
diff
changeset
|
123 |
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4144
diff
changeset
|
124 // TODO CREATE BETTER TITLE FOR FACETS |
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4144
diff
changeset
|
125 facets.add(new HistoricalDischargeDifferenceFacet(i, |
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4144
diff
changeset
|
126 HISTORICAL_DISCHARGE_W_DIFF, "DIFF: " + wqt.getName())); |
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4144
diff
changeset
|
127 } |
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:
2258
diff
changeset
|
128 } |
b8df8d1476ba
Compute differences between discharge table values and reference discharge table values in historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2258
diff
changeset
|
129 |
b8df8d1476ba
Compute differences between discharge table values and reference discharge table values in historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2258
diff
changeset
|
130 i++; |
2228
4db19a88bddb
Implemented the first step of Calculation6; create Facets for each calculation results.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2215
diff
changeset
|
131 } |
4db19a88bddb
Implemented the first step of Calculation6; create Facets for each calculation results.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2215
diff
changeset
|
132 } |
4144
d7db9baa4e62
#930 Added unit [cm] of discharge tables to the facet description of historical discharge curves if calculation mode is W.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3047
diff
changeset
|
133 |
4241
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
134 protected void prepareWQFacets(CallContext cc, List<Facet> facets, |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
135 WQKms[] wqs, HistoricalDischargeAccess access, String hash) { |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
136 double[] ws = access.getWs(); |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
137 double[] qs = access.getQs(); |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
138 |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
139 for (int k = 0; k < ws.length; k++) { |
4260
e4a415773b0a
Added the 'index' parameter to HistoricalDischargeWQFacet to avoid loosing facets during the merge process in the FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4258
diff
changeset
|
140 facets.add(new HistoricalDischargeWQFacet(k, |
e4a415773b0a
Added the 'index' parameter to HistoricalDischargeWQFacet to avoid loosing facets during the merge process in the FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4258
diff
changeset
|
141 HISTORICAL_DISCHARGE_WQ_W, "W=" + ws[k], ComputeType.ADVANCE, |
e4a415773b0a
Added the 'index' parameter to HistoricalDischargeWQFacet to avoid loosing facets during the merge process in the FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4258
diff
changeset
|
142 hash, getID(), ws[k])); |
4241
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
143 } |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
144 |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
145 for (int k = 0; k < qs.length; k++) { |
4260
e4a415773b0a
Added the 'index' parameter to HistoricalDischargeWQFacet to avoid loosing facets during the merge process in the FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4258
diff
changeset
|
146 facets.add(new HistoricalDischargeWQFacet(k, |
e4a415773b0a
Added the 'index' parameter to HistoricalDischargeWQFacet to avoid loosing facets during the merge process in the FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4258
diff
changeset
|
147 HISTORICAL_DISCHARGE_WQ_Q, "Q=" + qs[k], ComputeType.ADVANCE, |
e4a415773b0a
Added the 'index' parameter to HistoricalDischargeWQFacet to avoid loosing facets during the merge process in the FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4258
diff
changeset
|
148 hash, getID(), qs[k])); |
4241
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
149 } |
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 int idx = 0; |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
152 for (WQKms wqkms : wqs) { |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
153 String title = null; |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
154 if (wqkms instanceof HistoricalWQKms) { |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
155 title = createDischargeCurveTitle(cc, (HistoricalWQKms) wqkms); |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
156 } |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
157 else { |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
158 title = wqkms.getName(); |
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 facets.add(new HistoricalDischargeCurveFacet(idx, |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
162 HISTORICAL_DISCHARGE_WQ_CURVE, title, ComputeType.ADVANCE, |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
163 getID(), hash)); |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
164 idx++; |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
165 } |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
166 } |
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 String createDischargeCurveTitle(CallContext cc, |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
169 HistoricalWQKms wqkms) { |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
170 TimeInterval timeInterval = wqkms.getTimeInterval(); |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
171 |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
172 if (timeInterval.getStopTime() != null) { |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
173 return Resources.format(cc.getMeta(), I18N_WQ_CURVE_FACET_RANGE, |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
174 I18N_WQ_CURVE_FACET_RANGE, timeInterval.getStartTime(), |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
175 timeInterval.getStopTime()); |
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 else { |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
178 return Resources.format(cc.getMeta(), I18N_WQ_CURVE_FACET_SINCE, |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
179 I18N_WQ_CURVE_FACET_SINCE, timeInterval.getStartTime()); |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
180 } |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
181 } |
49cb65d5932d
Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4232
diff
changeset
|
182 |
4144
d7db9baa4e62
#930 Added unit [cm] of discharge tables to the facet description of historical discharge curves if calculation mode is W.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3047
diff
changeset
|
183 protected String createFacetTitle(WQTimerange wqt) { |
d7db9baa4e62
#930 Added unit [cm] of discharge tables to the facet description of historical discharge curves if calculation mode is W.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3047
diff
changeset
|
184 String name = wqt.getName(); |
d7db9baa4e62
#930 Added unit [cm] of discharge tables to the facet description of historical discharge curves if calculation mode is W.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3047
diff
changeset
|
185 |
4232
b3aa91e45010
Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4144
diff
changeset
|
186 return name != null && name.indexOf("W") >= 0 ? createFacetTitleW(wqt) |
4144
d7db9baa4e62
#930 Added unit [cm] of discharge tables to the facet description of historical discharge curves if calculation mode is W.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3047
diff
changeset
|
187 : createFacetTitleQ(wqt); |
d7db9baa4e62
#930 Added unit [cm] of discharge tables to the facet description of historical discharge curves if calculation mode is W.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3047
diff
changeset
|
188 } |
d7db9baa4e62
#930 Added unit [cm] of discharge tables to the facet description of historical discharge curves if calculation mode is W.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3047
diff
changeset
|
189 |
d7db9baa4e62
#930 Added unit [cm] of discharge tables to the facet description of historical discharge curves if calculation mode is W.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3047
diff
changeset
|
190 protected String createFacetTitleW(WQTimerange wqt) { |
d7db9baa4e62
#930 Added unit [cm] of discharge tables to the facet description of historical discharge curves if calculation mode is W.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3047
diff
changeset
|
191 String name = wqt.getName(); |
d7db9baa4e62
#930 Added unit [cm] of discharge tables to the facet description of historical discharge curves if calculation mode is W.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3047
diff
changeset
|
192 return name + " " + DEFAULT_UNIT; |
d7db9baa4e62
#930 Added unit [cm] of discharge tables to the facet description of historical discharge curves if calculation mode is W.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3047
diff
changeset
|
193 } |
d7db9baa4e62
#930 Added unit [cm] of discharge tables to the facet description of historical discharge curves if calculation mode is W.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3047
diff
changeset
|
194 |
d7db9baa4e62
#930 Added unit [cm] of discharge tables to the facet description of historical discharge curves if calculation mode is W.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3047
diff
changeset
|
195 protected String createFacetTitleQ(WQTimerange wqt) { |
d7db9baa4e62
#930 Added unit [cm] of discharge tables to the facet description of historical discharge curves if calculation mode is W.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3047
diff
changeset
|
196 return wqt.getName(); |
d7db9baa4e62
#930 Added unit [cm] of discharge tables to the facet description of historical discharge curves if calculation mode is W.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3047
diff
changeset
|
197 } |
2191
f28844a57fed
Added states (work is not finished yet) for the 'historical discharge curve' calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
198 } |
f28844a57fed
Added states (work is not finished yet) for the 'historical discharge curve' calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
199 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 : |