annotate artifacts/src/main/java/org/dive4elements/river/artifacts/WQKmsInterpolArtifact.java @ 9726:0a5239a1e46e 3.2.x

Upgrade to Log4j 2
author Tom Gottfried <tom@intevation.de>
date Wed, 02 Mar 2022 10:26:50 +0100
parents e4606eae8ea5
children
rev   line source
5863
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
1 /* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
2 * Software engineering by Intevation GmbH
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
3 *
5994
af13ceeba52a Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 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
9726
0a5239a1e46e Upgrade to Log4j 2
Tom Gottfried <tom@intevation.de>
parents: 8202
diff changeset
14 import org.apache.logging.log4j.Logger;
0a5239a1e46e Upgrade to Log4j 2
Tom Gottfried <tom@intevation.de>
parents: 8202
diff changeset
15 import org.apache.logging.log4j.LogManager;
1896
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
16
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
17 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
18
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4497
diff changeset
19 import org.dive4elements.artifactdatabase.state.Facet;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4497
diff changeset
20 import org.dive4elements.artifactdatabase.state.FacetActivity;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4497
diff changeset
21 import org.dive4elements.artifactdatabase.state.DefaultOutput;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4497
diff changeset
22 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
23
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4497
diff changeset
24 import org.dive4elements.artifacts.Artifact;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4497
diff changeset
25 import org.dive4elements.artifacts.ArtifactFactory;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4497
diff changeset
26 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
27
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4497
diff changeset
28 import org.dive4elements.river.artifacts.model.FacetTypes;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4497
diff changeset
29 import org.dive4elements.river.artifacts.model.WQKms;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4497
diff changeset
30 import org.dive4elements.river.artifacts.model.WQFacet;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4497
diff changeset
31 import org.dive4elements.river.artifacts.model.WKmsFactory;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4497
diff changeset
32 import org.dive4elements.river.artifacts.model.WQKmsFactory;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4497
diff changeset
33 import org.dive4elements.river.artifacts.model.WstValueTable;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4497
diff changeset
34 import org.dive4elements.river.artifacts.model.WstValueTableFactory;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4497
diff changeset
35
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4497
diff changeset
36 import org.dive4elements.river.artifacts.states.StaticState;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4497
diff changeset
37 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
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 /**
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
41 * 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
42 * 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
43 *
5867
59ff03ff48f1 River artifacts: Renamed FLYSArtifact(Collection) to D4EArtifact(Collection).
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5863
diff changeset
44 * 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
45 * 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
46 */
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
47 public class WQKmsInterpolArtifact
5867
59ff03ff48f1 River artifacts: Renamed FLYSArtifact(Collection) to D4EArtifact(Collection).
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5863
diff changeset
48 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
49 implements FacetTypes
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
50 {
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7842
diff changeset
51 /** The log for this class. */
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7842
diff changeset
52 private static Logger log =
9726
0a5239a1e46e Upgrade to Log4j 2
Tom Gottfried <tom@intevation.de>
parents: 8202
diff changeset
53 LogManager.getLogger(WQKmsInterpolArtifact.class);
1896
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
54
3634
001e35349203 Fix issue829, wst col indices start with 0.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3585
diff changeset
55 /** 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
56 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
57 "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
58
3634
001e35349203 Fix issue829, wst col indices start with 0.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3585
diff changeset
59 /** 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
60 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
61
afc7bfb4800b Use the new infrastructure to figure out if a facet should
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3405
diff changeset
62 static {
afc7bfb4800b Use the new infrastructure to figure out if a facet should
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3405
diff changeset
63 // 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
64 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
65 .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
66 }
afc7bfb4800b Use the new infrastructure to figure out if a facet should
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3405
diff changeset
67
1896
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
68 /** 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
69 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
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 /**
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
73 * Trivial Constructor.
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
74 */
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
75 public WQKmsInterpolArtifact() {
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7842
diff changeset
76 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
77 }
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
78
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
79
3634
001e35349203 Fix issue829, wst col indices start with 0.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3585
diff changeset
80 /** 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
81 @Override
afc7bfb4800b Use the new infrastructure to figure out if a facet should
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3405
diff changeset
82 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
83 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
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
afc7bfb4800b Use the new infrastructure to figure out if a facet should
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3405
diff changeset
86
1896
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
87 /**
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
88 * 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
89 */
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
90 @Override
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
91 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
92 String identifier,
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
93 ArtifactFactory factory,
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
94 Object context,
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
95 CallMeta callMeta,
7842
8d5ca5175038 Updated signature of artifacts setup method; Removed unnecessary setup overrides.
Raimund Renkert <rrenkert@intevation.de>
parents: 6925
diff changeset
96 Document data,
8d5ca5175038 Updated signature of artifacts setup method; Removed unnecessary setup overrides.
Raimund Renkert <rrenkert@intevation.de>
parents: 6925
diff changeset
97 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
98 {
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7842
diff changeset
99 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
100
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
101 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
102
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
103 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
104 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
105
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
106 // 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
107 //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
108 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
109 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
110
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7842
diff changeset
111 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
112
1896
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
113 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
114 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
115 int col = -1;
61baa34af1d4 Use single column wst interpolators from wqkmsinterpolartifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1906
diff changeset
116 String colpos = parts[2];
61baa34af1d4 Use single column wst interpolators from wqkmsinterpolartifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1906
diff changeset
117 // 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
118 if (colpos.equals("A")) {
61baa34af1d4 Use single column wst interpolators from wqkmsinterpolartifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1906
diff changeset
119 ; // Take all.
61baa34af1d4 Use single column wst interpolators from wqkmsinterpolartifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1906
diff changeset
120 }
61baa34af1d4 Use single column wst interpolators from wqkmsinterpolartifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1906
diff changeset
121 else {
3405
b0ba96bbf01d Use Integer.parseInt() instead of Integer.valueOf() + Autounboxing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3270
diff changeset
122 col = Integer.parseInt(colpos);
1910
61baa34af1d4 Use single column wst interpolators from wqkmsinterpolartifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1906
diff changeset
123 addStringData("col_pos", parts[2]);
61baa34af1d4 Use single column wst interpolators from wqkmsinterpolartifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1906
diff changeset
124 }
1896
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
125 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
126 String wkmsName = (col >= 0)
1910
61baa34af1d4 Use single column wst interpolators from wqkmsinterpolartifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1906
diff changeset
127 ? WKmsFactory.getWKmsName(col, wst)
61baa34af1d4 Use single column wst interpolators from wqkmsinterpolartifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1906
diff changeset
128 : WKmsFactory.getWKmsName(wst);
1920
346044bd523d Give flood* artifacts Facets the STATIC_WKMS_INTERPOL FacetType.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1914
diff changeset
129 String name;
346044bd523d Give flood* artifacts Facets the STATIC_WKMS_INTERPOL FacetType.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1914
diff changeset
130 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
131 name = STATIC_WQ_ANNOTATIONS;
346044bd523d Give flood* artifacts Facets the STATIC_WKMS_INTERPOL FacetType.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1914
diff changeset
132 }
346044bd523d Give flood* artifacts Facets the STATIC_WKMS_INTERPOL FacetType.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1914
diff changeset
133 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
134 name = STATIC_WKMS_INTERPOL;
346044bd523d Give flood* artifacts Facets the STATIC_WKMS_INTERPOL FacetType.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1914
diff changeset
135 }
346044bd523d Give flood* artifacts Facets the STATIC_WKMS_INTERPOL FacetType.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1914
diff changeset
136 else {
6925
972ec1f6cf58 WQKmsInterpolArtifact: Add different facet if wst has only 'fake' Qs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6924
diff changeset
137 // 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
138 // 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
139 // on axis.
972ec1f6cf58 WQKmsInterpolArtifact: Add different facet if wst has only 'fake' Qs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6924
diff changeset
140 if (wstValueHasZeroQ()) {
972ec1f6cf58 WQKmsInterpolArtifact: Add different facet if wst has only 'fake' Qs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6924
diff changeset
141 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
142 }
972ec1f6cf58 WQKmsInterpolArtifact: Add different facet if wst has only 'fake' Qs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6924
diff changeset
143 else {
972ec1f6cf58 WQKmsInterpolArtifact: Add different facet if wst has only 'fake' Qs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6924
diff changeset
144 name = STATIC_WQ;
972ec1f6cf58 WQKmsInterpolArtifact: Add different facet if wst has only 'fake' Qs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6924
diff changeset
145 }
1920
346044bd523d Give flood* artifacts Facets the STATIC_WKMS_INTERPOL FacetType.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1914
diff changeset
146 }
1914
e20a47be6207 Differentiate between wsts whose name starts with 'height' and all others.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1910
diff changeset
147
3585
c105b4466b4e Basedata in FixA WQ DC and diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3556
diff changeset
148 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
149 Resources.getMsg(
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
150 callMeta,
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
151 wkmsName,
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
152 wkmsName));
3585
c105b4466b4e Basedata in FixA WQ DC and diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3556
diff changeset
153 fs.add(wQFacet);
4497
a2735a4bf75e Change facets member variable to private
Björn Ricks <bjoern.ricks@intevation.de>
parents: 3634
diff changeset
154 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
155 }
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
156 }
3634
001e35349203 Fix issue829, wst col indices start with 0.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3585
diff changeset
157 else {
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7842
diff changeset
158 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
159 }
1896
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
160
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
161 spawnState();
7842
8d5ca5175038 Updated signature of artifacts setup method; Removed unnecessary setup overrides.
Raimund Renkert <rrenkert@intevation.de>
parents: 6925
diff changeset
162 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
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 /**
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
167 * 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
168 * @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
169 */
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
170 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
171 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
172 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
173 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
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 "general",
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
176 "image/png",
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
177 fs,
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
178 "chart");
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
179
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
180 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
181
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
182 return state;
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 /**
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
187 * 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
188 *
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
189 * @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
190 */
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
191 @Override
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
192 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
193 Artifact artifact,
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
194 Object context,
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
195 CallMeta meta)
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
196 {
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7842
diff changeset
197 log.debug("WQKmsInterpolArtifact.initialize");
5867
59ff03ff48f1 River artifacts: Renamed FLYSArtifact(Collection) to D4EArtifact(Collection).
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5863
diff changeset
198 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
199 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
200 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
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 /**
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
205 * 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
206 * @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
207 * @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
208 */
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
209 @Override
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
210 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
211 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
212 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
213 return states;
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
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
216
6925
972ec1f6cf58 WQKmsInterpolArtifact: Add different facet if wst has only 'fake' Qs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6924
diff changeset
217 /** 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
218 private boolean wstValueHasZeroQ() {
972ec1f6cf58 WQKmsInterpolArtifact: Add different facet if wst has only 'fake' Qs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6924
diff changeset
219 WstValueTable table = getValueTable();
972ec1f6cf58 WQKmsInterpolArtifact: Add different facet if wst has only 'fake' Qs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6924
diff changeset
220 return table.hasEmptyQ();
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
972ec1f6cf58 WQKmsInterpolArtifact: Add different facet if wst has only 'fake' Qs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6924
diff changeset
224 /** 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
225 private WstValueTable getValueTable() {
972ec1f6cf58 WQKmsInterpolArtifact: Add different facet if wst has only 'fake' Qs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6924
diff changeset
226 // Get WstValueTable
972ec1f6cf58 WQKmsInterpolArtifact: Add different facet if wst has only 'fake' Qs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6924
diff changeset
227 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
228 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
229 return WstValueTableFactory.getWstColumnTable(
972ec1f6cf58 WQKmsInterpolArtifact: Add different facet if wst has only 'fake' Qs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6924
diff changeset
230 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
231 }
972ec1f6cf58 WQKmsInterpolArtifact: Add different facet if wst has only 'fake' Qs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6924
diff changeset
232 else {
972ec1f6cf58 WQKmsInterpolArtifact: Add different facet if wst has only 'fake' Qs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6924
diff changeset
233 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
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 /**
972ec1f6cf58 WQKmsInterpolArtifact: Add different facet if wst has only 'fake' Qs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6924
diff changeset
239 * 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
240 * 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
241 */
972ec1f6cf58 WQKmsInterpolArtifact: Add different facet if wst has only 'fake' Qs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6924
diff changeset
242 public double [][] getWQAtKm(
972ec1f6cf58 WQKmsInterpolArtifact: Add different facet if wst has only 'fake' Qs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6924
diff changeset
243 Double currentKm,
972ec1f6cf58 WQKmsInterpolArtifact: Add different facet if wst has only 'fake' Qs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6924
diff changeset
244 double maxKmInterpolDistance
972ec1f6cf58 WQKmsInterpolArtifact: Add different facet if wst has only 'fake' Qs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6924
diff changeset
245 ) {
972ec1f6cf58 WQKmsInterpolArtifact: Add different facet if wst has only 'fake' Qs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6924
diff changeset
246 // 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
247 return null;
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
972ec1f6cf58 WQKmsInterpolArtifact: Add different facet if wst has only 'fake' Qs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6924
diff changeset
250
1896
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
251 /**
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
252 * Get WQ at a given km.
6924
b87240ac9205 Doc, cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 5994
diff changeset
253 *
3585
c105b4466b4e Basedata in FixA WQ DC and diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3556
diff changeset
254 * @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
255 * will be used.
6924
b87240ac9205 Doc, cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 5994
diff changeset
256 * @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
257 */
3585
c105b4466b4e Basedata in FixA WQ DC and diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3556
diff changeset
258 public double [][] getWQAtKm(Double currentKm) {
1910
61baa34af1d4 Use single column wst interpolators from wqkmsinterpolartifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1906
diff changeset
259
6925
972ec1f6cf58 WQKmsInterpolArtifact: Add different facet if wst has only 'fake' Qs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6924
diff changeset
260 // 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
261 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
262
3585
c105b4466b4e Basedata in FixA WQ DC and diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3556
diff changeset
263 Double tmp = (currentKm != null)
c105b4466b4e Basedata in FixA WQ DC and diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3556
diff changeset
264 ? currentKm
c105b4466b4e Basedata in FixA WQ DC and diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3556
diff changeset
265 : getDataAsDouble("ld_locations");
c105b4466b4e Basedata in FixA WQ DC and diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3556
diff changeset
266
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
267 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
268 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
269
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
270 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
271 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
272 }
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
273
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
274 return vs;
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 /**
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
279 * 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
280 */
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
281 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
282 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
283 try {
3405
b0ba96bbf01d Use Integer.parseInt() instead of Integer.valueOf() + Autounboxing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3270
diff changeset
284 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
285 }
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
286 catch (NumberFormatException e) {
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7842
diff changeset
287 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
288 return 0;
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 /**
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
294 * 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
295 * @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
296 * @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
297 */
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
298 @Override
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
299 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
300 return getState();
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 /**
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
305 * 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
306 * @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
307 */
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
308 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
309 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
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 /**
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
314 * 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
315 * @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
316 * @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
317 * @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
318 */
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
319 @Override
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
320 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
321 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
322 ? state
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
323 : spawnState();
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 /**
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
328 * Get WQKms from factory.
3270
4ac581062c40 Fix various documentation issues.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2763
diff changeset
329 * @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
330 * @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
331 */
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
332 public WQKms getWQKms(int idx) {
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7842
diff changeset
333 log.debug("WQKmsInterpolArtifact.getWQKms");
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7842
diff changeset
334 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
335
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
336 return WQKmsFactory.getWQKms(
3405
b0ba96bbf01d Use Integer.parseInt() instead of Integer.valueOf() + Autounboxing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3270
diff changeset
337 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
338 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
339 }
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
340 }
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
341 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :

http://dive4elements.wald.intevation.org