Mercurial > dive4elements > river
annotate artifacts/src/main/java/org/dive4elements/river/artifacts/WINFOArtifact.java @ 9638:6c1ebf2220f5
# 19b (check for usages of WaterlevelExporter.getWforGaugeAndQ) -> cleanup: removing calc.extreme.curve
author | dnt_bjoernsen <d.tironi@bjoernsen.de> |
---|---|
date | Thu, 31 Oct 2019 17:37:53 +0100 |
parents | b380a5693514 |
children |
rev | line source |
---|---|
5863
4897a58c8746
River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5848
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:
5848
diff
changeset
|
2 * Software engineering by Intevation GmbH |
4897a58c8746
River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5848
diff
changeset
|
3 * |
5994
af13ceeba52a
Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5919
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:
5848
diff
changeset
|
5 * and comes with ABSOLUTELY NO WARRANTY! Check out the |
5994
af13ceeba52a
Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5919
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:
5848
diff
changeset
|
7 */ |
4897a58c8746
River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5848
diff
changeset
|
8 |
5831
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5786
diff
changeset
|
9 package org.dive4elements.river.artifacts; |
3233
7e5460d08eb0
WINFOArtifact: minor code improvement when lookup if facet should be initially active.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3227
diff
changeset
|
10 |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
11 import java.io.Serializable; |
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
12 import java.util.Arrays; |
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
13 import java.util.Map; |
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
14 |
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
15 import org.apache.log4j.Logger; |
5831
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5786
diff
changeset
|
16 import org.dive4elements.artifactdatabase.data.StateData; |
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5786
diff
changeset
|
17 import org.dive4elements.artifactdatabase.state.Facet; |
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5786
diff
changeset
|
18 import org.dive4elements.artifactdatabase.state.FacetActivity; |
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5786
diff
changeset
|
19 import org.dive4elements.artifacts.Artifact; |
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5786
diff
changeset
|
20 import org.dive4elements.artifacts.CallContext; |
9479
2b83d3a96703
i18n TODO "benutzerdefiniert" = "custom" fixed
gernotbelger
parents:
9425
diff
changeset
|
21 import org.dive4elements.artifacts.CallMeta; |
5831
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5786
diff
changeset
|
22 import org.dive4elements.artifacts.common.utils.StringUtils; |
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5786
diff
changeset
|
23 import org.dive4elements.river.artifacts.access.Calculation4Access; |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
24 import org.dive4elements.river.artifacts.access.ComputationRangeAccess; |
5831
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5786
diff
changeset
|
25 import org.dive4elements.river.artifacts.access.RangeAccess; |
9130 | 26 import org.dive4elements.river.artifacts.access.RiverAccess; |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
27 import org.dive4elements.river.artifacts.model.Calculation; |
5831
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5786
diff
changeset
|
28 import org.dive4elements.river.artifacts.model.Calculation1; |
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5786
diff
changeset
|
29 import org.dive4elements.river.artifacts.model.Calculation2; |
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5786
diff
changeset
|
30 import org.dive4elements.river.artifacts.model.Calculation3; |
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5786
diff
changeset
|
31 import org.dive4elements.river.artifacts.model.Calculation4; |
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5786
diff
changeset
|
32 import org.dive4elements.river.artifacts.model.Calculation5; |
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5786
diff
changeset
|
33 import org.dive4elements.river.artifacts.model.CalculationResult; |
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5786
diff
changeset
|
34 import org.dive4elements.river.artifacts.model.DischargeTables; |
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5786
diff
changeset
|
35 import org.dive4elements.river.artifacts.model.FacetTypes; |
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5786
diff
changeset
|
36 import org.dive4elements.river.artifacts.model.WQCKms; |
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5786
diff
changeset
|
37 import org.dive4elements.river.artifacts.model.WQKms; |
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5786
diff
changeset
|
38 import org.dive4elements.river.artifacts.model.WW; |
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5786
diff
changeset
|
39 import org.dive4elements.river.artifacts.model.WstValueTable; |
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5786
diff
changeset
|
40 import org.dive4elements.river.artifacts.model.WstValueTableFactory; |
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5786
diff
changeset
|
41 import org.dive4elements.river.artifacts.model.extreme.ExtremeResult; |
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5786
diff
changeset
|
42 import org.dive4elements.river.artifacts.states.DefaultState.ComputeType; |
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5786
diff
changeset
|
43 import org.dive4elements.river.model.DischargeTable; |
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5786
diff
changeset
|
44 import org.dive4elements.river.model.Gauge; |
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5786
diff
changeset
|
45 import org.dive4elements.river.model.River; |
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5786
diff
changeset
|
46 import org.dive4elements.river.utils.DoubleUtil; |
5865
73da40528cf2
River artifacts: Renamed FLYSUtils to RiverUtils.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
47 import org.dive4elements.river.utils.RiverUtils; |
655
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
649
diff
changeset
|
48 |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
49 import gnu.trove.TDoubleArrayList; |
451
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
50 |
105
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
51 /** |
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
52 * The default WINFO artifact. |
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
53 * |
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
54 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> |
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
55 */ |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
56 public class WINFOArtifact extends D4EArtifact implements FacetTypes, WaterLineArtifact { |
105
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
57 |
8202
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6625
diff
changeset
|
58 /** The log for this class. */ |
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6625
diff
changeset
|
59 private static Logger log = Logger.getLogger(WINFOArtifact.class); |
105
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
60 |
1029
3f3988bb6284
Picky Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
943
diff
changeset
|
61 /** The name of the artifact. */ |
121
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
62 public static final String ARTIFACT_NAME = "winfo"; |
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
63 |
124
b7a9557957d1
Appende the static data to the static node of the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
121
diff
changeset
|
64 /** XPath */ |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
65 public static final String XPATH_STATIC_UI = "/art:result/art:ui/art:static"; |
124
b7a9557957d1
Appende the static data to the static node of the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
121
diff
changeset
|
66 |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
67 /** |
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
68 * The default number of steps between the start end end of a selected Q |
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
69 * range. |
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
70 */ |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
71 public static final int DEFAULT_Q_STEPS = 30; |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
72 |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
73 private static final String[] INACTIVES = new String[] { LONGITUDINAL_Q, DURATION_Q, STATIC_WQKMS_Q }; |
3556
afc7bfb4800b
Use the new infrastructure to figure out if a facet should
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3449
diff
changeset
|
74 |
afc7bfb4800b
Use the new infrastructure to figure out if a facet should
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3449
diff
changeset
|
75 static { |
afc7bfb4800b
Use the new infrastructure to figure out if a facet should
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3449
diff
changeset
|
76 // TODO: Move to configuration. |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
77 FacetActivity.Registry.getInstance().register(ARTIFACT_NAME, new FacetActivity() { |
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
78 @Override |
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
79 public Boolean isInitialActive(final Artifact artifact, final Facet facet, final String outputName) { |
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
80 final String fname = facet.getName(); |
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
81 if ((fname.equals(MAINVALUES_Q) || fname.equals(MAINVALUES_W)) && outputName.equals("computed_discharge_curve")) { |
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
82 return Boolean.FALSE; |
3556
afc7bfb4800b
Use the new infrastructure to figure out if a facet should
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3449
diff
changeset
|
83 } |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
84 return !StringUtils.contains(fname, INACTIVES); |
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
85 } |
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
86 }); |
3556
afc7bfb4800b
Use the new infrastructure to figure out if a facet should
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3449
diff
changeset
|
87 } |
121
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
88 |
105
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
89 /** |
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
90 * The default constructor. |
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
91 */ |
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
92 public WINFOArtifact() { |
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
93 } |
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
94 |
121
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
95 /** |
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
96 * Returns the name of the concrete artifact. |
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
97 * |
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
98 * @return the name of the concrete artifact. |
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
99 */ |
3193
2f922be407ea
Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3124
diff
changeset
|
100 @Override |
121
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
101 public String getName() { |
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
102 return ARTIFACT_NAME; |
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
103 } |
124
b7a9557957d1
Appende the static data to the static node of the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
121
diff
changeset
|
104 |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
105 protected static boolean reportGeneratedWs(final Calculation report, final double[] ws) { |
2624
3f24865082da
Generate error message when more than one Q is found for given Q in "W auf freier Strecke".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2617
diff
changeset
|
106 if (ws == null || ws.length < 2) { |
3f24865082da
Generate error message when more than one Q is found for given Q in "W auf freier Strecke".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2617
diff
changeset
|
107 return false; |
3f24865082da
Generate error message when more than one Q is found for given Q in "W auf freier Strecke".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2617
diff
changeset
|
108 } |
3f24865082da
Generate error message when more than one Q is found for given Q in "W auf freier Strecke".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2617
diff
changeset
|
109 |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
110 double lastW = ws[0]; |
2624
3f24865082da
Generate error message when more than one Q is found for given Q in "W auf freier Strecke".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2617
diff
changeset
|
111 boolean alreadyReported = false; |
3f24865082da
Generate error message when more than one Q is found for given Q in "W auf freier Strecke".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2617
diff
changeset
|
112 |
3f24865082da
Generate error message when more than one Q is found for given Q in "W auf freier Strecke".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2617
diff
changeset
|
113 for (int i = 1; i < ws.length; ++i) { |
3f24865082da
Generate error message when more than one Q is found for given Q in "W auf freier Strecke".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2617
diff
changeset
|
114 if (Math.abs(lastW - ws[i]) < 1e-5) { |
3f24865082da
Generate error message when more than one Q is found for given Q in "W auf freier Strecke".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2617
diff
changeset
|
115 if (!alreadyReported) { |
3f24865082da
Generate error message when more than one Q is found for given Q in "W auf freier Strecke".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2617
diff
changeset
|
116 alreadyReported = true; |
3f24865082da
Generate error message when more than one Q is found for given Q in "W auf freier Strecke".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2617
diff
changeset
|
117 report.addProblem("more.than.one.q.for.w", ws[i]); |
3f24865082da
Generate error message when more than one Q is found for given Q in "W auf freier Strecke".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2617
diff
changeset
|
118 } |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
119 } else { |
2624
3f24865082da
Generate error message when more than one Q is found for given Q in "W auf freier Strecke".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2617
diff
changeset
|
120 alreadyReported = false; |
3f24865082da
Generate error message when more than one Q is found for given Q in "W auf freier Strecke".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2617
diff
changeset
|
121 } |
3f24865082da
Generate error message when more than one Q is found for given Q in "W auf freier Strecke".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2617
diff
changeset
|
122 lastW = ws[i]; |
3f24865082da
Generate error message when more than one Q is found for given Q in "W auf freier Strecke".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2617
diff
changeset
|
123 } |
3f24865082da
Generate error message when more than one Q is found for given Q in "W auf freier Strecke".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2617
diff
changeset
|
124 |
3f24865082da
Generate error message when more than one Q is found for given Q in "W auf freier Strecke".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2617
diff
changeset
|
125 return true; |
3f24865082da
Generate error message when more than one Q is found for given Q in "W auf freier Strecke".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2617
diff
changeset
|
126 } |
3f24865082da
Generate error message when more than one Q is found for given Q in "W auf freier Strecke".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2617
diff
changeset
|
127 |
362
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
128 // |
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
129 // METHODS FOR RETRIEVING COMPUTED DATA FOR DIFFERENT CHART TYPES |
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
130 // |
4479
5fc7df736634
WINFOArtifact: Compute extreme values for cross sections too. Add CS-Facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4478
diff
changeset
|
131 // |
5fc7df736634
WINFOArtifact: Compute extreme values for cross sections too. Add CS-Facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4478
diff
changeset
|
132 /** |
5fc7df736634
WINFOArtifact: Compute extreme values for cross sections too. Add CS-Facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4478
diff
changeset
|
133 * Returns the data that is computed by a waterlevel computation. |
5fc7df736634
WINFOArtifact: Compute extreme values for cross sections too. Add CS-Facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4478
diff
changeset
|
134 * |
5fc7df736634
WINFOArtifact: Compute extreme values for cross sections too. Add CS-Facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4478
diff
changeset
|
135 * @return an array of data triples that consist of W, Q and Kms. |
5fc7df736634
WINFOArtifact: Compute extreme values for cross sections too. Add CS-Facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4478
diff
changeset
|
136 */ |
5fc7df736634
WINFOArtifact: Compute extreme values for cross sections too. Add CS-Facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4478
diff
changeset
|
137 public CalculationResult getWaterlevelData() { |
5fc7df736634
WINFOArtifact: Compute extreme values for cross sections too. Add CS-Facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4478
diff
changeset
|
138 return this.getWaterlevelData(null); |
5fc7df736634
WINFOArtifact: Compute extreme values for cross sections too. Add CS-Facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4478
diff
changeset
|
139 } |
362
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
140 |
9479
2b83d3a96703
i18n TODO "benutzerdefiniert" = "custom" fixed
gernotbelger
parents:
9425
diff
changeset
|
141 private CalculationResult getDischargeLongitudinalSectionData(final CallMeta meta) { |
8565
ea17665c5aad
Replace offensive comment by a more constructive note.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
8562
diff
changeset
|
142 // TODO: This caluclation should be cached as it is quite expensive. |
9479
2b83d3a96703
i18n TODO "benutzerdefiniert" = "custom" fixed
gernotbelger
parents:
9425
diff
changeset
|
143 return new Calculation4(new Calculation4Access(this)).calculate(meta); |
4812
65bfb6faa538
Bring Access pattern to "W fuer ungleichwertige Abflusslaengsschnitte".
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4652
diff
changeset
|
144 } |
65bfb6faa538
Bring Access pattern to "W fuer ungleichwertige Abflusslaengsschnitte".
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4652
diff
changeset
|
145 |
687
06689035024c
Added a compute() method to WINFOArtifact which acts as a dispatcher for different computations. It triggers a calculation based on ComputeCallbacks that are generated by the current states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
686
diff
changeset
|
146 /** |
362
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
147 * Returns the data that is computed by a waterlevel computation. |
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
148 * |
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
149 * @return an array of data triples that consist of W, Q and Kms. |
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
150 */ |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
151 public CalculationResult getWaterlevelData(final CallContext context) { |
8202
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6625
diff
changeset
|
152 log.debug("WINFOArtifact.getWaterlevelData"); |
362
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
153 |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
154 final String calculationMode = getDataAsString("calculation_mode"); |
4479
5fc7df736634
WINFOArtifact: Compute extreme values for cross sections too. Add CS-Facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4478
diff
changeset
|
155 |
6619
075c00b767d7
issue1399: WINFOArtifact: Compute difference also if part of difference building oneselve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6326
diff
changeset
|
156 // If this WINFO-Artifact has a calculation trait. |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
157 if (calculationMode != null) { |
9130 | 158 if (calculationMode.equals("calc.discharge.longitudinal.section")) |
9479
2b83d3a96703
i18n TODO "benutzerdefiniert" = "custom" fixed
gernotbelger
parents:
9425
diff
changeset
|
159 return getDischargeLongitudinalSectionData(context.getMeta()); |
9130 | 160 |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
161 if (calculationMode.equals("calc.w.differences")) |
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
162 return (CalculationResult) this.compute(context, ComputeType.ADVANCE, true); |
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
163 |
9130 | 164 log.warn("Unhandled calculation_mode " + calculationMode); |
4479
5fc7df736634
WINFOArtifact: Compute extreme values for cross sections too. Add CS-Facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4478
diff
changeset
|
165 } |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
166 |
6619
075c00b767d7
issue1399: WINFOArtifact: Compute difference also if part of difference building oneselve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6326
diff
changeset
|
167 // Otherwise get it from parameterization. |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
168 // TODO: wrong comment: now always a waterlevle computation is executed; actually there is a calc_mode for that, why |
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
169 // dont check? |
9130 | 170 return computeWaterlevelData(); |
171 } | |
172 | |
173 /** Execu5tes the calculation of 'waterlevel', fetches all input data from this artifact */ | |
174 private CalculationResult computeWaterlevelData() { | |
175 final double[] kms = new ComputationRangeAccess(this).getKms(); | |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
176 if (kms == null) |
9130 | 177 return error(new WQKms[0], "no.kms.selected"); |
178 | |
179 return computeWaterlevelData(kms); | |
180 } | |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
181 |
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
182 /** |
9130 | 183 * Execu5tes the calculation of 'waterlevel'. |
184 * Allows to override the stations for which the calculation is done. All other inputs are fetched from this artifact. | |
185 */ | |
186 public final CalculationResult computeWaterlevelData(final double kms[]) { | |
187 | |
188 final River river = new RiverAccess(this).getRiver(); | |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
189 if (river == null) |
2166
2898b1ff6013
I18N for WINFO calculation result messages.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2165
diff
changeset
|
190 return error(new WQKms[0], "no.river.selected"); |
362
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
191 |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
192 double[] qs = getQs(); |
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
193 double[] ws = null; |
447
5606ba4139e0
WSTs will now have a header that contains the names of the Ws or Qs that had been defined for the computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
443
diff
changeset
|
194 |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
195 final Calculation report = new Calculation(); |
2624
3f24865082da
Generate error message when more than one Q is found for given Q in "W auf freier Strecke".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2617
diff
changeset
|
196 |
362
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
197 if (qs == null) { |
8202
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6625
diff
changeset
|
198 log.debug("Determine Q values based on a set of W values."); |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
199 ws = getWs(); |
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
200 final double[][] qws = getQsForWs(ws, report); |
2415
64dd65aa620d
Partial fix for flys/issue499
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2326
diff
changeset
|
201 if (qws == null || qws.length == 0) { |
2166
2898b1ff6013
I18N for WINFO calculation result messages.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2165
diff
changeset
|
202 return error(new WQKms[0], "converting.ws.to.qs.failed"); |
735
db68806e6563
Fixed "W am Pegel" calculations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
723
diff
changeset
|
203 } |
2165
637dd38d0e2f
Handle the case in "W auf freier Strecke" where more than ne Q is related to a W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2164
diff
changeset
|
204 qs = qws[0]; |
637dd38d0e2f
Handle the case in "W auf freier Strecke" where more than ne Q is related to a W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2164
diff
changeset
|
205 |
3076
5642a83420f2
FLYS artifacts: Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2765
diff
changeset
|
206 if (reportGeneratedWs(report, qws[1])) { |
2165
637dd38d0e2f
Handle the case in "W auf freier Strecke" where more than ne Q is related to a W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2164
diff
changeset
|
207 ws = qws[1]; |
637dd38d0e2f
Handle the case in "W auf freier Strecke" where more than ne Q is related to a W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2164
diff
changeset
|
208 } |
362
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
209 } |
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
210 |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
211 final WstValueTable wst = WstValueTableFactory.getTable(river); |
362
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
212 if (wst == null) { |
2166
2898b1ff6013
I18N for WINFO calculation result messages.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2165
diff
changeset
|
213 return error(new WQKms[0], "no.wst.for.selected.river"); |
362
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
214 } |
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
215 |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
216 final RangeAccess rangeAccess = new RangeAccess(this); |
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
217 final double[] range = rangeAccess.getKmRange(); |
738
5abdb2fa8eb1
Fix for flys/issue147
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
736
diff
changeset
|
218 if (range == null) { |
2166
2898b1ff6013
I18N for WINFO calculation result messages.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2165
diff
changeset
|
219 return error(new WQKms[0], "no.range.found"); |
738
5abdb2fa8eb1
Fix for flys/issue147
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
736
diff
changeset
|
220 } |
736
d9d9f67af984
Fix for flys/issue86
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
735
diff
changeset
|
221 |
738
5abdb2fa8eb1
Fix for flys/issue147
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
736
diff
changeset
|
222 double refKm; |
5abdb2fa8eb1
Fix for flys/issue147
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
736
diff
changeset
|
223 |
2164
d548e2e13524
Added code for the simple case of "Bezugslinienverfahren" ("W auf freier Strecke").
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2126
diff
changeset
|
224 if (isFreeQ() || isFreeW()) { |
738
5abdb2fa8eb1
Fix for flys/issue147
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
736
diff
changeset
|
225 refKm = range[0]; |
8202
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6625
diff
changeset
|
226 log.debug("'free' calculation (km " + refKm + ")"); |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
227 } else { |
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
228 final Gauge gauge = river.determineRefGauge(range, rangeAccess.isRange()); |
8728
f51b9305d338
(issue1801) Reference gauge for waterlevel calculation depends on direction of calculation or flow direction.
Tom Gottfried <tom@intevation.de>
parents:
8704
diff
changeset
|
229 |
708
757ff56b43b3
Added calculation "am Pegel" version to the "Wasserspiegellage" calculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
706
diff
changeset
|
230 if (gauge == null) { |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
231 return error(new WQKms[0], "no.gauge.found.for.km", range[0]); |
708
757ff56b43b3
Added calculation "am Pegel" version to the "Wasserspiegellage" calculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
706
diff
changeset
|
232 } |
736
d9d9f67af984
Fix for flys/issue86
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
735
diff
changeset
|
233 |
d9d9f67af984
Fix for flys/issue86
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
735
diff
changeset
|
234 refKm = gauge.getStation().doubleValue(); |
d9d9f67af984
Fix for flys/issue86
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
735
diff
changeset
|
235 |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
236 log.debug("reference gauge: " + gauge.getName() + " (km " + refKm + ")"); |
708
757ff56b43b3
Added calculation "am Pegel" version to the "Wasserspiegellage" calculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
706
diff
changeset
|
237 } |
757ff56b43b3
Added calculation "am Pegel" version to the "Wasserspiegellage" calculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
706
diff
changeset
|
238 |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
239 return computeWaterlevelData(kms, qs, ws, wst, refKm, report); |
447
5606ba4139e0
WSTs will now have a header that contains the names of the Ws or Qs that had been defined for the computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
443
diff
changeset
|
240 } |
5606ba4139e0
WSTs will now have a header that contains the names of the Ws or Qs that had been defined for the computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
443
diff
changeset
|
241 |
362
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
242 /** |
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
243 * Computes the data of a waterlevel computation based on the interpolation |
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
244 * in WstValueTable. |
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
245 * |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
246 * @param kms |
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
247 * The kilometer values. |
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
248 * @param qs |
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
249 * The discharge values. |
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
250 * @param wst |
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
251 * The WstValueTable used for the interpolation. |
362
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
252 * |
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
253 * @return an array of data triples that consist of W, Q and Kms. |
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
254 */ |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
255 private static CalculationResult computeWaterlevelData(final double[] kms, final double[] qs, final double[] ws, final WstValueTable wst, |
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
256 final double refKm, final Calculation report) { |
8202
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6625
diff
changeset
|
257 log.info("WINFOArtifact.computeWaterlevelData"); |
362
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
258 |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
259 final Calculation1 calc1 = new Calculation1(kms, qs, ws, refKm); |
636
58276db49b16
Generate fields for w/q input depend on flow direction.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
635
diff
changeset
|
260 |
2624
3f24865082da
Generate error message when more than one Q is found for given Q in "W auf freier Strecke".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2617
diff
changeset
|
261 if (report != null) { |
3f24865082da
Generate error message when more than one Q is found for given Q in "W auf freier Strecke".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2617
diff
changeset
|
262 calc1.addProblems(report); |
3f24865082da
Generate error message when more than one Q is found for given Q in "W auf freier Strecke".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2617
diff
changeset
|
263 } |
3f24865082da
Generate error message when more than one Q is found for given Q in "W auf freier Strecke".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2617
diff
changeset
|
264 |
709
3b7e9ddf6bb1
New model to transport data and error reports of calculations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
708
diff
changeset
|
265 return calc1.calculate(wst); |
124
b7a9557957d1
Appende the static data to the static node of the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
121
diff
changeset
|
266 } |
385
478940d06876
Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
380
diff
changeset
|
267 |
478940d06876
Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
380
diff
changeset
|
268 /** |
478940d06876
Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
380
diff
changeset
|
269 * Returns the data that is computed by a duration curve computation. |
478940d06876
Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
380
diff
changeset
|
270 * |
478940d06876
Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
380
diff
changeset
|
271 * @return the data computed by a duration curve computation. |
478940d06876
Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
380
diff
changeset
|
272 */ |
709
3b7e9ddf6bb1
New model to transport data and error reports of calculations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
708
diff
changeset
|
273 public CalculationResult getDurationCurveData() { |
8202
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6625
diff
changeset
|
274 log.debug("WINFOArtifact.getDurationCurveData"); |
385
478940d06876
Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
380
diff
changeset
|
275 |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
276 final RangeAccess rangeAccess = new RangeAccess(this); |
385
478940d06876
Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
380
diff
changeset
|
277 |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
278 final River r = rangeAccess.getRiver(); |
385
478940d06876
Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
380
diff
changeset
|
279 if (r == null) { |
2166
2898b1ff6013
I18N for WINFO calculation result messages.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2165
diff
changeset
|
280 return error(null, "no.river.selected"); |
385
478940d06876
Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
380
diff
changeset
|
281 } |
478940d06876
Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
380
diff
changeset
|
282 |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
283 final double[] locations = rangeAccess.getLocations(); |
8758
d4caab3fedde
A duration curve is always calculated for a single location.
Tom Gottfried <tom@intevation.de>
parents:
8757
diff
changeset
|
284 if (locations == null) { |
d4caab3fedde
A duration curve is always calculated for a single location.
Tom Gottfried <tom@intevation.de>
parents:
8757
diff
changeset
|
285 return error(null, "no.locations.selected"); |
d4caab3fedde
A duration curve is always calculated for a single location.
Tom Gottfried <tom@intevation.de>
parents:
8757
diff
changeset
|
286 } |
385
478940d06876
Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
380
diff
changeset
|
287 |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
288 final Gauge g = r.determineGaugeByPosition(locations[0]); |
385
478940d06876
Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
380
diff
changeset
|
289 if (g == null) { |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
290 return error(null, "no.gauge.selected"); |
385
478940d06876
Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
380
diff
changeset
|
291 } |
478940d06876
Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
380
diff
changeset
|
292 |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
293 final WstValueTable wst = WstValueTableFactory.getTable(r); |
385
478940d06876
Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
380
diff
changeset
|
294 if (wst == null) { |
2166
2898b1ff6013
I18N for WINFO calculation result messages.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2165
diff
changeset
|
295 return error(null, "no.wst.for.river"); |
385
478940d06876
Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
380
diff
changeset
|
296 } |
478940d06876
Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
380
diff
changeset
|
297 |
478940d06876
Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
380
diff
changeset
|
298 return computeDurationCurveData(g, wst, locations[0]); |
478940d06876
Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
380
diff
changeset
|
299 } |
478940d06876
Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
380
diff
changeset
|
300 |
478940d06876
Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
380
diff
changeset
|
301 /** |
478940d06876
Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
380
diff
changeset
|
302 * Computes the data used to create duration curves. |
478940d06876
Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
380
diff
changeset
|
303 * |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
304 * @param gauge |
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
305 * The selected gauge. |
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
306 * @param location |
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
307 * The selected location. |
385
478940d06876
Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
380
diff
changeset
|
308 * |
478940d06876
Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
380
diff
changeset
|
309 * @return the computed data. |
478940d06876
Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
380
diff
changeset
|
310 */ |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
311 private static CalculationResult computeDurationCurveData(final Gauge gauge, final WstValueTable wst, final double location) { |
8202
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6625
diff
changeset
|
312 log.info("WINFOArtifact.computeDurationCurveData"); |
385
478940d06876
Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
380
diff
changeset
|
313 |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
314 final Object[] obj = gauge.fetchDurationCurveData(); |
385
478940d06876
Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
380
diff
changeset
|
315 |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
316 final int[] days = (int[]) obj[0]; |
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
317 final double[] qs = (double[]) obj[1]; |
385
478940d06876
Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
380
diff
changeset
|
318 |
9534
b380a5693514
Calculation of Dauerlinie corrected in WInfo (fix wst position according to a reference gauge, km specific discharge instead of that of the gauge);
mschaefer
parents:
9479
diff
changeset
|
319 final Calculation3 calculation = new Calculation3(location, days, qs, gauge.getStation().doubleValue()); |
385
478940d06876
Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
380
diff
changeset
|
320 |
686
3dc61e00385e
Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
661
diff
changeset
|
321 return calculation.calculate(wst); |
385
478940d06876
Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
380
diff
changeset
|
322 } |
393
befedd7629d5
Enabled the WINFO artifact to compute the data for discharge curves (computed) - ComputedDischargeCurveGenerator uses those values now to create the chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
385
diff
changeset
|
323 |
befedd7629d5
Enabled the WINFO artifact to compute the data for discharge curves (computed) - ComputedDischargeCurveGenerator uses those values now to create the chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
385
diff
changeset
|
324 /** |
befedd7629d5
Enabled the WINFO artifact to compute the data for discharge curves (computed) - ComputedDischargeCurveGenerator uses those values now to create the chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
385
diff
changeset
|
325 * Returns the data that is computed by a discharge curve computation. |
befedd7629d5
Enabled the WINFO artifact to compute the data for discharge curves (computed) - ComputedDischargeCurveGenerator uses those values now to create the chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
385
diff
changeset
|
326 * |
befedd7629d5
Enabled the WINFO artifact to compute the data for discharge curves (computed) - ComputedDischargeCurveGenerator uses those values now to create the chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
385
diff
changeset
|
327 * @return the data computed by a discharge curve computation. |
befedd7629d5
Enabled the WINFO artifact to compute the data for discharge curves (computed) - ComputedDischargeCurveGenerator uses those values now to create the chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
385
diff
changeset
|
328 */ |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
329 public CalculationResult getComputedDischargeCurveData() throws NullPointerException { |
8202
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6625
diff
changeset
|
330 log.debug("WINFOArtifact.getComputedDischargeCurveData"); |
393
befedd7629d5
Enabled the WINFO artifact to compute the data for discharge curves (computed) - ComputedDischargeCurveGenerator uses those values now to create the chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
385
diff
changeset
|
331 |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
332 final River r = RiverUtils.getRiver(this); |
393
befedd7629d5
Enabled the WINFO artifact to compute the data for discharge curves (computed) - ComputedDischargeCurveGenerator uses those values now to create the chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
385
diff
changeset
|
333 |
befedd7629d5
Enabled the WINFO artifact to compute the data for discharge curves (computed) - ComputedDischargeCurveGenerator uses those values now to create the chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
385
diff
changeset
|
334 if (r == null) { |
2166
2898b1ff6013
I18N for WINFO calculation result messages.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2165
diff
changeset
|
335 return error(new WQKms[0], "no.river.selected"); |
393
befedd7629d5
Enabled the WINFO artifact to compute the data for discharge curves (computed) - ComputedDischargeCurveGenerator uses those values now to create the chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
385
diff
changeset
|
336 } |
befedd7629d5
Enabled the WINFO artifact to compute the data for discharge curves (computed) - ComputedDischargeCurveGenerator uses those values now to create the chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
385
diff
changeset
|
337 |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
338 final RangeAccess rangeAccess = new RangeAccess(this); |
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
339 final double[] locations = rangeAccess.getLocations(); |
393
befedd7629d5
Enabled the WINFO artifact to compute the data for discharge curves (computed) - ComputedDischargeCurveGenerator uses those values now to create the chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
385
diff
changeset
|
340 |
befedd7629d5
Enabled the WINFO artifact to compute the data for discharge curves (computed) - ComputedDischargeCurveGenerator uses those values now to create the chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
385
diff
changeset
|
341 if (locations == null) { |
2166
2898b1ff6013
I18N for WINFO calculation result messages.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2165
diff
changeset
|
342 return error(new WQKms[0], "no.locations.selected"); |
393
befedd7629d5
Enabled the WINFO artifact to compute the data for discharge curves (computed) - ComputedDischargeCurveGenerator uses those values now to create the chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
385
diff
changeset
|
343 } |
befedd7629d5
Enabled the WINFO artifact to compute the data for discharge curves (computed) - ComputedDischargeCurveGenerator uses those values now to create the chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
385
diff
changeset
|
344 |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
345 final WstValueTable wst = WstValueTableFactory.getTable(r); |
393
befedd7629d5
Enabled the WINFO artifact to compute the data for discharge curves (computed) - ComputedDischargeCurveGenerator uses those values now to create the chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
385
diff
changeset
|
346 if (wst == null) { |
2166
2898b1ff6013
I18N for WINFO calculation result messages.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2165
diff
changeset
|
347 return error(new WQKms[0], "no.wst.for.river"); |
393
befedd7629d5
Enabled the WINFO artifact to compute the data for discharge curves (computed) - ComputedDischargeCurveGenerator uses those values now to create the chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
385
diff
changeset
|
348 } |
befedd7629d5
Enabled the WINFO artifact to compute the data for discharge curves (computed) - ComputedDischargeCurveGenerator uses those values now to create the chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
385
diff
changeset
|
349 |
709
3b7e9ddf6bb1
New model to transport data and error reports of calculations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
708
diff
changeset
|
350 return computeDischargeCurveData(wst, locations[0]); |
456
af1b64ec7250
The curve of a computed discharge curve has a human readable text now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
455
diff
changeset
|
351 } |
af1b64ec7250
The curve of a computed discharge curve has a human readable text now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
455
diff
changeset
|
352 |
af1b64ec7250
The curve of a computed discharge curve has a human readable text now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
455
diff
changeset
|
353 /** |
393
befedd7629d5
Enabled the WINFO artifact to compute the data for discharge curves (computed) - ComputedDischargeCurveGenerator uses those values now to create the chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
385
diff
changeset
|
354 * Computes the data used to create computed discharge curves. |
befedd7629d5
Enabled the WINFO artifact to compute the data for discharge curves (computed) - ComputedDischargeCurveGenerator uses those values now to create the chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
385
diff
changeset
|
355 * |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
356 * @param wst |
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
357 * The WstValueTable that is used for the interpolation (river- |
3272
31168ac9c7e7
Partial fix for issue694 (heightmarks snap to nearest cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3233
diff
changeset
|
358 * bound). |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
359 * @param location |
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
360 * The location where the computation should be based on. |
393
befedd7629d5
Enabled the WINFO artifact to compute the data for discharge curves (computed) - ComputedDischargeCurveGenerator uses those values now to create the chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
385
diff
changeset
|
361 * |
befedd7629d5
Enabled the WINFO artifact to compute the data for discharge curves (computed) - ComputedDischargeCurveGenerator uses those values now to create the chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
385
diff
changeset
|
362 * @return an object that contains tuples of W/Q values at the specified |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
363 * location. |
393
befedd7629d5
Enabled the WINFO artifact to compute the data for discharge curves (computed) - ComputedDischargeCurveGenerator uses those values now to create the chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
385
diff
changeset
|
364 */ |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
365 private static CalculationResult computeDischargeCurveData(final WstValueTable wst, final double location) { |
8202
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6625
diff
changeset
|
366 log.info("WINFOArtifact.computeDischargeCurveData"); |
393
befedd7629d5
Enabled the WINFO artifact to compute the data for discharge curves (computed) - ComputedDischargeCurveGenerator uses those values now to create the chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
385
diff
changeset
|
367 |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
368 final Calculation2 calculation = new Calculation2(location); |
393
befedd7629d5
Enabled the WINFO artifact to compute the data for discharge curves (computed) - ComputedDischargeCurveGenerator uses those values now to create the chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
385
diff
changeset
|
369 |
709
3b7e9ddf6bb1
New model to transport data and error reports of calculations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
708
diff
changeset
|
370 return calculation.calculate(wst); |
3b7e9ddf6bb1
New model to transport data and error reports of calculations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
708
diff
changeset
|
371 } |
393
befedd7629d5
Enabled the WINFO artifact to compute the data for discharge curves (computed) - ComputedDischargeCurveGenerator uses those values now to create the chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
385
diff
changeset
|
372 |
3272
31168ac9c7e7
Partial fix for issue694 (heightmarks snap to nearest cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3233
diff
changeset
|
373 /** Create CalculationResult with data and message. */ |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
374 protected static final CalculationResult error(final Object data, final String msg) { |
709
3b7e9ddf6bb1
New model to transport data and error reports of calculations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
708
diff
changeset
|
375 return new CalculationResult(data, new Calculation(msg)); |
393
befedd7629d5
Enabled the WINFO artifact to compute the data for discharge curves (computed) - ComputedDischargeCurveGenerator uses those values now to create the chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
385
diff
changeset
|
376 } |
402
eb22ffe4d74c
Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
393
diff
changeset
|
377 |
5786
470460bfb5fc
issue1289: Show km station with certain error message.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
5400
diff
changeset
|
378 /** Create CalculationResult with data and message with args. */ |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
379 protected static final CalculationResult error(final Object data, final String msg, final Object... args) { |
5786
470460bfb5fc
issue1289: Show km station with certain error message.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
5400
diff
changeset
|
380 return new CalculationResult(data, new Calculation(msg, args)); |
470460bfb5fc
issue1289: Show km station with certain error message.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
5400
diff
changeset
|
381 } |
470460bfb5fc
issue1289: Show km station with certain error message.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
5400
diff
changeset
|
382 |
402
eb22ffe4d74c
Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
393
diff
changeset
|
383 /** |
2194
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
384 * Returns the data that is computed by a reference curve computation. |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
385 * |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
386 * @return the data computed by a reference curve computation. |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
387 */ |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
388 public CalculationResult getReferenceCurveData(final CallContext context) { |
2194
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
389 |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
390 final Double startKm = getReferenceStartKm(); |
2194
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
391 |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
392 if (startKm == null) { |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
393 return error(new WW[0], "no.reference.start.km"); |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
394 } |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
395 |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
396 final double[] endKms = getReferenceEndKms(); |
2194
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
397 |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
398 if (endKms == null || endKms.length == 0) { |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
399 return error(new WW[0], "no.reference.end.kms"); |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
400 } |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
401 |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
402 final Calculation5 calc5 = new Calculation5(startKm, endKms); |
2194
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
403 |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
404 final River r = RiverUtils.getRiver(this); |
2194
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
405 if (r == null) { |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
406 return error(new WW[0], "no.river.found"); |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
407 } |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
408 |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
409 final WstValueTable wst = WstValueTableFactory.getTable(r); |
2194
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
410 if (wst == null) { |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
411 return error(new WW[0], "no.wst.for.river"); |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
412 } |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
413 |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
414 final Map<Double, Double> kms2gaugeDatums = r.queryGaugeDatumsKMs(); |
2256
dd93a8e1377a
First steps to serve the data in cm if we are are gauges only.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2251
diff
changeset
|
415 |
2326
c321b39b39ab
'Bezugslinienverfahren': Generate valid i18n names for datasets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2309
diff
changeset
|
416 return calc5.calculate(wst, kms2gaugeDatums, context); |
2194
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
417 } |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
418 |
2251
c9c788eea200
Improved reference curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2229
diff
changeset
|
419 /** Get reference (start) km. */ |
2754
832f7bd45f9e
Made data accessors for reference curve parameter public.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2733
diff
changeset
|
420 public Double getReferenceStartKm() { |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
421 final StateData sd = getData("reference_startpoint"); |
2194
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
422 |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
423 if (sd == null) { |
8202
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6625
diff
changeset
|
424 log.warn("no reference start given."); |
2194
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
425 return null; |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
426 } |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
427 |
8202
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6625
diff
changeset
|
428 log.debug("Reference start km given: " + sd.getValue()); |
2251
c9c788eea200
Improved reference curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2229
diff
changeset
|
429 |
c9c788eea200
Improved reference curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2229
diff
changeset
|
430 String input = (String) sd.getValue(); |
2194
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
431 |
2726
f53173a8736b
Fixings state access: Added more debug putput
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2652
diff
changeset
|
432 if (input == null || (input = input.trim()).length() == 0) { |
8202
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6625
diff
changeset
|
433 log.warn("reference start string is empty."); |
2194
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
434 return null; |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
435 } |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
436 |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
437 try { |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
438 return Double.valueOf(input); |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
439 } |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
440 catch (final NumberFormatException nfe) { |
8202
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6625
diff
changeset
|
441 log.warn("reference start string is not numeric."); |
2194
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
442 } |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
443 |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
444 return null; |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
445 } |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
446 |
2754
832f7bd45f9e
Made data accessors for reference curve parameter public.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2733
diff
changeset
|
447 /** |
832f7bd45f9e
Made data accessors for reference curve parameter public.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2733
diff
changeset
|
448 * Get end kms for reference curve (null if none). |
832f7bd45f9e
Made data accessors for reference curve parameter public.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2733
diff
changeset
|
449 */ |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
450 public double[] getReferenceEndKms() { |
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
451 final StateData sd = getData("reference_endpoint"); |
2194
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
452 |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
453 if (sd == null) { |
8202
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6625
diff
changeset
|
454 log.warn("no reference end given."); |
2194
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
455 return null; |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
456 } else { |
8202
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6625
diff
changeset
|
457 log.debug("Reference end km : " + sd.getValue()); |
2251
c9c788eea200
Improved reference curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2229
diff
changeset
|
458 } |
2194
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
459 |
2251
c9c788eea200
Improved reference curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2229
diff
changeset
|
460 String input = (String) sd.getValue(); |
2194
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
461 |
2415
64dd65aa620d
Partial fix for flys/issue499
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2326
diff
changeset
|
462 if (input == null || (input = input.trim()).length() == 0) { |
8202
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6625
diff
changeset
|
463 log.warn("reference end string is empty."); |
2194
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
464 return null; |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
465 } |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
466 |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
467 final TDoubleArrayList endKms = new TDoubleArrayList(); |
2194
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
468 |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
469 for (final String part : input.split("\\s+")) { |
2194
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
470 try { |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
471 final double km = Double.parseDouble(part); |
2309
92640472e563
Prevent duplicates in end kms for reference curve calculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2308
diff
changeset
|
472 if (!endKms.contains(km)) { |
92640472e563
Prevent duplicates in end kms for reference curve calculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2308
diff
changeset
|
473 endKms.add(km); |
92640472e563
Prevent duplicates in end kms for reference curve calculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2308
diff
changeset
|
474 } |
2194
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
475 } |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
476 catch (final NumberFormatException nfe) { |
8202
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6625
diff
changeset
|
477 log.warn("reference end string is not numeric."); |
2194
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
478 } |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
479 } |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
480 |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
481 return endKms.toNativeArray(); |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
482 } |
1137
073c36bb94ed
Minor cosmetics
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1125
diff
changeset
|
483 |
1122
111794adf285
Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1116
diff
changeset
|
484 /** |
3124
555ed85af32e
fix issue680; hack.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3123
diff
changeset
|
485 * Get corrected waterline against surface/profile. |
555ed85af32e
fix issue680; hack.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3123
diff
changeset
|
486 */ |
9479
2b83d3a96703
i18n TODO "benutzerdefiniert" = "custom" fixed
gernotbelger
parents:
9425
diff
changeset
|
487 private double waterLineC(final int idx, final double currentKm, final CallMeta meta) { |
3124
555ed85af32e
fix issue680; hack.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3123
diff
changeset
|
488 |
9479
2b83d3a96703
i18n TODO "benutzerdefiniert" = "custom" fixed
gernotbelger
parents:
9425
diff
changeset
|
489 final WQKms[] wqckms = (WQKms[]) getDischargeLongitudinalSectionData(meta).getData(); |
3124
555ed85af32e
fix issue680; hack.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3123
diff
changeset
|
490 |
555ed85af32e
fix issue680; hack.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3123
diff
changeset
|
491 // Find index of km. |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
492 final double wishKM = currentKm; |
3124
555ed85af32e
fix issue680; hack.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3123
diff
changeset
|
493 |
555ed85af32e
fix issue680; hack.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3123
diff
changeset
|
494 // Find W/C at km, linear naive approach. |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
495 final WQCKms triple = (WQCKms) wqckms[idx - 1]; |
3124
555ed85af32e
fix issue680; hack.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3123
diff
changeset
|
496 |
555ed85af32e
fix issue680; hack.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3123
diff
changeset
|
497 if (triple.size() == 0) { |
8202
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6625
diff
changeset
|
498 log.warn("Calculation of c/waterline is empty."); |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
499 return Double.NaN; |
3124
555ed85af32e
fix issue680; hack.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3123
diff
changeset
|
500 } |
555ed85af32e
fix issue680; hack.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3123
diff
changeset
|
501 |
555ed85af32e
fix issue680; hack.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3123
diff
changeset
|
502 // Linear seach in WQKms for closest km. |
555ed85af32e
fix issue680; hack.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3123
diff
changeset
|
503 double old_dist_wish = Math.abs(wishKM - triple.getKm(0)); |
555ed85af32e
fix issue680; hack.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3123
diff
changeset
|
504 double last_c = triple.getC(0); |
555ed85af32e
fix issue680; hack.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3123
diff
changeset
|
505 |
555ed85af32e
fix issue680; hack.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3123
diff
changeset
|
506 for (int i = 0, T = triple.size(); i < T; i++) { |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
507 final double diff = Math.abs(wishKM - triple.getKm(i)); |
3124
555ed85af32e
fix issue680; hack.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3123
diff
changeset
|
508 if (diff > old_dist_wish) { |
555ed85af32e
fix issue680; hack.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3123
diff
changeset
|
509 break; |
555ed85af32e
fix issue680; hack.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3123
diff
changeset
|
510 } |
555ed85af32e
fix issue680; hack.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3123
diff
changeset
|
511 last_c = triple.getC(i); |
555ed85af32e
fix issue680; hack.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3123
diff
changeset
|
512 old_dist_wish = diff; |
555ed85af32e
fix issue680; hack.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3123
diff
changeset
|
513 } |
555ed85af32e
fix issue680; hack.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3123
diff
changeset
|
514 |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
515 return last_c; |
3124
555ed85af32e
fix issue680; hack.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3123
diff
changeset
|
516 } |
555ed85af32e
fix issue680; hack.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3123
diff
changeset
|
517 |
555ed85af32e
fix issue680; hack.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3123
diff
changeset
|
518 /** |
1122
111794adf285
Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1116
diff
changeset
|
519 * Get points of line describing the surface of water at cross section. |
111794adf285
Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1116
diff
changeset
|
520 * |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
521 * @param idx |
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
522 * Index for getWaterlevelData. |
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
523 * @param csl |
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
524 * The profile/surface to fill with water. |
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
525 * @param nextIgnored |
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
526 * Ignored in this implementation of WaterLineArtifact. |
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
527 * @param prevIgnored |
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
528 * Ignored in this implementation of WaterLineArtifact. |
3123
edf629d43f05
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3076
diff
changeset
|
529 * |
1122
111794adf285
Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1116
diff
changeset
|
530 * @return an array holding coordinates of points of surface of water ( |
111794adf285
Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1116
diff
changeset
|
531 * in the form {{x1, x2} {y1, y2}} ). |
111794adf285
Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1116
diff
changeset
|
532 */ |
2652
9d2a06c3a134
Added DataType for lines that also stores width, use it. Added HasLabel interface for some series.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2624
diff
changeset
|
533 @Override |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
534 public double getWaterLevel(final ComputeType type, final String hash, final String stateId, final double currentKm, final Serializable waterLineIndex, |
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
535 final double nextKm, final double prevKm, final CallContext context) { |
1975
b30e1710df1d
Server-side of interactive cross-section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1974
diff
changeset
|
536 |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
537 final int idx = (int) waterLineIndex; |
1802
26d7077e42d2
Corrected CrossSection diagram/out to include one facet per computed waterlevel.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1777
diff
changeset
|
538 |
1139
6d9b08b958e2
Fix waterline in crosssection diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1138
diff
changeset
|
539 // Need W at km |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
540 final Object waterlevelResult = getWaterlevelData(context).getData(); |
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
541 WQKms[] wqkms; |
4479
5fc7df736634
WINFOArtifact: Compute extreme values for cross sections too. Add CS-Facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4478
diff
changeset
|
542 |
5fc7df736634
WINFOArtifact: Compute extreme values for cross sections too. Add CS-Facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4478
diff
changeset
|
543 if (waterlevelResult instanceof ExtremeResult) { |
5fc7df736634
WINFOArtifact: Compute extreme values for cross sections too. Add CS-Facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4478
diff
changeset
|
544 wqkms = ((ExtremeResult) waterlevelResult).getWQKms(); |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
545 } else { |
4479
5fc7df736634
WINFOArtifact: Compute extreme values for cross sections too. Add CS-Facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4478
diff
changeset
|
546 wqkms = (WQKms[]) waterlevelResult; |
5fc7df736634
WINFOArtifact: Compute extreme values for cross sections too. Add CS-Facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4478
diff
changeset
|
547 } |
5fc7df736634
WINFOArtifact: Compute extreme values for cross sections too. Add CS-Facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4478
diff
changeset
|
548 |
1139
6d9b08b958e2
Fix waterline in crosssection diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1138
diff
changeset
|
549 if (wqkms.length == 0) { |
8202
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6625
diff
changeset
|
550 log.error("No WQKms found."); |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
551 return Double.NaN; |
1139
6d9b08b958e2
Fix waterline in crosssection diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1138
diff
changeset
|
552 } |
6d9b08b958e2
Fix waterline in crosssection diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1138
diff
changeset
|
553 |
3123
edf629d43f05
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3076
diff
changeset
|
554 if (wqkms.length <= idx) { |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
555 log.error("getWaterLines() requested index (" + idx + " not found."); |
9479
2b83d3a96703
i18n TODO "benutzerdefiniert" = "custom" fixed
gernotbelger
parents:
9425
diff
changeset
|
556 return waterLineC(idx, currentKm, context.getMeta()); |
1651
a7def20539fb
flys/issue317: Removed dependency from cross section demo app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1157
diff
changeset
|
557 } |
1802
26d7077e42d2
Corrected CrossSection diagram/out to include one facet per computed waterlevel.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1777
diff
changeset
|
558 |
4479
5fc7df736634
WINFOArtifact: Compute extreme values for cross sections too. Add CS-Facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4478
diff
changeset
|
559 // Find W at km, linear naive approach. |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
560 final WQKms triple = wqkms[idx]; |
4479
5fc7df736634
WINFOArtifact: Compute extreme values for cross sections too. Add CS-Facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4478
diff
changeset
|
561 |
3124
555ed85af32e
fix issue680; hack.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3123
diff
changeset
|
562 // Find index of km. |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
563 final double wishKM = currentKm; |
3124
555ed85af32e
fix issue680; hack.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3123
diff
changeset
|
564 |
1651
a7def20539fb
flys/issue317: Removed dependency from cross section demo app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1157
diff
changeset
|
565 if (triple.size() == 0) { |
8202
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6625
diff
changeset
|
566 log.warn("Calculation of waterline is empty."); |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
567 return Double.NaN; |
1651
a7def20539fb
flys/issue317: Removed dependency from cross section demo app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1157
diff
changeset
|
568 } |
a7def20539fb
flys/issue317: Removed dependency from cross section demo app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1157
diff
changeset
|
569 |
3892
1dc658c3306b
Fix issue886 (no extrapolation of waterlines).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3785
diff
changeset
|
570 // Early abort if we would need to extrapolate. |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
571 final int T = triple.size(); |
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
572 final double max_km = triple.getKm(T - 1), min_km = triple.getKm(0); |
3892
1dc658c3306b
Fix issue886 (no extrapolation of waterlines).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3785
diff
changeset
|
573 if (wishKM < min_km || wishKM > max_km) { |
1dc658c3306b
Fix issue886 (no extrapolation of waterlines).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3785
diff
changeset
|
574 // TODO Does this have to be done in the other WaterlineArtifact |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
575 // implementations, too? |
8202
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6625
diff
changeset
|
576 log.warn("Will not extrapolate waterlevels."); |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
577 return Double.NaN; |
3892
1dc658c3306b
Fix issue886 (no extrapolation of waterlines).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3785
diff
changeset
|
578 } |
1dc658c3306b
Fix issue886 (no extrapolation of waterlines).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3785
diff
changeset
|
579 |
1651
a7def20539fb
flys/issue317: Removed dependency from cross section demo app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1157
diff
changeset
|
580 // Linear seach in WQKms for closest km. |
a7def20539fb
flys/issue317: Removed dependency from cross section demo app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1157
diff
changeset
|
581 double old_dist_wish = Math.abs(wishKM - triple.getKm(0)); |
a7def20539fb
flys/issue317: Removed dependency from cross section demo app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1157
diff
changeset
|
582 double last_w = triple.getW(0); |
a7def20539fb
flys/issue317: Removed dependency from cross section demo app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1157
diff
changeset
|
583 |
3892
1dc658c3306b
Fix issue886 (no extrapolation of waterlines).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3785
diff
changeset
|
584 for (int i = 0; i < T; i++) { |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
585 final double diff = Math.abs(wishKM - triple.getKm(i)); |
1651
a7def20539fb
flys/issue317: Removed dependency from cross section demo app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1157
diff
changeset
|
586 if (diff > old_dist_wish) { |
a7def20539fb
flys/issue317: Removed dependency from cross section demo app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1157
diff
changeset
|
587 break; |
1139
6d9b08b958e2
Fix waterline in crosssection diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1138
diff
changeset
|
588 } |
1651
a7def20539fb
flys/issue317: Removed dependency from cross section demo app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1157
diff
changeset
|
589 last_w = triple.getW(i); |
a7def20539fb
flys/issue317: Removed dependency from cross section demo app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1157
diff
changeset
|
590 old_dist_wish = diff; |
1139
6d9b08b958e2
Fix waterline in crosssection diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1138
diff
changeset
|
591 } |
3123
edf629d43f05
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3076
diff
changeset
|
592 |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
593 return last_w; |
1122
111794adf285
Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1116
diff
changeset
|
594 } |
111794adf285
Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1116
diff
changeset
|
595 |
111794adf285
Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1116
diff
changeset
|
596 /** |
8728
f51b9305d338
(issue1801) Reference gauge for waterlevel calculation depends on direction of calculation or flow direction.
Tom Gottfried <tom@intevation.de>
parents:
8704
diff
changeset
|
597 * Returns the Qs for a number of Ws. |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
598 * |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
599 * @param ws |
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
600 * An array of W values. |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
601 * |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
602 * @return an array of Q values. |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
603 */ |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
604 private double[][] getQsForWs(final double[] ws, final Calculation report) { |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
605 |
2415
64dd65aa620d
Partial fix for flys/issue499
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2326
diff
changeset
|
606 if (ws == null) { |
8202
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6625
diff
changeset
|
607 log.error("getQsForWs: ws == null"); |
2415
64dd65aa620d
Partial fix for flys/issue499
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2326
diff
changeset
|
608 return null; |
64dd65aa620d
Partial fix for flys/issue499
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2326
diff
changeset
|
609 } |
64dd65aa620d
Partial fix for flys/issue499
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2326
diff
changeset
|
610 |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
611 final boolean debug = log.isDebugEnabled(); |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
612 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
613 if (debug) { |
8202
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6625
diff
changeset
|
614 log.debug("D4EArtifact.getQsForWs"); |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
615 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
616 |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
617 final River r = RiverUtils.getRiver(this); |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
618 if (r == null) { |
8202
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6625
diff
changeset
|
619 log.warn("no river found"); |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
620 return null; |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
621 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
622 |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
623 final RangeAccess rangeAccess = new RangeAccess(this); |
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
624 final double[] range = rangeAccess.getKmRange(); |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
625 if (range == null) { |
8202
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6625
diff
changeset
|
626 log.warn("no ranges found"); |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
627 return null; |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
628 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
629 |
2164
d548e2e13524
Added code for the simple case of "Bezugslinienverfahren" ("W auf freier Strecke").
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2126
diff
changeset
|
630 if (isFreeW()) { |
8202
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6625
diff
changeset
|
631 log.debug("Bezugslinienverfahren I: W auf freier Strecke"); |
2165
637dd38d0e2f
Handle the case in "W auf freier Strecke" where more than ne Q is related to a W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2164
diff
changeset
|
632 // The simple case of the "Bezugslinienverfahren" |
637dd38d0e2f
Handle the case in "W auf freier Strecke" where more than ne Q is related to a W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2164
diff
changeset
|
633 // "W auf freier Strecke". |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
634 final WstValueTable wst = WstValueTableFactory.getTable(r); |
2164
d548e2e13524
Added code for the simple case of "Bezugslinienverfahren" ("W auf freier Strecke").
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2126
diff
changeset
|
635 if (wst == null) { |
8202
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6625
diff
changeset
|
636 log.warn("no wst value table found"); |
2164
d548e2e13524
Added code for the simple case of "Bezugslinienverfahren" ("W auf freier Strecke").
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2126
diff
changeset
|
637 return null; |
d548e2e13524
Added code for the simple case of "Bezugslinienverfahren" ("W auf freier Strecke").
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2126
diff
changeset
|
638 } |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
639 final double km = range[0]; |
2164
d548e2e13524
Added code for the simple case of "Bezugslinienverfahren" ("W auf freier Strecke").
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2126
diff
changeset
|
640 |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
641 final TDoubleArrayList outQs = new TDoubleArrayList(ws.length); |
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
642 final TDoubleArrayList outWs = new TDoubleArrayList(ws.length); |
2165
637dd38d0e2f
Handle the case in "W auf freier Strecke" where more than ne Q is related to a W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2164
diff
changeset
|
643 |
637dd38d0e2f
Handle the case in "W auf freier Strecke" where more than ne Q is related to a W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2164
diff
changeset
|
644 boolean generatedWs = false; |
2164
d548e2e13524
Added code for the simple case of "Bezugslinienverfahren" ("W auf freier Strecke").
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2126
diff
changeset
|
645 |
9479
2b83d3a96703
i18n TODO "benutzerdefiniert" = "custom" fixed
gernotbelger
parents:
9425
diff
changeset
|
646 for (final double w : ws) { |
2415
64dd65aa620d
Partial fix for flys/issue499
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2326
diff
changeset
|
647 if (debug) { |
8202
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6625
diff
changeset
|
648 log.debug("getQsForWs: lookup Q for W: " + w); |
2415
64dd65aa620d
Partial fix for flys/issue499
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2326
diff
changeset
|
649 } |
8704
93a31cfb18c0
(issue1787) Sort WQ data locally over Q bevor lookup of Qs for given W.
Tom Gottfried <tom@intevation.de>
parents:
8565
diff
changeset
|
650 // There could be more than one Q per W. |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
651 final double[] qs = wst.findQsForW(km, w, report); |
9479
2b83d3a96703
i18n TODO "benutzerdefiniert" = "custom" fixed
gernotbelger
parents:
9425
diff
changeset
|
652 for (final double element : qs) { |
2b83d3a96703
i18n TODO "benutzerdefiniert" = "custom" fixed
gernotbelger
parents:
9425
diff
changeset
|
653 outWs.add(w); |
2b83d3a96703
i18n TODO "benutzerdefiniert" = "custom" fixed
gernotbelger
parents:
9425
diff
changeset
|
654 outQs.add(element); |
2164
d548e2e13524
Added code for the simple case of "Bezugslinienverfahren" ("W auf freier Strecke").
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2126
diff
changeset
|
655 } |
2165
637dd38d0e2f
Handle the case in "W auf freier Strecke" where more than ne Q is related to a W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2164
diff
changeset
|
656 generatedWs |= qs.length != 1; |
2164
d548e2e13524
Added code for the simple case of "Bezugslinienverfahren" ("W auf freier Strecke").
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2126
diff
changeset
|
657 } |
d548e2e13524
Added code for the simple case of "Bezugslinienverfahren" ("W auf freier Strecke").
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2126
diff
changeset
|
658 |
2415
64dd65aa620d
Partial fix for flys/issue499
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2326
diff
changeset
|
659 if (debug) { |
8202
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6625
diff
changeset
|
660 log.debug("getQsForWs: number of Qs: " + outQs.size()); |
2415
64dd65aa620d
Partial fix for flys/issue499
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2326
diff
changeset
|
661 } |
64dd65aa620d
Partial fix for flys/issue499
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2326
diff
changeset
|
662 |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
663 return new double[][] { outQs.toNativeArray(), generatedWs ? outWs.toNativeArray() : null }; |
2164
d548e2e13524
Added code for the simple case of "Bezugslinienverfahren" ("W auf freier Strecke").
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2126
diff
changeset
|
664 } |
d548e2e13524
Added code for the simple case of "Bezugslinienverfahren" ("W auf freier Strecke").
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2126
diff
changeset
|
665 |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
666 if (debug) { |
8202
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6625
diff
changeset
|
667 log.debug("range: " + Arrays.toString(range)); |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
668 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
669 |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
670 final Gauge g = rangeAccess.getRiver().determineRefGauge(range, rangeAccess.isRange()); |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
671 if (g == null) { |
8202
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6625
diff
changeset
|
672 log.warn("no gauge found for km: " + range[0]); |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
673 return null; |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
674 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
675 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
676 if (debug) { |
8202
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6625
diff
changeset
|
677 log.debug("convert w->q with gauge '" + g.getName() + "'"); |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
678 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
679 |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
680 final DischargeTable dt = g.fetchMasterDischargeTable(); |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
681 |
2418
899ca89f497e
Another partial fix for flys/issue499: Do the W to Q conversions
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2415
diff
changeset
|
682 if (dt == null) { |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
683 log.warn("No master discharge table found for gauge '" + g.getName() + "'"); |
2418
899ca89f497e
Another partial fix for flys/issue499: Do the W to Q conversions
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2415
diff
changeset
|
684 return null; |
899ca89f497e
Another partial fix for flys/issue499: Do the W to Q conversions
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2415
diff
changeset
|
685 } |
899ca89f497e
Another partial fix for flys/issue499: Do the W to Q conversions
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2415
diff
changeset
|
686 |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
687 final double[][] values = DischargeTables.loadDischargeTableValues(dt); |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
688 |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
689 final TDoubleArrayList wsOut = new TDoubleArrayList(ws.length); |
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
690 final TDoubleArrayList qsOut = new TDoubleArrayList(ws.length); |
2415
64dd65aa620d
Partial fix for flys/issue499
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2326
diff
changeset
|
691 |
2418
899ca89f497e
Another partial fix for flys/issue499: Do the W to Q conversions
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2415
diff
changeset
|
692 boolean generatedWs = false; |
899ca89f497e
Another partial fix for flys/issue499: Do the W to Q conversions
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2415
diff
changeset
|
693 |
9479
2b83d3a96703
i18n TODO "benutzerdefiniert" = "custom" fixed
gernotbelger
parents:
9425
diff
changeset
|
694 for (final double element : ws) { |
2b83d3a96703
i18n TODO "benutzerdefiniert" = "custom" fixed
gernotbelger
parents:
9425
diff
changeset
|
695 if (Double.isNaN(element)) { |
8202
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6625
diff
changeset
|
696 log.warn("W is NaN: ignored"); |
2415
64dd65aa620d
Partial fix for flys/issue499
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2326
diff
changeset
|
697 continue; |
64dd65aa620d
Partial fix for flys/issue499
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2326
diff
changeset
|
698 } |
9479
2b83d3a96703
i18n TODO "benutzerdefiniert" = "custom" fixed
gernotbelger
parents:
9425
diff
changeset
|
699 final double[] qs = DischargeTables.getQsForW(values, element); |
2418
899ca89f497e
Another partial fix for flys/issue499: Do the W to Q conversions
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2415
diff
changeset
|
700 |
899ca89f497e
Another partial fix for flys/issue499: Do the W to Q conversions
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2415
diff
changeset
|
701 if (qs.length == 0) { |
9479
2b83d3a96703
i18n TODO "benutzerdefiniert" = "custom" fixed
gernotbelger
parents:
9425
diff
changeset
|
702 log.warn("No Qs found for W = " + element); |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
703 } else { |
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
704 for (final double q : qs) { |
9479
2b83d3a96703
i18n TODO "benutzerdefiniert" = "custom" fixed
gernotbelger
parents:
9425
diff
changeset
|
705 wsOut.add(element); |
6301
20a32dbdbb59
Remove discharge table scaling but add reference system to W
Andre Heinecke <aheinecke@intevation.de>
parents:
6101
diff
changeset
|
706 qsOut.add(q); |
2418
899ca89f497e
Another partial fix for flys/issue499: Do the W to Q conversions
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2415
diff
changeset
|
707 } |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
708 } |
2418
899ca89f497e
Another partial fix for flys/issue499: Do the W to Q conversions
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2415
diff
changeset
|
709 generatedWs |= qs.length != 1; |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
710 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
711 |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
712 return new double[][] { qsOut.toNativeArray(), generatedWs ? wsOut.toNativeArray() : null }; |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
713 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
714 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
715 /** |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
716 * Returns the selected distance based on a given range (from, to). |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
717 * |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
718 * @param dFrom |
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
719 * The StateData that contains the lower value. |
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
720 * @param dTo |
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
721 * The StateData that contains the upper value. |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
722 * |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
723 * @return the selected distance. |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
724 */ |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
725 protected double[] getDistanceByRange(final StateData dFrom, final StateData dTo) { |
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
726 final double from = Double.parseDouble((String) dFrom.getValue()); |
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
727 final double to = Double.parseDouble((String) dTo.getValue()); |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
728 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
729 return new double[] { from, to }; |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
730 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
731 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
732 /** |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
733 * This method returns the Q values. |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
734 * |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
735 * @return the selected Q values or null, if no Q values are selected. |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
736 */ |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
737 public double[] getQs() { |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
738 final StateData dMode = getData("wq_isq"); |
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
739 final StateData dSelection = getData("wq_isrange"); |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
740 |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
741 final boolean isRange = dSelection != null ? Boolean.valueOf((String) dSelection.getValue()) : false; |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
742 |
2422
44dc117aa2b7
Picked rev 4058,4063,4065,4068,4069 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2418
diff
changeset
|
743 if (isQ()) { |
44dc117aa2b7
Picked rev 4058,4063,4065,4068,4069 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2418
diff
changeset
|
744 if (!isRange) { |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
745 return getSingleWQValues(); |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
746 } else { |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
747 return getWQTriple(); |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
748 } |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
749 } else { |
8202
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6625
diff
changeset
|
750 log.warn("You try to get Qs, but W has been inserted."); |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
751 return null; |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
752 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
753 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
754 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
755 public boolean isQ() { |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
756 final StateData mode = getData("wq_isq"); |
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
757 final String value = (mode != null) ? (String) mode.getValue() : null; |
2422
44dc117aa2b7
Picked rev 4058,4063,4065,4068,4069 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2418
diff
changeset
|
758 return value != null ? Boolean.valueOf(value) : false; |
44dc117aa2b7
Picked rev 4058,4063,4065,4068,4069 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2418
diff
changeset
|
759 } |
44dc117aa2b7
Picked rev 4058,4063,4065,4068,4069 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2418
diff
changeset
|
760 |
44dc117aa2b7
Picked rev 4058,4063,4065,4068,4069 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2418
diff
changeset
|
761 public boolean isW() { |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
762 final StateData mode = getData("wq_isq"); |
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
763 final String value = (mode != null) ? (String) mode.getValue() : null; |
2422
44dc117aa2b7
Picked rev 4058,4063,4065,4068,4069 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2418
diff
changeset
|
764 return value != null ? !Boolean.valueOf(value) : false; |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
765 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
766 |
2164
d548e2e13524
Added code for the simple case of "Bezugslinienverfahren" ("W auf freier Strecke").
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2126
diff
changeset
|
767 public boolean isFreeW() { |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
768 if (!isW()) { |
2422
44dc117aa2b7
Picked rev 4058,4063,4065,4068,4069 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2418
diff
changeset
|
769 return false; |
44dc117aa2b7
Picked rev 4058,4063,4065,4068,4069 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2418
diff
changeset
|
770 } |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
771 final StateData mode = getData("wq_isfree"); |
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
772 final String value = (mode != null) ? (String) mode.getValue() : null; |
2422
44dc117aa2b7
Picked rev 4058,4063,4065,4068,4069 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2418
diff
changeset
|
773 |
44dc117aa2b7
Picked rev 4058,4063,4065,4068,4069 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2418
diff
changeset
|
774 return value != null ? Boolean.valueOf(value) : false; |
2164
d548e2e13524
Added code for the simple case of "Bezugslinienverfahren" ("W auf freier Strecke").
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2126
diff
changeset
|
775 } |
d548e2e13524
Added code for the simple case of "Bezugslinienverfahren" ("W auf freier Strecke").
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2126
diff
changeset
|
776 |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
777 /** |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
778 * Returns true, if the parameter is set to compute data on a free range. |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
779 * Otherwise it returns false, which tells the calculation that it is bound |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
780 * to a gauge. |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
781 * |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
782 * @return true, if the calculation should compute on a free range otherwise |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
783 * false and the calculation is bound to a gauge. |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
784 */ |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
785 public boolean isFreeQ() { |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
786 if (!isQ()) { |
2422
44dc117aa2b7
Picked rev 4058,4063,4065,4068,4069 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2418
diff
changeset
|
787 return false; |
44dc117aa2b7
Picked rev 4058,4063,4065,4068,4069 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2418
diff
changeset
|
788 } |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
789 final StateData mode = getData("wq_isfree"); |
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
790 final String value = (mode != null) ? (String) mode.getValue() : null; |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
791 |
8202
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6625
diff
changeset
|
792 log.debug("isFreeQ: " + value); |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
793 |
2164
d548e2e13524
Added code for the simple case of "Bezugslinienverfahren" ("W auf freier Strecke").
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2126
diff
changeset
|
794 return value != null && Boolean.valueOf(value); |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
795 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
796 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
797 /** |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
798 * Returns the Q values based on a specified kilometer range. |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
799 * |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
800 * @param range |
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
801 * A 2dim array with lower and upper kilometer range. |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
802 * |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
803 * @return an array of Q values. |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
804 */ |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
805 public double[] getQs(final double[] range) { |
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
806 final StateData dMode = getData("wq_isq"); |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
807 |
2422
44dc117aa2b7
Picked rev 4058,4063,4065,4068,4069 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2418
diff
changeset
|
808 if (isQ()) { |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
809 return getWQForDist(range); |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
810 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
811 |
8202
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6625
diff
changeset
|
812 log.warn("You try to get Qs, but Ws has been inserted."); |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
813 return null; |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
814 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
815 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
816 /** |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
817 * Returns the W values based on a specified kilometer range. |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
818 * |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
819 * @param range |
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
820 * A 2dim array with lower and upper kilometer range. |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
821 * |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
822 * @return an array of W values. |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
823 */ |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
824 public double[] getWs(final double[] range) { |
2422
44dc117aa2b7
Picked rev 4058,4063,4065,4068,4069 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2418
diff
changeset
|
825 if (isW()) { |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
826 return getWQForDist(range); |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
827 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
828 |
8202
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6625
diff
changeset
|
829 log.warn("You try to get Ws, but Qs has been inserted."); |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
830 return null; |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
831 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
832 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
833 /** |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
834 * This method returns the W values. |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
835 * |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
836 * @return the selected W values or null, if no W values are selected. |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
837 */ |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
838 public double[] getWs() { |
2422
44dc117aa2b7
Picked rev 4058,4063,4065,4068,4069 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2418
diff
changeset
|
839 if (isW()) { |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
840 final StateData dSingle = getData("wq_single"); |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
841 if (dSingle != null) { |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
842 return getSingleWQValues(); |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
843 } else { |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
844 return getWQTriple(); |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
845 } |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
846 } else { |
8202
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6625
diff
changeset
|
847 log.warn("You try to get Ws, but Q has been inserted."); |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
848 return null; |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
849 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
850 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
851 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
852 /** |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
853 * This method returns the given W or Q values for a specific range |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
854 * (inserted in the WQ input panel for discharge longitudinal sections). |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
855 * |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
856 * @param dist |
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
857 * A 2dim array with lower und upper kilometer values. |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
858 * |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
859 * @return an array of W or Q values. |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
860 */ |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
861 protected double[] getWQForDist(final double[] dist) { |
8202
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6625
diff
changeset
|
862 log.debug("Search wq values for range: " + dist[0] + " - " + dist[1]); |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
863 final StateData data = getData("wq_values"); |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
864 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
865 if (data == null) { |
8202
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6625
diff
changeset
|
866 log.warn("Missing wq values!"); |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
867 return null; |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
868 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
869 |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
870 final String dataString = (String) data.getValue(); |
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
871 final String[] ranges = dataString.split(":"); |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
872 |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
873 for (final String range : ranges) { |
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
874 final String[] parts = range.split(";"); |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
875 |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
876 final double lower = Double.parseDouble(parts[0]); |
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
877 final double upper = Double.parseDouble(parts[1]); |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
878 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
879 if (lower <= dist[0] && upper >= dist[1]) { |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
880 final String[] values = parts[2].split(","); |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
881 |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
882 final int num = values.length; |
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
883 final double[] res = new double[num]; |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
884 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
885 for (int i = 0; i < num; i++) { |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
886 try { |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
887 res[i] = Double.parseDouble(values[i]); |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
888 } |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
889 catch (final NumberFormatException nfe) { |
8202
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6625
diff
changeset
|
890 log.warn(nfe, nfe); |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
891 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
892 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
893 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
894 return res; |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
895 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
896 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
897 |
8202
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6625
diff
changeset
|
898 log.warn("Specified range for WQ not found!"); |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
899 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
900 return null; |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
901 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
902 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
903 /** |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
904 * This method returns an array of inserted WQ triples that consist of from, |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
905 * to and the step width. |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
906 * |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
907 * @return an array of from, to and step width. |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
908 */ |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
909 protected double[] getWQTriple() { |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
910 final StateData dFrom = getData("wq_from"); |
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
911 final StateData dTo = getData("wq_to"); |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
912 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
913 if (dFrom == null || dTo == null) { |
8202
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6625
diff
changeset
|
914 log.warn("Missing start or end value for range."); |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
915 return null; |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
916 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
917 |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
918 final double from = Double.parseDouble((String) dFrom.getValue()); |
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
919 final double to = Double.parseDouble((String) dTo.getValue()); |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
920 |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
921 final StateData dStep = getData("wq_step"); |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
922 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
923 if (dStep == null) { |
8202
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6625
diff
changeset
|
924 log.warn("No step width given. Cannot compute Qs."); |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
925 return null; |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
926 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
927 |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
928 double step = Double.parseDouble((String) dStep.getValue()); |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
929 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
930 // if no width is given, the DEFAULT_Q_STEPS is used to compute the step |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
931 // width. Maybe, we should round the value to a number of digits. |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
932 if (step == 0d) { |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
933 final double diff = to - from; |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
934 step = diff / DEFAULT_Q_STEPS; |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
935 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
936 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
937 return DoubleUtil.explode(from, to, step); |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
938 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
939 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
940 /** |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
941 * Returns an array of inserted WQ double values stored as whitespace |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
942 * separated list. |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
943 * |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
944 * @return an array of W or Q values. |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
945 */ |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
946 protected double[] getSingleWQValues() { |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
947 final StateData dSingle = getData("wq_single"); |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
948 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
949 if (dSingle == null) { |
8202
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6625
diff
changeset
|
950 log.warn("Cannot determine single WQ values. No data given."); |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
951 return null; |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
952 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
953 |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
954 final String tmp = (String) dSingle.getValue(); |
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
955 final String[] strValues = tmp.split(" "); |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
956 |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
957 final TDoubleArrayList values = new TDoubleArrayList(); |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
958 |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
959 for (final String strValue : strValues) { |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
960 try { |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
961 values.add(Double.parseDouble(strValue)); |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
962 } |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
9130
diff
changeset
|
963 catch (final NumberFormatException nfe) { |
8202
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6625
diff
changeset
|
964 log.warn(nfe, nfe); |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
965 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
966 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
967 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
968 values.sort(); |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
969 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
970 return values.toNativeArray(); |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
971 } |
105
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
972 } |
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
973 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |