annotate artifacts/src/main/java/org/dive4elements/river/artifacts/states/HistoricalDischargeComputeState.java @ 9801:1d7a72a50183 3.2.x tip

Assume Compose V2, consistently
author Tom Gottfried <tom@intevation.de>
date Thu, 23 Nov 2023 10:14:13 +0100
parents 0a5239a1e46e
children
rev   line source
5863
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
1 /* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
2 * Software engineering by Intevation GmbH
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
3 *
5994
af13ceeba52a Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5914
diff changeset
4 * This file is Free Software under the GNU AGPL (>=v3)
5863
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
5 * and comes with ABSOLUTELY NO WARRANTY! Check out the
5994
af13ceeba52a Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5914
diff changeset
6 * documentation coming with Dive4Elements River for details.
5863
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
7 */
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
8
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5339
diff changeset
9 package org.dive4elements.river.artifacts.states;
2191
f28844a57fed Added states (work is not finished yet) for the 'historical discharge curve' calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
10
4928
57652f905a87 HistoricalDischargeComputeState: Fix flys/issue664 i18n numbered facettes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4927
diff changeset
11 import java.text.NumberFormat;
57652f905a87 HistoricalDischargeComputeState: Fix flys/issue664 i18n numbered facettes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4927
diff changeset
12
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
13 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
14
9726
0a5239a1e46e Upgrade to Log4j 2
Tom Gottfried <tom@intevation.de>
parents: 8856
diff changeset
15 import org.apache.logging.log4j.Logger;
0a5239a1e46e Upgrade to Log4j 2
Tom Gottfried <tom@intevation.de>
parents: 8856
diff changeset
16 import org.apache.logging.log4j.LogManager;
2191
f28844a57fed Added states (work is not finished yet) for the 'historical discharge curve' calculation.
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.artifactdatabase.state.Facet;
5914
1058b3436dad D4E river artifacts: Removed historical discharge calculation from WINFO artifact and use access instead.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5867
diff changeset
19
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5339
diff changeset
20 import org.dive4elements.artifacts.Artifact;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5339
diff changeset
21 import org.dive4elements.artifacts.CallContext;
5914
1058b3436dad D4E river artifacts: Removed historical discharge calculation from WINFO artifact and use access instead.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5867
diff changeset
22
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5339
diff changeset
23 import org.dive4elements.artifacts.common.utils.XMLUtils.ElementCreator;
5914
1058b3436dad D4E river artifacts: Removed historical discharge calculation from WINFO artifact and use access instead.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5867
diff changeset
24
5867
59ff03ff48f1 River artifacts: Renamed FLYSArtifact(Collection) to D4EArtifact(Collection).
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5863
diff changeset
25 import org.dive4elements.river.artifacts.D4EArtifact;
5914
1058b3436dad D4E river artifacts: Removed historical discharge calculation from WINFO artifact and use access instead.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5867
diff changeset
26
1058b3436dad D4E river artifacts: Removed historical discharge calculation from WINFO artifact and use access instead.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5867
diff changeset
27 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: 5867
diff changeset
28
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5339
diff changeset
29 import org.dive4elements.river.artifacts.access.HistoricalDischargeAccess;
5914
1058b3436dad D4E river artifacts: Removed historical discharge calculation from WINFO artifact and use access instead.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5867
diff changeset
30
1058b3436dad D4E river artifacts: Removed historical discharge calculation from WINFO artifact and use access instead.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5867
diff changeset
31 import org.dive4elements.river.artifacts.model.Calculation6;
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5339
diff changeset
32 import org.dive4elements.river.artifacts.model.CalculationResult;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5339
diff changeset
33 import org.dive4elements.river.artifacts.model.DataFacet;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5339
diff changeset
34 import org.dive4elements.river.artifacts.model.FacetTypes;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5339
diff changeset
35 import org.dive4elements.river.artifacts.model.HistoricalDischargeData;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5339
diff changeset
36 import org.dive4elements.river.artifacts.model.HistoricalDischargeDifferenceFacet;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5339
diff changeset
37 import org.dive4elements.river.artifacts.model.HistoricalDischargeFacet;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5339
diff changeset
38 import org.dive4elements.river.artifacts.model.HistoricalDischargeWQFacet;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5339
diff changeset
39 import org.dive4elements.river.artifacts.model.HistoricalWQTimerange;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5339
diff changeset
40 import org.dive4elements.river.artifacts.model.ReportFacet;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5339
diff changeset
41 import org.dive4elements.river.artifacts.model.WQTimerange;
5914
1058b3436dad D4E river artifacts: Removed historical discharge calculation from WINFO artifact and use access instead.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5867
diff changeset
42
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5339
diff changeset
43 import org.dive4elements.river.artifacts.resources.Resources;
5914
1058b3436dad D4E river artifacts: Removed historical discharge calculation from WINFO artifact and use access instead.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5867
diff changeset
44
1058b3436dad D4E river artifacts: Removed historical discharge calculation from WINFO artifact and use access instead.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5867
diff changeset
45 import org.w3c.dom.Element;
2191
f28844a57fed Added states (work is not finished yet) for the 'historical discharge curve' calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
46
f28844a57fed Added states (work is not finished yet) for the 'historical discharge curve' calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
47 /**
3047
d20215a0afd8 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2311
diff changeset
48 * State to calculate historical discharge curves.
4736
b195fede1c3b Remove trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4260
diff changeset
49 *
2191
f28844a57fed Added states (work is not finished yet) for the 'historical discharge curve' calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
50 * @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
51 */
4927
eb1cde786abf HistoricalDischargeComputeState: Cosmetic.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4736
diff changeset
52 public class HistoricalDischargeComputeState
5914
1058b3436dad D4E river artifacts: Removed historical discharge calculation from WINFO artifact and use access instead.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5867
diff changeset
53 extends DefaultState
1058b3436dad D4E river artifacts: Removed historical discharge calculation from WINFO artifact and use access instead.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5867
diff changeset
54 implements FacetTypes
1058b3436dad D4E river artifacts: Removed historical discharge calculation from WINFO artifact and use access instead.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5867
diff changeset
55 {
9726
0a5239a1e46e Upgrade to Log4j 2
Tom Gottfried <tom@intevation.de>
parents: 8856
diff changeset
56 private static final Logger log = LogManager
4232
b3aa91e45010 Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 4144
diff changeset
57 .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
58
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
59 public static final String DEFAULT_UNIT = "cm";
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
60
2191
f28844a57fed Added states (work is not finished yet) for the 'historical discharge curve' calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
61 @Override
4232
b3aa91e45010 Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 4144
diff changeset
62 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
63 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
64 // 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
65 }
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
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 @Override
5867
59ff03ff48f1 River artifacts: Renamed FLYSArtifact(Collection) to D4EArtifact(Collection).
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5863
diff changeset
68 public Object computeAdvance(D4EArtifact artifact, String hash,
4232
b3aa91e45010 Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 4144
diff changeset
69 CallContext context, List<Facet> facets, Object old) {
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5994
diff changeset
70 log.debug("HistoricalDischargeComputeState.computeAdvance");
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
71
5914
1058b3436dad D4E river artifacts: Removed historical discharge calculation from WINFO artifact and use access instead.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5867
diff changeset
72 HistoricalDischargeAccess access =
1058b3436dad D4E river artifacts: Removed historical discharge calculation from WINFO artifact and use access instead.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5867
diff changeset
73 new HistoricalDischargeAccess(artifact);
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
74
5914
1058b3436dad D4E river artifacts: Removed historical discharge calculation from WINFO artifact and use access instead.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5867
diff changeset
75 CalculationResult res = old instanceof CalculationResult
1058b3436dad D4E river artifacts: Removed historical discharge calculation from WINFO artifact and use access instead.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5867
diff changeset
76 ? (CalculationResult)old
1058b3436dad D4E river artifacts: Removed historical discharge calculation from WINFO artifact and use access instead.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5867
diff changeset
77 : new Calculation6(access).calculate();
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
78
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
79 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
80 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
81 }
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
82
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
83 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
84 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
85 }
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
86
4241
49cb65d5932d Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 4232
diff changeset
87 HistoricalDischargeData data = (HistoricalDischargeData) res.getData();
49cb65d5932d Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 4232
diff changeset
88
49cb65d5932d Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 4232
diff changeset
89 WQTimerange[] wqts = (WQTimerange[]) data.getWQTimeranges();
49cb65d5932d Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 4232
diff changeset
90 if (wqts != null && wqts.length > 0) {
49cb65d5932d Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 4232
diff changeset
91 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
92 hash, id));
49cb65d5932d Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 4232
diff changeset
93
49cb65d5932d Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 4232
diff changeset
94 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
95 hash, id));
49cb65d5932d Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 4232
diff changeset
96
49cb65d5932d Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 4232
diff changeset
97 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
98 }
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
99
8462
1127dbe95083 Remove obsolete historical discharge curve implementations.
Tom Gottfried <tom@intevation.de>
parents: 8202
diff changeset
100 prepareWQFacets(context, facets, access, hash);
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
101
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
102 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
103 }
2228
4db19a88bddb Implemented the first step of Calculation6; create Facets for each calculation results.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2215
diff changeset
104
5914
1058b3436dad D4E river artifacts: Removed historical discharge calculation from WINFO artifact and use access instead.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5867
diff changeset
105 protected void prepareFacets(
1058b3436dad D4E river artifacts: Removed historical discharge calculation from WINFO artifact and use access instead.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5867
diff changeset
106 List<Facet> facets,
1058b3436dad D4E river artifacts: Removed historical discharge calculation from WINFO artifact and use access instead.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5867
diff changeset
107 WQTimerange[] wqts,
1058b3436dad D4E river artifacts: Removed historical discharge calculation from WINFO artifact and use access instead.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5867
diff changeset
108 HistoricalDischargeAccess access
1058b3436dad D4E river artifacts: Removed historical discharge calculation from WINFO artifact and use access instead.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5867
diff changeset
109 ) {
2228
4db19a88bddb Implemented the first step of Calculation6; create Facets for each calculation results.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2215
diff changeset
110 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
111
4232
b3aa91e45010 Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 4144
diff changeset
112 for (WQTimerange wqt : wqts) {
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5994
diff changeset
113 log.debug("Prepare facet for: " + wqt.getName());
2228
4db19a88bddb Implemented the first step of Calculation6; create Facets for each calculation results.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2215
diff changeset
114
4232
b3aa91e45010 Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 4144
diff changeset
115 EvaluationMode evalMode = access.getEvaluationMode();
b3aa91e45010 Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 4144
diff changeset
116 if (evalMode == EvaluationMode.W) {
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_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
119
4232
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) {
8856
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8490
diff changeset
121 log.debug(
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8490
diff changeset
122 "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
123
5335
05eeedc5b156 Doc, cosmetic and TODO fixes, renamed field in WQTimeRange.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4928
diff changeset
124 // TODO CREATE BETTER TITLE FOR FACETS (issue1180)
4232
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,
8856
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8490
diff changeset
126 HISTORICAL_DISCHARGE_Q_DIFF,
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8490
diff changeset
127 "DIFF: " + wqt.getName()));
4232
b3aa91e45010 Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 4144
diff changeset
128 }
b3aa91e45010 Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 4144
diff changeset
129 }
b3aa91e45010 Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 4144
diff changeset
130 else {
b3aa91e45010 Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 4144
diff changeset
131 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
132 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
133
b3aa91e45010 Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 4144
diff changeset
134 if (wqt instanceof HistoricalWQTimerange) {
8856
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8490
diff changeset
135 log.debug(
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8490
diff changeset
136 "Create another facet for historical differences.");
4232
b3aa91e45010 Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 4144
diff changeset
137
b3aa91e45010 Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 4144
diff changeset
138 // 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
139 facets.add(new HistoricalDischargeDifferenceFacet(i,
8856
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8490
diff changeset
140 HISTORICAL_DISCHARGE_W_DIFF,
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8490
diff changeset
141 "DIFF: " + wqt.getName()));
4232
b3aa91e45010 Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 4144
diff changeset
142 }
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
143 }
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
144
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
145 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
146 }
4db19a88bddb Implemented the first step of Calculation6; create Facets for each calculation results.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2215
diff changeset
147 }
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
148
4241
49cb65d5932d Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 4232
diff changeset
149 protected void prepareWQFacets(CallContext cc, List<Facet> facets,
8462
1127dbe95083 Remove obsolete historical discharge curve implementations.
Tom Gottfried <tom@intevation.de>
parents: 8202
diff changeset
150 HistoricalDischargeAccess access, String hash) {
4241
49cb65d5932d Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 4232
diff changeset
151 double[] ws = access.getWs();
49cb65d5932d Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 4232
diff changeset
152 double[] qs = access.getQs();
49cb65d5932d Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 4232
diff changeset
153
4928
57652f905a87 HistoricalDischargeComputeState: Fix flys/issue664 i18n numbered facettes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4927
diff changeset
154 NumberFormat format = NumberFormat.getInstance(
57652f905a87 HistoricalDischargeComputeState: Fix flys/issue664 i18n numbered facettes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4927
diff changeset
155 Resources.getLocale(cc.getMeta()));
4241
49cb65d5932d Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 4232
diff changeset
156 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
157 facets.add(new HistoricalDischargeWQFacet(k,
8856
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8490
diff changeset
158 HISTORICAL_DISCHARGE_WQ_W,
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8490
diff changeset
159 "W=" + format.format(ws[k]),
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8490
diff changeset
160 ComputeType.ADVANCE,
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8490
diff changeset
161 hash,
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8490
diff changeset
162 getID(),
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8490
diff changeset
163 ws[k]));
4241
49cb65d5932d Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 4232
diff changeset
164 }
49cb65d5932d Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 4232
diff changeset
165
49cb65d5932d Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 4232
diff changeset
166 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
167 facets.add(new HistoricalDischargeWQFacet(k,
8856
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8490
diff changeset
168 HISTORICAL_DISCHARGE_WQ_Q,
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8490
diff changeset
169 "Q=" + format.format(qs[k]),
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8490
diff changeset
170 ComputeType.ADVANCE,
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8490
diff changeset
171 hash,
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8490
diff changeset
172 getID(),
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8490
diff changeset
173 qs[k]));
4241
49cb65d5932d Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 4232
diff changeset
174 }
49cb65d5932d Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 4232
diff changeset
175 }
49cb65d5932d Improved the historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 4232
diff changeset
176
5339
1b73b731f7bd Doc, debug fix.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 5335
diff changeset
177 /** Create string for facets name/description. */
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
178 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
179 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
180
4232
b3aa91e45010 Implemented the Q evaluation mode for historical discharge calculations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 4144
diff changeset
181 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
182 : 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
183 }
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
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 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
186 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
187 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
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 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
191 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
192 }
2191
f28844a57fed Added states (work is not finished yet) for the 'historical discharge curve' calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
193 }
f28844a57fed Added states (work is not finished yet) for the 'historical discharge curve' calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
194 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :

http://dive4elements.wald.intevation.org