Mercurial > dive4elements > river
annotate artifacts/src/main/java/org/dive4elements/river/artifacts/math/BackJumpCorrector.java @ 9801:1d7a72a50183 3.2.x tip
Assume Compose V2, consistently
author | Tom Gottfried <tom@intevation.de> |
---|---|
date | Thu, 23 Nov 2023 10:14:13 +0100 |
parents | 0a5239a1e46e |
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:
5863
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:
5863
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:
3076
diff
changeset
|
9 package org.dive4elements.river.artifacts.math; |
343
f165c7d5d6db
Implementation of the "Ruecksprungkorrektur" to be done in "W fuer angepassten Abflusslaengschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
10 |
f165c7d5d6db
Implementation of the "Ruecksprungkorrektur" to be done in "W fuer angepassten Abflusslaengschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
11 import java.util.ArrayList; |
f165c7d5d6db
Implementation of the "Ruecksprungkorrektur" to be done in "W fuer angepassten Abflusslaengschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
12 import java.util.List; |
f165c7d5d6db
Implementation of the "Ruecksprungkorrektur" to be done in "W fuer angepassten Abflusslaengschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
13 |
f165c7d5d6db
Implementation of the "Ruecksprungkorrektur" to be done in "W fuer angepassten Abflusslaengschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
14 import java.io.Serializable; |
f165c7d5d6db
Implementation of the "Ruecksprungkorrektur" to be done in "W fuer angepassten Abflusslaengschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
15 |
f165c7d5d6db
Implementation of the "Ruecksprungkorrektur" to be done in "W fuer angepassten Abflusslaengschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
16 import org.apache.commons.math.analysis.interpolation.SplineInterpolator; |
f165c7d5d6db
Implementation of the "Ruecksprungkorrektur" to be done in "W fuer angepassten Abflusslaengschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
17 |
f165c7d5d6db
Implementation of the "Ruecksprungkorrektur" to be done in "W fuer angepassten Abflusslaengschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
18 import org.apache.commons.math.analysis.polynomials.PolynomialSplineFunction; |
f165c7d5d6db
Implementation of the "Ruecksprungkorrektur" to be done in "W fuer angepassten Abflusslaengschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
19 |
f165c7d5d6db
Implementation of the "Ruecksprungkorrektur" to be done in "W fuer angepassten Abflusslaengschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
20 import org.apache.commons.math.ArgumentOutsideDomainException; |
f165c7d5d6db
Implementation of the "Ruecksprungkorrektur" to be done in "W fuer angepassten Abflusslaengschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
21 |
649
44175d4720f8
Fix crashes in back jump correction.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
642
diff
changeset
|
22 import org.apache.commons.math.exception.MathIllegalArgumentException; |
44175d4720f8
Fix crashes in back jump correction.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
642
diff
changeset
|
23 |
9726 | 24 import org.apache.logging.log4j.Logger; |
25 import org.apache.logging.log4j.LogManager; | |
343
f165c7d5d6db
Implementation of the "Ruecksprungkorrektur" to be done in "W fuer angepassten Abflusslaengschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
26 |
5831
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3076
diff
changeset
|
27 import org.dive4elements.river.artifacts.model.Calculation; |
674
d5f9ba1d055f
Added calculation base class to collect the problems during the calculations. Adjusted calculation 4 to use the mechanism.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
662
diff
changeset
|
28 |
5831
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3076
diff
changeset
|
29 import org.dive4elements.river.utils.DoubleUtil; |
1672
0b6dac664bbb
Moved some generic double array code from BackjumpCorrector to DoubleUtil
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
742
diff
changeset
|
30 |
343
f165c7d5d6db
Implementation of the "Ruecksprungkorrektur" to be done in "W fuer angepassten Abflusslaengschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
31 public class BackJumpCorrector |
f165c7d5d6db
Implementation of the "Ruecksprungkorrektur" to be done in "W fuer angepassten Abflusslaengschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
32 implements Serializable |
f165c7d5d6db
Implementation of the "Ruecksprungkorrektur" to be done in "W fuer angepassten Abflusslaengschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
33 { |
9726 | 34 private static Logger log = LogManager.getLogger(BackJumpCorrector.class); |
343
f165c7d5d6db
Implementation of the "Ruecksprungkorrektur" to be done in "W fuer angepassten Abflusslaengschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
35 |
f165c7d5d6db
Implementation of the "Ruecksprungkorrektur" to be done in "W fuer angepassten Abflusslaengschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
36 protected ArrayList<Double> backjumps; |
f165c7d5d6db
Implementation of the "Ruecksprungkorrektur" to be done in "W fuer angepassten Abflusslaengschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
37 |
f165c7d5d6db
Implementation of the "Ruecksprungkorrektur" to be done in "W fuer angepassten Abflusslaengschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
38 protected double [] corrected; |
f165c7d5d6db
Implementation of the "Ruecksprungkorrektur" to be done in "W fuer angepassten Abflusslaengschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
39 |
f165c7d5d6db
Implementation of the "Ruecksprungkorrektur" to be done in "W fuer angepassten Abflusslaengschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
40 public BackJumpCorrector() { |
f165c7d5d6db
Implementation of the "Ruecksprungkorrektur" to be done in "W fuer angepassten Abflusslaengschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
41 backjumps = new ArrayList<Double>(); |
f165c7d5d6db
Implementation of the "Ruecksprungkorrektur" to be done in "W fuer angepassten Abflusslaengschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
42 } |
f165c7d5d6db
Implementation of the "Ruecksprungkorrektur" to be done in "W fuer angepassten Abflusslaengschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
43 |
f165c7d5d6db
Implementation of the "Ruecksprungkorrektur" to be done in "W fuer angepassten Abflusslaengschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
44 public boolean hasBackJumps() { |
f165c7d5d6db
Implementation of the "Ruecksprungkorrektur" to be done in "W fuer angepassten Abflusslaengschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
45 return !backjumps.isEmpty(); |
f165c7d5d6db
Implementation of the "Ruecksprungkorrektur" to be done in "W fuer angepassten Abflusslaengschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
46 } |
f165c7d5d6db
Implementation of the "Ruecksprungkorrektur" to be done in "W fuer angepassten Abflusslaengschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
47 |
f165c7d5d6db
Implementation of the "Ruecksprungkorrektur" to be done in "W fuer angepassten Abflusslaengschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
48 public List<Double> getBackJumps() { |
f165c7d5d6db
Implementation of the "Ruecksprungkorrektur" to be done in "W fuer angepassten Abflusslaengschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
49 return backjumps; |
f165c7d5d6db
Implementation of the "Ruecksprungkorrektur" to be done in "W fuer angepassten Abflusslaengschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
50 } |
f165c7d5d6db
Implementation of the "Ruecksprungkorrektur" to be done in "W fuer angepassten Abflusslaengschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
51 |
f165c7d5d6db
Implementation of the "Ruecksprungkorrektur" to be done in "W fuer angepassten Abflusslaengschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
52 public double [] getCorrected() { |
f165c7d5d6db
Implementation of the "Ruecksprungkorrektur" to be done in "W fuer angepassten Abflusslaengschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
53 return corrected; |
f165c7d5d6db
Implementation of the "Ruecksprungkorrektur" to be done in "W fuer angepassten Abflusslaengschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
54 } |
f165c7d5d6db
Implementation of the "Ruecksprungkorrektur" to be done in "W fuer angepassten Abflusslaengschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
55 |
674
d5f9ba1d055f
Added calculation base class to collect the problems during the calculations. Adjusted calculation 4 to use the mechanism.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
662
diff
changeset
|
56 public boolean doCorrection( |
d5f9ba1d055f
Added calculation base class to collect the problems during the calculations. Adjusted calculation 4 to use the mechanism.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
662
diff
changeset
|
57 double [] km, |
d5f9ba1d055f
Added calculation base class to collect the problems during the calculations. Adjusted calculation 4 to use the mechanism.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
662
diff
changeset
|
58 double [] ws, |
d5f9ba1d055f
Added calculation base class to collect the problems during the calculations. Adjusted calculation 4 to use the mechanism.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
662
diff
changeset
|
59 Calculation errors |
d5f9ba1d055f
Added calculation base class to collect the problems during the calculations. Adjusted calculation 4 to use the mechanism.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
662
diff
changeset
|
60 ) { |
1672
0b6dac664bbb
Moved some generic double array code from BackjumpCorrector to DoubleUtil
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
742
diff
changeset
|
61 boolean wsUp = DoubleUtil.isIncreasing(ws); |
642
2dbbb5be30a1
Re-eanbled the calculation of the backjump correction.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
406
diff
changeset
|
62 |
2dbbb5be30a1
Re-eanbled the calculation of the backjump correction.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
406
diff
changeset
|
63 if (wsUp) { |
1672
0b6dac664bbb
Moved some generic double array code from BackjumpCorrector to DoubleUtil
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
742
diff
changeset
|
64 km = DoubleUtil.swapClone(km); |
0b6dac664bbb
Moved some generic double array code from BackjumpCorrector to DoubleUtil
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
742
diff
changeset
|
65 ws = DoubleUtil.swapClone(ws); |
406
663aa18bee7f
Back jump correction should work now for both flow directions.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
343
diff
changeset
|
66 } |
663aa18bee7f
Back jump correction should work now for both flow directions.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
343
diff
changeset
|
67 |
1672
0b6dac664bbb
Moved some generic double array code from BackjumpCorrector to DoubleUtil
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
742
diff
changeset
|
68 boolean kmUp = DoubleUtil.isIncreasing(km); |
642
2dbbb5be30a1
Re-eanbled the calculation of the backjump correction.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
406
diff
changeset
|
69 |
2dbbb5be30a1
Re-eanbled the calculation of the backjump correction.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
406
diff
changeset
|
70 if (!kmUp) { |
1672
0b6dac664bbb
Moved some generic double array code from BackjumpCorrector to DoubleUtil
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
742
diff
changeset
|
71 km = DoubleUtil.sumDiffs(km); |
642
2dbbb5be30a1
Re-eanbled the calculation of the backjump correction.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
406
diff
changeset
|
72 } |
2dbbb5be30a1
Re-eanbled the calculation of the backjump correction.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
406
diff
changeset
|
73 |
2dbbb5be30a1
Re-eanbled the calculation of the backjump correction.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
406
diff
changeset
|
74 if (log.isDebugEnabled()) { |
2dbbb5be30a1
Re-eanbled the calculation of the backjump correction.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
406
diff
changeset
|
75 log.debug("BackJumpCorrector.doCorrection ------- enter"); |
1672
0b6dac664bbb
Moved some generic double array code from BackjumpCorrector to DoubleUtil
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
742
diff
changeset
|
76 log.debug(" km increasing: " + DoubleUtil.isIncreasing(km)); |
0b6dac664bbb
Moved some generic double array code from BackjumpCorrector to DoubleUtil
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
742
diff
changeset
|
77 log.debug(" ws increasing: " + DoubleUtil.isIncreasing(ws)); |
642
2dbbb5be30a1
Re-eanbled the calculation of the backjump correction.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
406
diff
changeset
|
78 log.debug("BackJumpCorrector.doCorrection ------- leave"); |
406
663aa18bee7f
Back jump correction should work now for both flow directions.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
343
diff
changeset
|
79 } |
663aa18bee7f
Back jump correction should work now for both flow directions.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
343
diff
changeset
|
80 |
674
d5f9ba1d055f
Added calculation base class to collect the problems during the calculations. Adjusted calculation 4 to use the mechanism.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
662
diff
changeset
|
81 boolean hasBackJumps = doCorrectionClean(km, ws, errors); |
406
663aa18bee7f
Back jump correction should work now for both flow directions.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
343
diff
changeset
|
82 |
642
2dbbb5be30a1
Re-eanbled the calculation of the backjump correction.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
406
diff
changeset
|
83 if (hasBackJumps && wsUp) { |
406
663aa18bee7f
Back jump correction should work now for both flow directions.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
343
diff
changeset
|
84 // mirror back |
1672
0b6dac664bbb
Moved some generic double array code from BackjumpCorrector to DoubleUtil
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
742
diff
changeset
|
85 DoubleUtil.swap(corrected); |
406
663aa18bee7f
Back jump correction should work now for both flow directions.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
343
diff
changeset
|
86 } |
663aa18bee7f
Back jump correction should work now for both flow directions.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
343
diff
changeset
|
87 |
663aa18bee7f
Back jump correction should work now for both flow directions.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
343
diff
changeset
|
88 return hasBackJumps; |
663aa18bee7f
Back jump correction should work now for both flow directions.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
343
diff
changeset
|
89 } |
663aa18bee7f
Back jump correction should work now for both flow directions.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
343
diff
changeset
|
90 |
674
d5f9ba1d055f
Added calculation base class to collect the problems during the calculations. Adjusted calculation 4 to use the mechanism.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
662
diff
changeset
|
91 protected boolean doCorrectionClean( |
d5f9ba1d055f
Added calculation base class to collect the problems during the calculations. Adjusted calculation 4 to use the mechanism.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
662
diff
changeset
|
92 double [] km, |
d5f9ba1d055f
Added calculation base class to collect the problems during the calculations. Adjusted calculation 4 to use the mechanism.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
662
diff
changeset
|
93 double [] ws, |
d5f9ba1d055f
Added calculation base class to collect the problems during the calculations. Adjusted calculation 4 to use the mechanism.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
662
diff
changeset
|
94 Calculation errors |
d5f9ba1d055f
Added calculation base class to collect the problems during the calculations. Adjusted calculation 4 to use the mechanism.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
662
diff
changeset
|
95 ) { |
343
f165c7d5d6db
Implementation of the "Ruecksprungkorrektur" to be done in "W fuer angepassten Abflusslaengschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
96 int N = km.length; |
f165c7d5d6db
Implementation of the "Ruecksprungkorrektur" to be done in "W fuer angepassten Abflusslaengschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
97 |
f165c7d5d6db
Implementation of the "Ruecksprungkorrektur" to be done in "W fuer angepassten Abflusslaengschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
98 if (N != ws.length) { |
f165c7d5d6db
Implementation of the "Ruecksprungkorrektur" to be done in "W fuer angepassten Abflusslaengschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
99 throw new IllegalArgumentException("km.length != ws.length"); |
f165c7d5d6db
Implementation of the "Ruecksprungkorrektur" to be done in "W fuer angepassten Abflusslaengschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
100 } |
f165c7d5d6db
Implementation of the "Ruecksprungkorrektur" to be done in "W fuer angepassten Abflusslaengschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
101 |
f165c7d5d6db
Implementation of the "Ruecksprungkorrektur" to be done in "W fuer angepassten Abflusslaengschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
102 if (N < 2) { |
f165c7d5d6db
Implementation of the "Ruecksprungkorrektur" to be done in "W fuer angepassten Abflusslaengschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
103 return false; |
f165c7d5d6db
Implementation of the "Ruecksprungkorrektur" to be done in "W fuer angepassten Abflusslaengschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
104 } |
f165c7d5d6db
Implementation of the "Ruecksprungkorrektur" to be done in "W fuer angepassten Abflusslaengschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
105 |
f165c7d5d6db
Implementation of the "Ruecksprungkorrektur" to be done in "W fuer angepassten Abflusslaengschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
106 SplineInterpolator interpolator = null; |
f165c7d5d6db
Implementation of the "Ruecksprungkorrektur" to be done in "W fuer angepassten Abflusslaengschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
107 |
f165c7d5d6db
Implementation of the "Ruecksprungkorrektur" to be done in "W fuer angepassten Abflusslaengschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
108 for (int i = 1; i < N; ++i) { |
f165c7d5d6db
Implementation of the "Ruecksprungkorrektur" to be done in "W fuer angepassten Abflusslaengschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
109 if (ws[i] <= ws[i-1]) { |
f165c7d5d6db
Implementation of the "Ruecksprungkorrektur" to be done in "W fuer angepassten Abflusslaengschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
110 // no back jump |
f165c7d5d6db
Implementation of the "Ruecksprungkorrektur" to be done in "W fuer angepassten Abflusslaengschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
111 continue; |
f165c7d5d6db
Implementation of the "Ruecksprungkorrektur" to be done in "W fuer angepassten Abflusslaengschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
112 } |
f165c7d5d6db
Implementation of the "Ruecksprungkorrektur" to be done in "W fuer angepassten Abflusslaengschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
113 backjumps.add(km[i]); |
f165c7d5d6db
Implementation of the "Ruecksprungkorrektur" to be done in "W fuer angepassten Abflusslaengschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
114 |
f165c7d5d6db
Implementation of the "Ruecksprungkorrektur" to be done in "W fuer angepassten Abflusslaengschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
115 if (corrected == null) { |
f165c7d5d6db
Implementation of the "Ruecksprungkorrektur" to be done in "W fuer angepassten Abflusslaengschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
116 // lazy cloning |
f165c7d5d6db
Implementation of the "Ruecksprungkorrektur" to be done in "W fuer angepassten Abflusslaengschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
117 ws = corrected = (double [])ws.clone(); |
f165c7d5d6db
Implementation of the "Ruecksprungkorrektur" to be done in "W fuer angepassten Abflusslaengschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
118 } |
f165c7d5d6db
Implementation of the "Ruecksprungkorrektur" to be done in "W fuer angepassten Abflusslaengschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
119 |
1674
b5209452f6bb
flys/issue31: Simplified the back jump correction code a lot.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1672
diff
changeset
|
120 double above = aboveWaterKM(km, ws, i); |
343
f165c7d5d6db
Implementation of the "Ruecksprungkorrektur" to be done in "W fuer angepassten Abflusslaengschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
121 |
1674
b5209452f6bb
flys/issue31: Simplified the back jump correction code a lot.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1672
diff
changeset
|
122 if (Double.isNaN(above)) { // run over start km |
b5209452f6bb
flys/issue31: Simplified the back jump correction code a lot.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1672
diff
changeset
|
123 // fill all previous |
343
f165c7d5d6db
Implementation of the "Ruecksprungkorrektur" to be done in "W fuer angepassten Abflusslaengschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
124 for (int j = 0; j < i; ++j) { |
f165c7d5d6db
Implementation of the "Ruecksprungkorrektur" to be done in "W fuer angepassten Abflusslaengschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
125 ws[j] = ws[i]; |
f165c7d5d6db
Implementation of the "Ruecksprungkorrektur" to be done in "W fuer angepassten Abflusslaengschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
126 } |
f165c7d5d6db
Implementation of the "Ruecksprungkorrektur" to be done in "W fuer angepassten Abflusslaengschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
127 continue; |
f165c7d5d6db
Implementation of the "Ruecksprungkorrektur" to be done in "W fuer angepassten Abflusslaengschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
128 } |
f165c7d5d6db
Implementation of the "Ruecksprungkorrektur" to be done in "W fuer angepassten Abflusslaengschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
129 |
1674
b5209452f6bb
flys/issue31: Simplified the back jump correction code a lot.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1672
diff
changeset
|
130 double distance = Math.abs(km[i] - above); |
b5209452f6bb
flys/issue31: Simplified the back jump correction code a lot.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1672
diff
changeset
|
131 |
343
f165c7d5d6db
Implementation of the "Ruecksprungkorrektur" to be done in "W fuer angepassten Abflusslaengschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
132 double quarterDistance = 0.25*distance; |
f165c7d5d6db
Implementation of the "Ruecksprungkorrektur" to be done in "W fuer angepassten Abflusslaengschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
133 |
1674
b5209452f6bb
flys/issue31: Simplified the back jump correction code a lot.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1672
diff
changeset
|
134 double start = above - quarterDistance; |
343
f165c7d5d6db
Implementation of the "Ruecksprungkorrektur" to be done in "W fuer angepassten Abflusslaengschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
135 |
1674
b5209452f6bb
flys/issue31: Simplified the back jump correction code a lot.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1672
diff
changeset
|
136 double startHeight = DoubleUtil.interpolateSorted(km, ws, start); |
b5209452f6bb
flys/issue31: Simplified the back jump correction code a lot.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1672
diff
changeset
|
137 |
b5209452f6bb
flys/issue31: Simplified the back jump correction code a lot.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1672
diff
changeset
|
138 if (Double.isNaN(startHeight)) { |
b5209452f6bb
flys/issue31: Simplified the back jump correction code a lot.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1672
diff
changeset
|
139 // run over start km |
b5209452f6bb
flys/issue31: Simplified the back jump correction code a lot.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1672
diff
changeset
|
140 startHeight = ws[0]; |
343
f165c7d5d6db
Implementation of the "Ruecksprungkorrektur" to be done in "W fuer angepassten Abflusslaengschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
141 } |
f165c7d5d6db
Implementation of the "Ruecksprungkorrektur" to be done in "W fuer angepassten Abflusslaengschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
142 |
1674
b5209452f6bb
flys/issue31: Simplified the back jump correction code a lot.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1672
diff
changeset
|
143 double between = above + quarterDistance; |
343
f165c7d5d6db
Implementation of the "Ruecksprungkorrektur" to be done in "W fuer angepassten Abflusslaengschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
144 |
1676
6e840e213fdf
Backjump correction: Finally looks fine.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1674
diff
changeset
|
145 double aboveHeight = ws[i] + 0.25*(startHeight - ws[i]); |
343
f165c7d5d6db
Implementation of the "Ruecksprungkorrektur" to be done in "W fuer angepassten Abflusslaengschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
146 |
1676
6e840e213fdf
Backjump correction: Finally looks fine.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1674
diff
changeset
|
147 double [] x = { start, above, between }; |
6e840e213fdf
Backjump correction: Finally looks fine.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1674
diff
changeset
|
148 double [] y = { startHeight, aboveHeight, ws[i] }; |
343
f165c7d5d6db
Implementation of the "Ruecksprungkorrektur" to be done in "W fuer angepassten Abflusslaengschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
149 |
642
2dbbb5be30a1
Re-eanbled the calculation of the backjump correction.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
406
diff
changeset
|
150 if (log.isDebugEnabled()) { |
2dbbb5be30a1
Re-eanbled the calculation of the backjump correction.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
406
diff
changeset
|
151 for (int j = 0; j < x.length; ++j) { |
2dbbb5be30a1
Re-eanbled the calculation of the backjump correction.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
406
diff
changeset
|
152 log.debug(" " + x[j] + " -> " + y[j]); |
2dbbb5be30a1
Re-eanbled the calculation of the backjump correction.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
406
diff
changeset
|
153 } |
2dbbb5be30a1
Re-eanbled the calculation of the backjump correction.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
406
diff
changeset
|
154 } |
2dbbb5be30a1
Re-eanbled the calculation of the backjump correction.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
406
diff
changeset
|
155 |
1674
b5209452f6bb
flys/issue31: Simplified the back jump correction code a lot.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1672
diff
changeset
|
156 if (interpolator == null) { |
b5209452f6bb
flys/issue31: Simplified the back jump correction code a lot.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1672
diff
changeset
|
157 interpolator = new SplineInterpolator(); |
b5209452f6bb
flys/issue31: Simplified the back jump correction code a lot.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1672
diff
changeset
|
158 } |
b5209452f6bb
flys/issue31: Simplified the back jump correction code a lot.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1672
diff
changeset
|
159 |
649
44175d4720f8
Fix crashes in back jump correction.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
642
diff
changeset
|
160 PolynomialSplineFunction spline; |
742
c09c9e05ecfa
Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
674
diff
changeset
|
161 |
649
44175d4720f8
Fix crashes in back jump correction.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
642
diff
changeset
|
162 try { |
44175d4720f8
Fix crashes in back jump correction.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
642
diff
changeset
|
163 spline = interpolator.interpolate(x, y); |
44175d4720f8
Fix crashes in back jump correction.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
642
diff
changeset
|
164 } |
44175d4720f8
Fix crashes in back jump correction.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
642
diff
changeset
|
165 catch (MathIllegalArgumentException miae) { |
2166
2898b1ff6013
I18N for WINFO calculation result messages.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1676
diff
changeset
|
166 errors.addProblem("spline.creation.failed"); |
649
44175d4720f8
Fix crashes in back jump correction.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
642
diff
changeset
|
167 log.error(miae); |
44175d4720f8
Fix crashes in back jump correction.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
642
diff
changeset
|
168 continue; |
44175d4720f8
Fix crashes in back jump correction.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
642
diff
changeset
|
169 } |
343
f165c7d5d6db
Implementation of the "Ruecksprungkorrektur" to be done in "W fuer angepassten Abflusslaengschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
170 |
f165c7d5d6db
Implementation of the "Ruecksprungkorrektur" to be done in "W fuer angepassten Abflusslaengschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
171 try { |
f165c7d5d6db
Implementation of the "Ruecksprungkorrektur" to be done in "W fuer angepassten Abflusslaengschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
172 if (log.isDebugEnabled()) { |
f165c7d5d6db
Implementation of the "Ruecksprungkorrektur" to be done in "W fuer angepassten Abflusslaengschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
173 log.debug("spline points:"); |
f165c7d5d6db
Implementation of the "Ruecksprungkorrektur" to be done in "W fuer angepassten Abflusslaengschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
174 for (int j = 0; j < x.length; ++j) { |
f165c7d5d6db
Implementation of the "Ruecksprungkorrektur" to be done in "W fuer angepassten Abflusslaengschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
175 log.debug(x[j] + " " + y[j] + " " + spline.value(x[j])); |
f165c7d5d6db
Implementation of the "Ruecksprungkorrektur" to be done in "W fuer angepassten Abflusslaengschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
176 } |
f165c7d5d6db
Implementation of the "Ruecksprungkorrektur" to be done in "W fuer angepassten Abflusslaengschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
177 } |
f165c7d5d6db
Implementation of the "Ruecksprungkorrektur" to be done in "W fuer angepassten Abflusslaengschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
178 |
1676
6e840e213fdf
Backjump correction: Finally looks fine.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1674
diff
changeset
|
179 int j = i-1; |
6e840e213fdf
Backjump correction: Finally looks fine.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1674
diff
changeset
|
180 |
6e840e213fdf
Backjump correction: Finally looks fine.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1674
diff
changeset
|
181 for (; j >= 0 && km[j] >= between; --j) { |
6e840e213fdf
Backjump correction: Finally looks fine.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1674
diff
changeset
|
182 ws[j] = ws[i]; |
6e840e213fdf
Backjump correction: Finally looks fine.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1674
diff
changeset
|
183 } |
6e840e213fdf
Backjump correction: Finally looks fine.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1674
diff
changeset
|
184 |
6e840e213fdf
Backjump correction: Finally looks fine.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1674
diff
changeset
|
185 for (; j >= 0 && ws[j] < startHeight; --j) { |
1674
b5209452f6bb
flys/issue31: Simplified the back jump correction code a lot.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1672
diff
changeset
|
186 ws[j] = spline.value(km[j]); |
343
f165c7d5d6db
Implementation of the "Ruecksprungkorrektur" to be done in "W fuer angepassten Abflusslaengschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
187 } |
f165c7d5d6db
Implementation of the "Ruecksprungkorrektur" to be done in "W fuer angepassten Abflusslaengschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
188 } |
f165c7d5d6db
Implementation of the "Ruecksprungkorrektur" to be done in "W fuer angepassten Abflusslaengschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
189 catch (ArgumentOutsideDomainException aode) { |
2166
2898b1ff6013
I18N for WINFO calculation result messages.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1676
diff
changeset
|
190 errors.addProblem("spline.interpolation.failed"); |
343
f165c7d5d6db
Implementation of the "Ruecksprungkorrektur" to be done in "W fuer angepassten Abflusslaengschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
191 log.error("spline interpolation failed", aode); |
f165c7d5d6db
Implementation of the "Ruecksprungkorrektur" to be done in "W fuer angepassten Abflusslaengschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
192 } |
f165c7d5d6db
Implementation of the "Ruecksprungkorrektur" to be done in "W fuer angepassten Abflusslaengschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
193 } // for all km |
f165c7d5d6db
Implementation of the "Ruecksprungkorrektur" to be done in "W fuer angepassten Abflusslaengschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
194 |
f165c7d5d6db
Implementation of the "Ruecksprungkorrektur" to be done in "W fuer angepassten Abflusslaengschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
195 return !backjumps.isEmpty(); |
f165c7d5d6db
Implementation of the "Ruecksprungkorrektur" to be done in "W fuer angepassten Abflusslaengschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
196 } |
1674
b5209452f6bb
flys/issue31: Simplified the back jump correction code a lot.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1672
diff
changeset
|
197 |
b5209452f6bb
flys/issue31: Simplified the back jump correction code a lot.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1672
diff
changeset
|
198 |
b5209452f6bb
flys/issue31: Simplified the back jump correction code a lot.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1672
diff
changeset
|
199 protected static double aboveWaterKM( |
3076
5642a83420f2
FLYS artifacts: Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
200 double [] km, |
5642a83420f2
FLYS artifacts: Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
201 double [] ws, |
1674
b5209452f6bb
flys/issue31: Simplified the back jump correction code a lot.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1672
diff
changeset
|
202 int wIndex |
b5209452f6bb
flys/issue31: Simplified the back jump correction code a lot.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1672
diff
changeset
|
203 ) { |
b5209452f6bb
flys/issue31: Simplified the back jump correction code a lot.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1672
diff
changeset
|
204 double w = ws[wIndex]; |
b5209452f6bb
flys/issue31: Simplified the back jump correction code a lot.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1672
diff
changeset
|
205 |
b5209452f6bb
flys/issue31: Simplified the back jump correction code a lot.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1672
diff
changeset
|
206 while (--wIndex >= 0) { |
b5209452f6bb
flys/issue31: Simplified the back jump correction code a lot.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1672
diff
changeset
|
207 // still under water |
b5209452f6bb
flys/issue31: Simplified the back jump correction code a lot.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1672
diff
changeset
|
208 if (ws[wIndex] < w) continue; |
b5209452f6bb
flys/issue31: Simplified the back jump correction code a lot.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1672
diff
changeset
|
209 |
b5209452f6bb
flys/issue31: Simplified the back jump correction code a lot.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1672
diff
changeset
|
210 if (ws[wIndex] > w) { |
b5209452f6bb
flys/issue31: Simplified the back jump correction code a lot.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1672
diff
changeset
|
211 // f(ws[wIndex]) = km[wIndex] |
b5209452f6bb
flys/issue31: Simplified the back jump correction code a lot.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1672
diff
changeset
|
212 // f(ws[wIndex+1]) = km[wIndex+1] |
b5209452f6bb
flys/issue31: Simplified the back jump correction code a lot.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1672
diff
changeset
|
213 return Linear.linear( |
b5209452f6bb
flys/issue31: Simplified the back jump correction code a lot.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1672
diff
changeset
|
214 w, |
b5209452f6bb
flys/issue31: Simplified the back jump correction code a lot.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1672
diff
changeset
|
215 ws[wIndex], ws[wIndex+1], |
b5209452f6bb
flys/issue31: Simplified the back jump correction code a lot.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1672
diff
changeset
|
216 km[wIndex], km[wIndex+1]); |
b5209452f6bb
flys/issue31: Simplified the back jump correction code a lot.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1672
diff
changeset
|
217 } |
b5209452f6bb
flys/issue31: Simplified the back jump correction code a lot.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1672
diff
changeset
|
218 else { |
b5209452f6bb
flys/issue31: Simplified the back jump correction code a lot.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1672
diff
changeset
|
219 return km[wIndex]; |
b5209452f6bb
flys/issue31: Simplified the back jump correction code a lot.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1672
diff
changeset
|
220 } |
b5209452f6bb
flys/issue31: Simplified the back jump correction code a lot.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1672
diff
changeset
|
221 } |
b5209452f6bb
flys/issue31: Simplified the back jump correction code a lot.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1672
diff
changeset
|
222 |
b5209452f6bb
flys/issue31: Simplified the back jump correction code a lot.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1672
diff
changeset
|
223 return Double.NaN; |
b5209452f6bb
flys/issue31: Simplified the back jump correction code a lot.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1672
diff
changeset
|
224 } |
343
f165c7d5d6db
Implementation of the "Ruecksprungkorrektur" to be done in "W fuer angepassten Abflusslaengschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
225 } |
f165c7d5d6db
Implementation of the "Ruecksprungkorrektur" to be done in "W fuer angepassten Abflusslaengschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
226 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |