annotate artifacts/src/main/java/org/dive4elements/river/artifacts/model/fixings/FixLongitudinalAnalysisFacet.java @ 9646:0380717105ba

Implemented alternative fitting strategy for Log-Linear function.
author Gernot Belger <g.belger@bjoernsen.de>
date Mon, 02 Dec 2019 17:56:15 +0100
parents 9744ce3c3853
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: 3610
diff changeset
9 package org.dive4elements.river.artifacts.model.fixings;
3169
b6da650b0718 FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
10
3610
66f539df4e8b Issue 716.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3415
diff changeset
11 import org.apache.log4j.Logger;
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 3610
diff changeset
12 import org.dive4elements.artifacts.Artifact;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 3610
diff changeset
13 import org.dive4elements.artifacts.CallContext;
5867
59ff03ff48f1 River artifacts: Renamed FLYSArtifact(Collection) to D4EArtifact(Collection).
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5863
diff changeset
14 import org.dive4elements.river.artifacts.D4EArtifact;
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 3610
diff changeset
15 import org.dive4elements.river.artifacts.model.CalculationResult;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 3610
diff changeset
16 import org.dive4elements.river.artifacts.model.DataFacet;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 3610
diff changeset
17 import org.dive4elements.river.artifacts.model.FacetTypes;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 3610
diff changeset
18 import org.dive4elements.river.artifacts.states.DefaultState.ComputeType;
3169
b6da650b0718 FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
19
b6da650b0718 FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
20 /**
b6da650b0718 FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
21 * Facet to show average W values for Q sectors.
b6da650b0718 FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
22 *
b6da650b0718 FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
23 * @author <a href="mailto:raimund.renkert@intevation.de">Raimund Renkert</a>
b6da650b0718 FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
24 */
9415
9744ce3c3853 Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents: 8856
diff changeset
25 public class FixLongitudinalAnalysisFacet extends DataFacet implements FacetTypes {
9744ce3c3853 Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents: 8856
diff changeset
26
9744ce3c3853 Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents: 8856
diff changeset
27 private static final long serialVersionUID = 1L;
3169
b6da650b0718 FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
28
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5994
diff changeset
29 /** House log. */
9415
9744ce3c3853 Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents: 8856
diff changeset
30 private static Logger log = Logger.getLogger(FixLongitudinalAnalysisFacet.class);
9744ce3c3853 Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents: 8856
diff changeset
31
9744ce3c3853 Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents: 8856
diff changeset
32 private int periodIndex;
9744ce3c3853 Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents: 8856
diff changeset
33
9744ce3c3853 Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents: 8856
diff changeset
34 private int columnId;
3169
b6da650b0718 FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
35
b6da650b0718 FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
36 /** Trivial Constructor. */
b6da650b0718 FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
37 public FixLongitudinalAnalysisFacet() {
b6da650b0718 FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
38 }
b6da650b0718 FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
39
9415
9744ce3c3853 Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents: 8856
diff changeset
40 public FixLongitudinalAnalysisFacet(final int facetIndex, final int periodIndex, final int columnId, final String name, final String description) {
9744ce3c3853 Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents: 8856
diff changeset
41 super(facetIndex, name, description, ComputeType.ADVANCE, null, null);
3169
b6da650b0718 FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
42
9415
9744ce3c3853 Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents: 8856
diff changeset
43 this.periodIndex = periodIndex;
9744ce3c3853 Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents: 8856
diff changeset
44 this.columnId = columnId;
3169
b6da650b0718 FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
45 }
b6da650b0718 FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
46
b6da650b0718 FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
47 /**
b6da650b0718 FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
48 * Returns the data this facet requires.
b6da650b0718 FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
49 *
9415
9744ce3c3853 Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents: 8856
diff changeset
50 * @param artifact
9744ce3c3853 Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents: 8856
diff changeset
51 * the owner artifact.
9744ce3c3853 Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents: 8856
diff changeset
52 * @param context
9744ce3c3853 Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents: 8856
diff changeset
53 * the CallContext.
3169
b6da650b0718 FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
54 *
b6da650b0718 FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
55 * @return the data as KMIndex.
b6da650b0718 FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
56 */
b6da650b0718 FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
57 @Override
9415
9744ce3c3853 Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents: 8856
diff changeset
58 public Object getData(final Artifact artifact, final CallContext context) {
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5994
diff changeset
59 log.debug("FixLongitudinalAnalysisFacet.getData");
3169
b6da650b0718 FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
60
5867
59ff03ff48f1 River artifacts: Renamed FLYSArtifact(Collection) to D4EArtifact(Collection).
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5863
diff changeset
61 if (artifact instanceof D4EArtifact) {
9415
9744ce3c3853 Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents: 8856
diff changeset
62 final D4EArtifact flys = (D4EArtifact) artifact;
3169
b6da650b0718 FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
63
9415
9744ce3c3853 Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents: 8856
diff changeset
64 final CalculationResult res = (CalculationResult) flys.compute(context, ComputeType.ADVANCE, false);
3169
b6da650b0718 FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
65
9415
9744ce3c3853 Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents: 8856
diff changeset
66 final FixAnalysisResult result = (FixAnalysisResult) res.getData();
3169
b6da650b0718 FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
67
9415
9744ce3c3853 Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents: 8856
diff changeset
68 final AnalysisPeriodEventResults eventResults = result.getAnalysisEventResults();
9744ce3c3853 Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents: 8856
diff changeset
69 final FixResultColumns eventResult = eventResults.getEventResults(this.periodIndex);
9744ce3c3853 Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents: 8856
diff changeset
70 if (eventResult == null) {
9744ce3c3853 Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents: 8856
diff changeset
71 log.error("No event result for period: " + this.periodIndex);
3169
b6da650b0718 FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
72 return null;
b6da650b0718 FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
73 }
9415
9744ce3c3853 Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents: 8856
diff changeset
74
9744ce3c3853 Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents: 8856
diff changeset
75 final FixResultColumn event = eventResult.getColumn(this.columnId);
9744ce3c3853 Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents: 8856
diff changeset
76 if (event == null) {
9744ce3c3853 Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents: 8856
diff changeset
77 log.error("Missing event with columnId: " + this.columnId);
9744ce3c3853 Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents: 8856
diff changeset
78 return null;
3610
66f539df4e8b Issue 716.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3415
diff changeset
79 }
3169
b6da650b0718 FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
80
9415
9744ce3c3853 Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents: 8856
diff changeset
81 return event.getQWDs();
3169
b6da650b0718 FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
82 }
9415
9744ce3c3853 Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents: 8856
diff changeset
83
9744ce3c3853 Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents: 8856
diff changeset
84 log.warn("Artifact is no instance of D4EArtifact.");
9744ce3c3853 Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents: 8856
diff changeset
85 return null;
3169
b6da650b0718 FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
86 }
b6da650b0718 FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
87
b6da650b0718 FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
88 /**
b6da650b0718 FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
89 * Create a deep copy of this Facet.
9415
9744ce3c3853 Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents: 8856
diff changeset
90 *
3169
b6da650b0718 FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
91 * @return a deep copy.
b6da650b0718 FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
92 */
b6da650b0718 FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
93 @Override
b6da650b0718 FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
94 public FixLongitudinalAnalysisFacet deepCopy() {
9415
9744ce3c3853 Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents: 8856
diff changeset
95 final FixLongitudinalAnalysisFacet copy = new FixLongitudinalAnalysisFacet();
3169
b6da650b0718 FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
96 copy.set(this);
9415
9744ce3c3853 Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents: 8856
diff changeset
97 copy.periodIndex = this.periodIndex;
9744ce3c3853 Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents: 8856
diff changeset
98 copy.columnId = this.columnId;
3169
b6da650b0718 FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
99 return copy;
b6da650b0718 FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
100 }
9415
9744ce3c3853 Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents: 8856
diff changeset
101 }

http://dive4elements.wald.intevation.org