annotate artifacts/src/main/java/org/dive4elements/river/artifacts/WQKmsInterpolArtifact.java @ 8755:30b1ddadf275

(issue1801) Unify reference gauge finding code The basic way as described in the method comment of the determineRefGauge method is now used in the WINFOArtifact, MainValuesService and RiverUtils.getGauge method. RiverUtils.getGauge previously just returned the first gauge found. While this is now a behavior change I believe that it is always more correct then the undeterministic behavior of the previous implmenentation.
author Andre Heinecke <andre.heinecke@intevation.de>
date Wed, 24 Jun 2015 14:07:26 +0200
parents e4606eae8ea5
children 0a5239a1e46e
rev   line source
5863
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
1 /* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
2 * Software engineering by Intevation GmbH
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
3 *
5994
af13ceeba52a Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5867
diff changeset
4 * This file is Free Software under the GNU AGPL (>=v3)
5863
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
5 * and comes with ABSOLUTELY NO WARRANTY! Check out the
5994
af13ceeba52a Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5867
diff changeset
6 * documentation coming with Dive4Elements River for details.
5863
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
7 */
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
8
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4497
diff changeset
9 package org.dive4elements.river.artifacts;
1896
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
10
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
11 import java.util.ArrayList;
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
12 import java.util.List;
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
13
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
14 import org.apache.log4j.Logger;
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
15
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
16 import org.w3c.dom.Document;
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
17
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4497
diff changeset
18 import org.dive4elements.artifactdatabase.state.Facet;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4497
diff changeset
19 import org.dive4elements.artifactdatabase.state.FacetActivity;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4497
diff changeset
20 import org.dive4elements.artifactdatabase.state.DefaultOutput;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4497
diff changeset
21 import org.dive4elements.artifactdatabase.state.State;
1896
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
22
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4497
diff changeset
23 import org.dive4elements.artifacts.Artifact;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4497
diff changeset
24 import org.dive4elements.artifacts.ArtifactFactory;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4497
diff changeset
25 import org.dive4elements.artifacts.CallMeta;
1896
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
26
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4497
diff changeset
27 import org.dive4elements.river.artifacts.model.FacetTypes;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4497
diff changeset
28 import org.dive4elements.river.artifacts.model.WQKms;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4497
diff changeset
29 import org.dive4elements.river.artifacts.model.WQFacet;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4497
diff changeset
30 import org.dive4elements.river.artifacts.model.WKmsFactory;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4497
diff changeset
31 import org.dive4elements.river.artifacts.model.WQKmsFactory;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4497
diff changeset
32 import org.dive4elements.river.artifacts.model.WstValueTable;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4497
diff changeset
33 import org.dive4elements.river.artifacts.model.WstValueTableFactory;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4497
diff changeset
34
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4497
diff changeset
35 import org.dive4elements.river.artifacts.states.StaticState;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4497
diff changeset
36 import org.dive4elements.river.artifacts.resources.Resources;
1896
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
37
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
38
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
39 /**
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
40 * Artifact to access additional "waterlevel/discharge"-type of data, like
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
41 * fixation measurements, but doing so with costy interpolation.
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
42 *
5867
59ff03ff48f1 River artifacts: Renamed FLYSArtifact(Collection) to D4EArtifact(Collection).
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5863
diff changeset
43 * This artifact neglects (Static)D4EArtifacts capabilities of interaction
1896
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
44 * with the StateEngine by overriding the getState*-methods.
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
45 */
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
46 public class WQKmsInterpolArtifact
5867
59ff03ff48f1 River artifacts: Renamed FLYSArtifact(Collection) to D4EArtifact(Collection).
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5863
diff changeset
47 extends StaticD4EArtifact
1896
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
48 implements FacetTypes
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
49 {
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7842
diff changeset
50 /** The log for this class. */
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7842
diff changeset
51 private static Logger log =
1896
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
52 Logger.getLogger(WQKmsInterpolArtifact.class);
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
53
3634
001e35349203 Fix issue829, wst col indices start with 0.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3585
diff changeset
54 /** State name. */
1896
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
55 public static final String STATIC_STATE_NAME =
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
56 "state.additional_wqkms.interpol.static";
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
57
3634
001e35349203 Fix issue829, wst col indices start with 0.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3585
diff changeset
58 /** Artifact name. */
3556
afc7bfb4800b Use the new infrastructure to figure out if a facet should
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3405
diff changeset
59 private static final String NAME = "staticwqkmsinterpol";
afc7bfb4800b Use the new infrastructure to figure out if a facet should
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3405
diff changeset
60
afc7bfb4800b Use the new infrastructure to figure out if a facet should
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3405
diff changeset
61 static {
afc7bfb4800b Use the new infrastructure to figure out if a facet should
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3405
diff changeset
62 // TODO: Move to configuration.
afc7bfb4800b Use the new infrastructure to figure out if a facet should
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3405
diff changeset
63 FacetActivity.Registry.getInstance()
afc7bfb4800b Use the new infrastructure to figure out if a facet should
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3405
diff changeset
64 .register(NAME, FacetActivity.INACTIVE);
afc7bfb4800b Use the new infrastructure to figure out if a facet should
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3405
diff changeset
65 }
afc7bfb4800b Use the new infrastructure to figure out if a facet should
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3405
diff changeset
66
1896
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
67 /** One and only state to be in. */
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
68 protected transient State state = null;
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
69
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
70
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
71 /**
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
72 * Trivial Constructor.
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
73 */
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
74 public WQKmsInterpolArtifact() {
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7842
diff changeset
75 log.debug("WQKmsInterpolArtifact.WQKmsInterpolArtifact");
1896
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
76 }
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
77
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
78
3634
001e35349203 Fix issue829, wst col indices start with 0.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3585
diff changeset
79 /** Return fixed artifact (types) name. */
3556
afc7bfb4800b Use the new infrastructure to figure out if a facet should
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3405
diff changeset
80 @Override
afc7bfb4800b Use the new infrastructure to figure out if a facet should
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3405
diff changeset
81 public String getName() {
afc7bfb4800b Use the new infrastructure to figure out if a facet should
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3405
diff changeset
82 return NAME;
afc7bfb4800b Use the new infrastructure to figure out if a facet should
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3405
diff changeset
83 }
afc7bfb4800b Use the new infrastructure to figure out if a facet should
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3405
diff changeset
84
afc7bfb4800b Use the new infrastructure to figure out if a facet should
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3405
diff changeset
85
1896
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
86 /**
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
87 * Gets called from factory, to set things up.
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
88 */
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
89 @Override
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
90 public void setup(
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
91 String identifier,
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
92 ArtifactFactory factory,
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
93 Object context,
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
94 CallMeta callMeta,
7842
8d5ca5175038 Updated signature of artifacts setup method; Removed unnecessary setup overrides.
Raimund Renkert <rrenkert@intevation.de>
parents: 6925
diff changeset
95 Document data,
8d5ca5175038 Updated signature of artifacts setup method; Removed unnecessary setup overrides.
Raimund Renkert <rrenkert@intevation.de>
parents: 6925
diff changeset
96 List<Class> loadFacets)
1896
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
97 {
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7842
diff changeset
98 log.debug("WQKmsInterpolArtifact.setup");
1896
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
99
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
100 state = new StaticState(STATIC_STATE_NAME);
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
101
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
102 List<Facet> fs = new ArrayList<Facet>();
2741
0251393f037c Refactor usage of now static xpath, other artifacts will follow in later commits.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2740
diff changeset
103 String code = getDatacageIDValue(data);
1896
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
104
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
105 // TODO Go for JSON, one day.
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
106 //ex.: flood_protection-wstv-114-12
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
107 if (code != null) {
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
108 String [] parts = code.split("-");
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
109
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7842
diff changeset
110 log.debug("WQKmsInterpolArtifact.setup: code " + code);
3634
001e35349203 Fix issue829, wst col indices start with 0.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3585
diff changeset
111
1896
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
112 if (parts.length >= 4) {
3405
b0ba96bbf01d Use Integer.parseInt() instead of Integer.valueOf() + Autounboxing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3270
diff changeset
113 int wst = Integer.parseInt(parts[3]);
1910
61baa34af1d4 Use single column wst interpolators from wqkmsinterpolartifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1906
diff changeset
114 int col = -1;
61baa34af1d4 Use single column wst interpolators from wqkmsinterpolartifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1906
diff changeset
115 String colpos = parts[2];
61baa34af1d4 Use single column wst interpolators from wqkmsinterpolartifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1906
diff changeset
116 // Are we interested in a single column or in all columns?
61baa34af1d4 Use single column wst interpolators from wqkmsinterpolartifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1906
diff changeset
117 if (colpos.equals("A")) {
61baa34af1d4 Use single column wst interpolators from wqkmsinterpolartifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1906
diff changeset
118 ; // Take all.
61baa34af1d4 Use single column wst interpolators from wqkmsinterpolartifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1906
diff changeset
119 }
61baa34af1d4 Use single column wst interpolators from wqkmsinterpolartifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1906
diff changeset
120 else {
3405
b0ba96bbf01d Use Integer.parseInt() instead of Integer.valueOf() + Autounboxing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3270
diff changeset
121 col = Integer.parseInt(colpos);
1910
61baa34af1d4 Use single column wst interpolators from wqkmsinterpolartifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1906
diff changeset
122 addStringData("col_pos", parts[2]);
61baa34af1d4 Use single column wst interpolators from wqkmsinterpolartifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1906
diff changeset
123 }
1896
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
124 addStringData("wst_id", parts[3]);
3634
001e35349203 Fix issue829, wst col indices start with 0.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3585
diff changeset
125 String wkmsName = (col >= 0)
1910
61baa34af1d4 Use single column wst interpolators from wqkmsinterpolartifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1906
diff changeset
126 ? WKmsFactory.getWKmsName(col, wst)
61baa34af1d4 Use single column wst interpolators from wqkmsinterpolartifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1906
diff changeset
127 : WKmsFactory.getWKmsName(wst);
1920
346044bd523d Give flood* artifacts Facets the STATIC_WKMS_INTERPOL FacetType.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1914
diff changeset
128 String name;
346044bd523d Give flood* artifacts Facets the STATIC_WKMS_INTERPOL FacetType.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1914
diff changeset
129 if (parts[0].startsWith("height")){
346044bd523d Give flood* artifacts Facets the STATIC_WKMS_INTERPOL FacetType.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1914
diff changeset
130 name = STATIC_WQ_ANNOTATIONS;
346044bd523d Give flood* artifacts Facets the STATIC_WKMS_INTERPOL FacetType.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1914
diff changeset
131 }
346044bd523d Give flood* artifacts Facets the STATIC_WKMS_INTERPOL FacetType.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1914
diff changeset
132 else if (parts[0].startsWith("flood")) {
346044bd523d Give flood* artifacts Facets the STATIC_WKMS_INTERPOL FacetType.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1914
diff changeset
133 name = STATIC_WKMS_INTERPOL;
346044bd523d Give flood* artifacts Facets the STATIC_WKMS_INTERPOL FacetType.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1914
diff changeset
134 }
346044bd523d Give flood* artifacts Facets the STATIC_WKMS_INTERPOL FacetType.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1914
diff changeset
135 else {
6925
972ec1f6cf58 WQKmsInterpolArtifact: Add different facet if wst has only 'fake' Qs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6924
diff changeset
136 // If all Qs are zero, add different facet to
972ec1f6cf58 WQKmsInterpolArtifact: Add different facet if wst has only 'fake' Qs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6924
diff changeset
137 // signalize that we want data to be drawn as marks
972ec1f6cf58 WQKmsInterpolArtifact: Add different facet if wst has only 'fake' Qs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6924
diff changeset
138 // on axis.
972ec1f6cf58 WQKmsInterpolArtifact: Add different facet if wst has only 'fake' Qs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6924
diff changeset
139 if (wstValueHasZeroQ()) {
972ec1f6cf58 WQKmsInterpolArtifact: Add different facet if wst has only 'fake' Qs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6924
diff changeset
140 name = STATIC_W_INTERPOL;
972ec1f6cf58 WQKmsInterpolArtifact: Add different facet if wst has only 'fake' Qs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6924
diff changeset
141 }
972ec1f6cf58 WQKmsInterpolArtifact: Add different facet if wst has only 'fake' Qs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6924
diff changeset
142 else {
972ec1f6cf58 WQKmsInterpolArtifact: Add different facet if wst has only 'fake' Qs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6924
diff changeset
143 name = STATIC_WQ;
972ec1f6cf58 WQKmsInterpolArtifact: Add different facet if wst has only 'fake' Qs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6924
diff changeset
144 }
1920
346044bd523d Give flood* artifacts Facets the STATIC_WKMS_INTERPOL FacetType.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1914
diff changeset
145 }
1914
e20a47be6207 Differentiate between wsts whose name starts with 'height' and all others.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1910
diff changeset
146
3585
c105b4466b4e Basedata in FixA WQ DC and diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3556
diff changeset
147 Facet wQFacet = new WQFacet(name,
1896
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
148 Resources.getMsg(
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
149 callMeta,
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
150 wkmsName,
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
151 wkmsName));
3585
c105b4466b4e Basedata in FixA WQ DC and diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3556
diff changeset
152 fs.add(wQFacet);
4497
a2735a4bf75e Change facets member variable to private
Björn Ricks <bjoern.ricks@intevation.de>
parents: 3634
diff changeset
153 addFacets(state.getID(), fs);
1896
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
154 }
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
155 }
3634
001e35349203 Fix issue829, wst col indices start with 0.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3585
diff changeset
156 else {
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7842
diff changeset
157 log.warn("WQKmsInterpolArtifact: no code");
3634
001e35349203 Fix issue829, wst col indices start with 0.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3585
diff changeset
158 }
1896
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
159
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
160 spawnState();
7842
8d5ca5175038 Updated signature of artifacts setup method; Removed unnecessary setup overrides.
Raimund Renkert <rrenkert@intevation.de>
parents: 6925
diff changeset
161 super.setup(identifier, factory, context, callMeta, data, loadFacets);
1896
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
162 }
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
163
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
164
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
165 /**
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
166 * Initialize the static state with output.
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
167 * @return static state
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
168 */
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
169 protected State spawnState() {
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
170 state = new StaticState(STATIC_STATE_NAME);
4497
a2735a4bf75e Change facets member variable to private
Björn Ricks <bjoern.ricks@intevation.de>
parents: 3634
diff changeset
171 List<Facet> fs = getFacets(STATIC_STATE_NAME);
1896
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
172 DefaultOutput output = new DefaultOutput(
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
173 "general",
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
174 "general",
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
175 "image/png",
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
176 fs,
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
177 "chart");
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
178
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
179 state.getOutputs().add(output);
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
180
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
181 return state;
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
182 }
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
183
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
184
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
185 /**
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
186 * Called via setup.
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
187 *
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
188 * @param artifact The master-artifact.
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
189 */
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
190 @Override
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
191 protected void initialize(
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
192 Artifact artifact,
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
193 Object context,
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
194 CallMeta meta)
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
195 {
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7842
diff changeset
196 log.debug("WQKmsInterpolArtifact.initialize");
5867
59ff03ff48f1 River artifacts: Renamed FLYSArtifact(Collection) to D4EArtifact(Collection).
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5863
diff changeset
197 D4EArtifact winfo = (D4EArtifact) artifact;
1896
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
198 importData(winfo, "river");
1906
0de18085948a Respect position for computed discharge curve when interpolating WQs for e.g. for fixations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1896
diff changeset
199 importData(winfo, "ld_locations");
1896
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
200 }
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
201
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
202
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
203 /**
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
204 * Get a list containing the one and only State.
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
205 * @param context ignored.
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
206 * @return list with one and only state.
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
207 */
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
208 @Override
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
209 protected List<State> getStates(Object context) {
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
210 ArrayList<State> states = new ArrayList<State>();
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
211 states.add(getState());
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
212 return states;
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
213 }
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
214
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
215
6925
972ec1f6cf58 WQKmsInterpolArtifact: Add different facet if wst has only 'fake' Qs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6924
diff changeset
216 /** True if Wst has only 'fake' (zero) Q-ranges. */
972ec1f6cf58 WQKmsInterpolArtifact: Add different facet if wst has only 'fake' Qs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6924
diff changeset
217 private boolean wstValueHasZeroQ() {
972ec1f6cf58 WQKmsInterpolArtifact: Add different facet if wst has only 'fake' Qs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6924
diff changeset
218 WstValueTable table = getValueTable();
972ec1f6cf58 WQKmsInterpolArtifact: Add different facet if wst has only 'fake' Qs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6924
diff changeset
219 return table.hasEmptyQ();
972ec1f6cf58 WQKmsInterpolArtifact: Add different facet if wst has only 'fake' Qs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6924
diff changeset
220 }
972ec1f6cf58 WQKmsInterpolArtifact: Add different facet if wst has only 'fake' Qs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6924
diff changeset
221
972ec1f6cf58 WQKmsInterpolArtifact: Add different facet if wst has only 'fake' Qs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6924
diff changeset
222
972ec1f6cf58 WQKmsInterpolArtifact: Add different facet if wst has only 'fake' Qs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6924
diff changeset
223 /** Get the WstValueTable that matches parameterization. */
972ec1f6cf58 WQKmsInterpolArtifact: Add different facet if wst has only 'fake' Qs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6924
diff changeset
224 private WstValueTable getValueTable() {
972ec1f6cf58 WQKmsInterpolArtifact: Add different facet if wst has only 'fake' Qs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6924
diff changeset
225 // Get WstValueTable
972ec1f6cf58 WQKmsInterpolArtifact: Add different facet if wst has only 'fake' Qs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6924
diff changeset
226 int wstId = getDataAsInt("wst_id");
972ec1f6cf58 WQKmsInterpolArtifact: Add different facet if wst has only 'fake' Qs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6924
diff changeset
227 if (getDataAsString("col_pos") != null) {
972ec1f6cf58 WQKmsInterpolArtifact: Add different facet if wst has only 'fake' Qs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6924
diff changeset
228 return WstValueTableFactory.getWstColumnTable(
972ec1f6cf58 WQKmsInterpolArtifact: Add different facet if wst has only 'fake' Qs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6924
diff changeset
229 wstId, getDataAsInt("col_pos"));
972ec1f6cf58 WQKmsInterpolArtifact: Add different facet if wst has only 'fake' Qs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6924
diff changeset
230 }
972ec1f6cf58 WQKmsInterpolArtifact: Add different facet if wst has only 'fake' Qs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6924
diff changeset
231 else {
972ec1f6cf58 WQKmsInterpolArtifact: Add different facet if wst has only 'fake' Qs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6924
diff changeset
232 return WstValueTableFactory.getTable(wstId);
972ec1f6cf58 WQKmsInterpolArtifact: Add different facet if wst has only 'fake' Qs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6924
diff changeset
233 }
972ec1f6cf58 WQKmsInterpolArtifact: Add different facet if wst has only 'fake' Qs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6924
diff changeset
234 }
972ec1f6cf58 WQKmsInterpolArtifact: Add different facet if wst has only 'fake' Qs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6924
diff changeset
235
972ec1f6cf58 WQKmsInterpolArtifact: Add different facet if wst has only 'fake' Qs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6924
diff changeset
236
972ec1f6cf58 WQKmsInterpolArtifact: Add different facet if wst has only 'fake' Qs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6924
diff changeset
237 /**
972ec1f6cf58 WQKmsInterpolArtifact: Add different facet if wst has only 'fake' Qs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6924
diff changeset
238 * Get WQ Values at a certain km, interpolating only if distance
972ec1f6cf58 WQKmsInterpolArtifact: Add different facet if wst has only 'fake' Qs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6924
diff changeset
239 * between two stations is smaller than given distance.
972ec1f6cf58 WQKmsInterpolArtifact: Add different facet if wst has only 'fake' Qs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6924
diff changeset
240 */
972ec1f6cf58 WQKmsInterpolArtifact: Add different facet if wst has only 'fake' Qs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6924
diff changeset
241 public double [][] getWQAtKm(
972ec1f6cf58 WQKmsInterpolArtifact: Add different facet if wst has only 'fake' Qs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6924
diff changeset
242 Double currentKm,
972ec1f6cf58 WQKmsInterpolArtifact: Add different facet if wst has only 'fake' Qs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6924
diff changeset
243 double maxKmInterpolDistance
972ec1f6cf58 WQKmsInterpolArtifact: Add different facet if wst has only 'fake' Qs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6924
diff changeset
244 ) {
972ec1f6cf58 WQKmsInterpolArtifact: Add different facet if wst has only 'fake' Qs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6924
diff changeset
245 // TODO yet to be implemented (issue1378).
972ec1f6cf58 WQKmsInterpolArtifact: Add different facet if wst has only 'fake' Qs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6924
diff changeset
246 return null;
972ec1f6cf58 WQKmsInterpolArtifact: Add different facet if wst has only 'fake' Qs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6924
diff changeset
247 }
972ec1f6cf58 WQKmsInterpolArtifact: Add different facet if wst has only 'fake' Qs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6924
diff changeset
248
972ec1f6cf58 WQKmsInterpolArtifact: Add different facet if wst has only 'fake' Qs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6924
diff changeset
249
1896
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
250 /**
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
251 * Get WQ at a given km.
6924
b87240ac9205 Doc, cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 5994
diff changeset
252 *
3585
c105b4466b4e Basedata in FixA WQ DC and diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3556
diff changeset
253 * @param currentKm the requested km. If NULL, ld_location data
c105b4466b4e Basedata in FixA WQ DC and diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3556
diff changeset
254 * will be used.
6924
b87240ac9205 Doc, cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 5994
diff changeset
255 * @return [[q1,q2,q2],[w1,w2,w3]] ...
1896
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
256 */
3585
c105b4466b4e Basedata in FixA WQ DC and diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3556
diff changeset
257 public double [][] getWQAtKm(Double currentKm) {
1910
61baa34af1d4 Use single column wst interpolators from wqkmsinterpolartifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1906
diff changeset
258
6925
972ec1f6cf58 WQKmsInterpolArtifact: Add different facet if wst has only 'fake' Qs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6924
diff changeset
259 // TODO issue1378: only interpolate if dist <= 100m
972ec1f6cf58 WQKmsInterpolArtifact: Add different facet if wst has only 'fake' Qs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6924
diff changeset
260 WstValueTable interpolator = getValueTable();
1896
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
261
3585
c105b4466b4e Basedata in FixA WQ DC and diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3556
diff changeset
262 Double tmp = (currentKm != null)
c105b4466b4e Basedata in FixA WQ DC and diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3556
diff changeset
263 ? currentKm
c105b4466b4e Basedata in FixA WQ DC and diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3556
diff changeset
264 : getDataAsDouble("ld_locations");
c105b4466b4e Basedata in FixA WQ DC and diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3556
diff changeset
265
1906
0de18085948a Respect position for computed discharge curve when interpolating WQs for e.g. for fixations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1896
diff changeset
266 double [][] vs = interpolator.interpolateWQColumnwise(
2701
c553d4fa3957 Moved the implementation of getDataAsDouble() from concrete Artifacts into FLYSArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2132
diff changeset
267 tmp != null ? tmp : 0);
1896
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
268
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
269 for (int x = 0; x < vs[1].length; x++) {
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7842
diff changeset
270 log.debug("getWQAtKm: Q/W " + vs[0][x] + " / " + vs[1][x]);
1896
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
271 }
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
272
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
273 return vs;
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
274 }
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
275
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
276
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
277 /**
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
278 * Get a DataItem casted to int (0 if fails).
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
279 */
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
280 public int getDataAsInt(String dataName) {
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
281 String val = getDataAsString(dataName);
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
282 try {
3405
b0ba96bbf01d Use Integer.parseInt() instead of Integer.valueOf() + Autounboxing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3270
diff changeset
283 return Integer.parseInt(val);
1896
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
284 }
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
285 catch (NumberFormatException e) {
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7842
diff changeset
286 log.warn("Could not get data " + dataName + " as int", e);
1896
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
287 return 0;
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
288 }
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
289 }
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
290
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
291
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
292 /**
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
293 * Get the "current" state (there is but one).
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
294 * @param cc ignored.
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
295 * @return the "current" (only possible) state.
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
296 */
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
297 @Override
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
298 public State getCurrentState(Object cc) {
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
299 return getState();
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
300 }
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
301
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
302
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
303 /**
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
304 * Get the only possible state.
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
305 * @return the state.
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
306 */
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
307 protected State getState() {
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
308 return getState(null, null);
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
309 }
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
310
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
311
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
312 /**
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
313 * Get the state.
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
314 * @param context ignored.
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
315 * @param stateID ignored.
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
316 * @return the state.
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
317 */
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
318 @Override
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
319 protected State getState(Object context, String stateID) {
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
320 return (state != null)
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
321 ? state
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
322 : spawnState();
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
323 }
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
324
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
325
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
326 /**
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
327 * Get WQKms from factory.
3270
4ac581062c40 Fix various documentation issues.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2763
diff changeset
328 * @param idx param is not needed (TODO)
1896
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
329 * @return WQKms according to parameterization (can be null);
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
330 */
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
331 public WQKms getWQKms(int idx) {
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7842
diff changeset
332 log.debug("WQKmsInterpolArtifact.getWQKms");
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7842
diff changeset
333 log.warn("Stub, getWQKms not yet implemented.");
1896
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
334
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
335 return WQKmsFactory.getWQKms(
3405
b0ba96bbf01d Use Integer.parseInt() instead of Integer.valueOf() + Autounboxing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3270
diff changeset
336 Integer.parseInt(getDataAsString("col_pos")),
b0ba96bbf01d Use Integer.parseInt() instead of Integer.valueOf() + Autounboxing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3270
diff changeset
337 Integer.parseInt(getDataAsString("wst_id")));
1896
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
338 }
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
339 }
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
340 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :

http://dive4elements.wald.intevation.org