Mercurial > dive4elements > river
annotate artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/SINFOArtifact.java @ 9602:6b2496d71936
Reimplemented baseline for tkh. Extended area-dataset to be able to draw baseline.
author | gernotbelger |
---|---|
date | Tue, 12 Feb 2019 14:08:16 +0100 |
parents | fbfd66e8fb81 |
children | 1d4262a68f1f |
rev | line source |
---|---|
8854 | 1 /* Copyright (C) 2017 by Bundesanstalt für Gewässerkunde |
8946
5d5d482da3e9
Implementing SINFO - FlowDepthMinMax calculation
gernotbelger
parents:
8869
diff
changeset
|
2 * Software engineering by |
5d5d482da3e9
Implementing SINFO - FlowDepthMinMax calculation
gernotbelger
parents:
8869
diff
changeset
|
3 * Björnsen Beratende Ingenieure GmbH |
8854 | 4 * Dr. Schumacher Ingenieurbüro für Wasser und Umwelt |
5 * | |
6 * This file is Free Software under the GNU AGPL (>=v3) | |
7 * and comes with ABSOLUTELY NO WARRANTY! Check out the | |
8 * documentation coming with Dive4Elements River for details. | |
9 */ | |
10 package org.dive4elements.river.artifacts.sinfo; | |
11 | |
12 import org.apache.commons.lang.StringUtils; | |
8956 | 13 import org.dive4elements.artifactdatabase.state.Facet; |
14 import org.dive4elements.artifactdatabase.state.FacetActivity; | |
15 import org.dive4elements.artifacts.Artifact; | |
8854 | 16 import org.dive4elements.river.artifacts.D4EArtifact; |
8956 | 17 import org.dive4elements.river.artifacts.sinfo.common.D50Processor; |
8980
b194fa64506a
SINFO - show results themes according to spec, either raw data or floating mean values.
gernotbelger
parents:
8956
diff
changeset
|
18 import org.dive4elements.river.artifacts.sinfo.common.FlowDepthDevelopmentPerYearProcessor; |
8956 | 19 import org.dive4elements.river.artifacts.sinfo.common.FlowDepthDevelopmentProcessor; |
20 import org.dive4elements.river.artifacts.sinfo.common.FlowDepthProcessor; | |
21 import org.dive4elements.river.artifacts.sinfo.common.TauProcessor; | |
22 import org.dive4elements.river.artifacts.sinfo.common.VelocityProcessor; | |
8854 | 23 |
24 /** | |
8869 | 25 * The default SINFO artifact. |
8854 | 26 * |
27 * @author Gernot Belger | |
28 */ | |
8946
5d5d482da3e9
Implementing SINFO - FlowDepthMinMax calculation
gernotbelger
parents:
8869
diff
changeset
|
29 public class SINFOArtifact extends D4EArtifact { |
5d5d482da3e9
Implementing SINFO - FlowDepthMinMax calculation
gernotbelger
parents:
8869
diff
changeset
|
30 |
5d5d482da3e9
Implementing SINFO - FlowDepthMinMax calculation
gernotbelger
parents:
8869
diff
changeset
|
31 private static final long serialVersionUID = 1L; |
5d5d482da3e9
Implementing SINFO - FlowDepthMinMax calculation
gernotbelger
parents:
8869
diff
changeset
|
32 |
8854 | 33 /** Error message that is thrown if no mode has been chosen. */ |
8946
5d5d482da3e9
Implementing SINFO - FlowDepthMinMax calculation
gernotbelger
parents:
8869
diff
changeset
|
34 private static final String ERROR_NO_CALCULATION_MODE = "error_feed_no_calculation_mode"; |
8854 | 35 |
8946
5d5d482da3e9
Implementing SINFO - FlowDepthMinMax calculation
gernotbelger
parents:
8869
diff
changeset
|
36 /** |
5d5d482da3e9
Implementing SINFO - FlowDepthMinMax calculation
gernotbelger
parents:
8869
diff
changeset
|
37 * Error message that is thrown if an invalid calculation mode has been |
5d5d482da3e9
Implementing SINFO - FlowDepthMinMax calculation
gernotbelger
parents:
8869
diff
changeset
|
38 * chosen. |
5d5d482da3e9
Implementing SINFO - FlowDepthMinMax calculation
gernotbelger
parents:
8869
diff
changeset
|
39 */ |
5d5d482da3e9
Implementing SINFO - FlowDepthMinMax calculation
gernotbelger
parents:
8869
diff
changeset
|
40 private static final String ERROR_INVALID_CALCULATION_MODE = "error_feed_invalid_calculation_mode"; |
8854 | 41 |
42 /** The name of the artifact. */ | |
43 private static final String ARTIFACT_NAME = "sinfo"; | |
44 | |
8869 | 45 private static final String FIELD_RIVER = "river"; |
8854 | 46 |
47 private static final String FIELD_MODE = "calculation_mode"; | |
8946
5d5d482da3e9
Implementing SINFO - FlowDepthMinMax calculation
gernotbelger
parents:
8869
diff
changeset
|
48 |
8956 | 49 static { |
50 // Active/deactivate facets. | |
51 // BEWARE: we can only define one activity for "sinfo", so we use the artifact as place for this | |
52 FacetActivity.Registry.getInstance().register("sinfo", new FacetActivity() { | |
53 @Override | |
54 public Boolean isInitialActive(final Artifact artifact, final Facet facet, final String output) { | |
55 | |
8980
b194fa64506a
SINFO - show results themes according to spec, either raw data or floating mean values.
gernotbelger
parents:
8956
diff
changeset
|
56 final String name = facet.getName(); |
b194fa64506a
SINFO - show results themes according to spec, either raw data or floating mean values.
gernotbelger
parents:
8956
diff
changeset
|
57 |
8956 | 58 if ("sinfo_tkk".equals(output)) { |
59 if (FlowDepthProcessor.FACET_FLOW_DEPTH_FILTERED.equals(name)) | |
60 return Boolean.FALSE; | |
61 if (VelocityProcessor.FACET_TKH_VELOCITY_FILTERED.equals(name)) | |
62 return Boolean.FALSE; | |
63 if (TauProcessor.FACET_TKH_TAU_FILTERED.equals(name)) | |
64 return Boolean.FALSE; | |
65 if (D50Processor.FACET_TKH_D50_FILTERED.equals(name)) | |
66 return Boolean.FALSE; | |
67 } | |
68 | |
69 if ("sinfo_flow_depth_development".equals(output)) { | |
70 if (FlowDepthProcessor.FACET_FLOW_DEPTH_CURRENT_FILTERED.equals(name)) | |
71 return Boolean.FALSE; | |
72 if (FlowDepthProcessor.FACET_FLOW_DEPTH_HISTORICAL_FILTERED.equals(name)) | |
73 return Boolean.FALSE; | |
74 if (FlowDepthDevelopmentProcessor.FACET_WATERLEVEL_DIFFERENCE_FILTERED.equals(name)) | |
75 return Boolean.FALSE; | |
76 if (FlowDepthDevelopmentProcessor.FACET_BEDHEIGHT_DIFFERENCE_FILTERED.equals(name)) | |
77 return Boolean.FALSE; | |
78 } | |
79 | |
8980
b194fa64506a
SINFO - show results themes according to spec, either raw data or floating mean values.
gernotbelger
parents:
8956
diff
changeset
|
80 if (FlowDepthProcessor.FACET_FLOW_DEPTH_RAW.equals(name)) |
b194fa64506a
SINFO - show results themes according to spec, either raw data or floating mean values.
gernotbelger
parents:
8956
diff
changeset
|
81 return Boolean.FALSE; |
b194fa64506a
SINFO - show results themes according to spec, either raw data or floating mean values.
gernotbelger
parents:
8956
diff
changeset
|
82 if (FlowDepthProcessor.FACET_FLOW_DEPTH_TKH_RAW.equals(name)) |
b194fa64506a
SINFO - show results themes according to spec, either raw data or floating mean values.
gernotbelger
parents:
8956
diff
changeset
|
83 return Boolean.FALSE; |
b194fa64506a
SINFO - show results themes according to spec, either raw data or floating mean values.
gernotbelger
parents:
8956
diff
changeset
|
84 if (FlowDepthProcessor.FACET_FLOW_DEPTH_CURRENT_RAW.equals(name)) |
b194fa64506a
SINFO - show results themes according to spec, either raw data or floating mean values.
gernotbelger
parents:
8956
diff
changeset
|
85 return Boolean.FALSE; |
b194fa64506a
SINFO - show results themes according to spec, either raw data or floating mean values.
gernotbelger
parents:
8956
diff
changeset
|
86 if (FlowDepthProcessor.FACET_FLOW_DEPTH_HISTORICAL_RAW.equals(name)) |
b194fa64506a
SINFO - show results themes according to spec, either raw data or floating mean values.
gernotbelger
parents:
8956
diff
changeset
|
87 return Boolean.FALSE; |
b194fa64506a
SINFO - show results themes according to spec, either raw data or floating mean values.
gernotbelger
parents:
8956
diff
changeset
|
88 if (FlowDepthProcessor.FACET_FLOW_DEPTH_MIN_RAW.equals(name)) |
b194fa64506a
SINFO - show results themes according to spec, either raw data or floating mean values.
gernotbelger
parents:
8956
diff
changeset
|
89 return Boolean.FALSE; |
b194fa64506a
SINFO - show results themes according to spec, either raw data or floating mean values.
gernotbelger
parents:
8956
diff
changeset
|
90 if (FlowDepthProcessor.FACET_FLOW_DEPTH_MAX_RAW.equals(name)) |
b194fa64506a
SINFO - show results themes according to spec, either raw data or floating mean values.
gernotbelger
parents:
8956
diff
changeset
|
91 return Boolean.FALSE; |
b194fa64506a
SINFO - show results themes according to spec, either raw data or floating mean values.
gernotbelger
parents:
8956
diff
changeset
|
92 |
b194fa64506a
SINFO - show results themes according to spec, either raw data or floating mean values.
gernotbelger
parents:
8956
diff
changeset
|
93 if (FlowDepthDevelopmentProcessor.FACET_FLOW_DEPTH_DEVELOPMENT_RAW.equals(name)) |
b194fa64506a
SINFO - show results themes according to spec, either raw data or floating mean values.
gernotbelger
parents:
8956
diff
changeset
|
94 return Boolean.FALSE; |
b194fa64506a
SINFO - show results themes according to spec, either raw data or floating mean values.
gernotbelger
parents:
8956
diff
changeset
|
95 if (FlowDepthDevelopmentPerYearProcessor.FACET_FLOW_DEPTH_DEVELOPMENT_PER_YEAR_RAW.equals(name)) |
b194fa64506a
SINFO - show results themes according to spec, either raw data or floating mean values.
gernotbelger
parents:
8956
diff
changeset
|
96 return Boolean.FALSE; |
b194fa64506a
SINFO - show results themes according to spec, either raw data or floating mean values.
gernotbelger
parents:
8956
diff
changeset
|
97 |
9596
fbfd66e8fb81
Softwaretests...20181219 6.2.2: Sinfo/Ued Haupt-/Extremwerte update for current km, W/Q of selected WSPL initially visible
mschaefer
parents:
9307
diff
changeset
|
98 // if (FloodDurationCurveProcessor.FACET_FLOOD_DURATION_MAINVALUES_W.equals(name)) |
fbfd66e8fb81
Softwaretests...20181219 6.2.2: Sinfo/Ued Haupt-/Extremwerte update for current km, W/Q of selected WSPL initially visible
mschaefer
parents:
9307
diff
changeset
|
99 // return Boolean.FALSE; |
fbfd66e8fb81
Softwaretests...20181219 6.2.2: Sinfo/Ued Haupt-/Extremwerte update for current km, W/Q of selected WSPL initially visible
mschaefer
parents:
9307
diff
changeset
|
100 // if (FloodDurationCurveProcessor.FACET_FLOOD_DURATION_MAINVALUES_Q.equals(name)) |
fbfd66e8fb81
Softwaretests...20181219 6.2.2: Sinfo/Ued Haupt-/Extremwerte update for current km, W/Q of selected WSPL initially visible
mschaefer
parents:
9307
diff
changeset
|
101 // return Boolean.FALSE; |
9307
45bbd2c232f8
S-Info main value themes in flood duration w/q set to initially invisible
mschaefer
parents:
8980
diff
changeset
|
102 |
8956 | 103 return null; |
104 } | |
105 }); | |
106 } | |
107 | |
8854 | 108 /** |
109 * Default constructor, because it's serializable. | |
110 */ | |
111 public SINFOArtifact() { | |
112 } | |
113 | |
114 /** | |
115 * Returns the name of the concrete artifact. | |
116 * | |
117 * @return the name of the concrete artifact. | |
118 */ | |
119 @Override | |
120 public String getName() { | |
121 return ARTIFACT_NAME; | |
122 } | |
8946
5d5d482da3e9
Implementing SINFO - FlowDepthMinMax calculation
gernotbelger
parents:
8869
diff
changeset
|
123 |
8854 | 124 public SinfoCalcMode getCalculationMode() { |
125 | |
8946
5d5d482da3e9
Implementing SINFO - FlowDepthMinMax calculation
gernotbelger
parents:
8869
diff
changeset
|
126 final String calc = getDataAsString(FIELD_MODE); |
8854 | 127 if (calc == null) { |
8946
5d5d482da3e9
Implementing SINFO - FlowDepthMinMax calculation
gernotbelger
parents:
8869
diff
changeset
|
128 throw new IllegalArgumentException(ERROR_NO_CALCULATION_MODE); |
8854 | 129 } |
130 | |
131 try { | |
8946
5d5d482da3e9
Implementing SINFO - FlowDepthMinMax calculation
gernotbelger
parents:
8869
diff
changeset
|
132 return SinfoCalcMode.valueOf(StringUtils.trimToEmpty(calc).toLowerCase()); |
5d5d482da3e9
Implementing SINFO - FlowDepthMinMax calculation
gernotbelger
parents:
8869
diff
changeset
|
133 } |
5d5d482da3e9
Implementing SINFO - FlowDepthMinMax calculation
gernotbelger
parents:
8869
diff
changeset
|
134 catch (final Exception e) { |
5d5d482da3e9
Implementing SINFO - FlowDepthMinMax calculation
gernotbelger
parents:
8869
diff
changeset
|
135 throw new IllegalArgumentException(ERROR_INVALID_CALCULATION_MODE, e); |
5d5d482da3e9
Implementing SINFO - FlowDepthMinMax calculation
gernotbelger
parents:
8869
diff
changeset
|
136 } |
5d5d482da3e9
Implementing SINFO - FlowDepthMinMax calculation
gernotbelger
parents:
8869
diff
changeset
|
137 } |
5d5d482da3e9
Implementing SINFO - FlowDepthMinMax calculation
gernotbelger
parents:
8869
diff
changeset
|
138 |
8854 | 139 public String getRiver() { |
8946
5d5d482da3e9
Implementing SINFO - FlowDepthMinMax calculation
gernotbelger
parents:
8869
diff
changeset
|
140 return getDataAsString(FIELD_RIVER); |
5d5d482da3e9
Implementing SINFO - FlowDepthMinMax calculation
gernotbelger
parents:
8869
diff
changeset
|
141 } |
8854 | 142 } |