Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/math/BackJumpCorrector.java @ 1792:49ad801076e4
Enabled the MapGenerator to create WMS layers with database datastore - riveraxis is the first layer that is no longer fetched from static WMS service but from user specific one.
flys-artifacts/trunk@3115 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Fri, 28 Oct 2011 13:48:02 +0000 |
parents | 6e840e213fdf |
children | 2898b1ff6013 |
rev | line source |
---|---|
343
f165c7d5d6db
Implementation of the "Ruecksprungkorrektur" to be done in "W fuer angepassten Abflusslaengschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.artifacts.math; |
f165c7d5d6db
Implementation of the "Ruecksprungkorrektur" to be done in "W fuer angepassten Abflusslaengschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
2 |
f165c7d5d6db
Implementation of the "Ruecksprungkorrektur" to be done in "W fuer angepassten Abflusslaengschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
3 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
|
4 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
|
5 |
f165c7d5d6db
Implementation of the "Ruecksprungkorrektur" to be done in "W fuer angepassten Abflusslaengschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
6 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
|
7 |
f165c7d5d6db
Implementation of the "Ruecksprungkorrektur" to be done in "W fuer angepassten Abflusslaengschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
8 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
|
9 |
f165c7d5d6db
Implementation of the "Ruecksprungkorrektur" to be done in "W fuer angepassten Abflusslaengschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
10 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
|
11 |
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 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
|
13 |
649
44175d4720f8
Fix crashes in back jump correction.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
642
diff
changeset
|
14 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
|
15 |
343
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.log4j.Logger; |
f165c7d5d6db
Implementation of the "Ruecksprungkorrektur" to be done in "W fuer angepassten Abflusslaengschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
17 |
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
|
18 import de.intevation.flys.artifacts.model.Calculation; |
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
|
19 |
1672
0b6dac664bbb
Moved some generic double array code from BackjumpCorrector to DoubleUtil
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
742
diff
changeset
|
20 import de.intevation.flys.utils.DoubleUtil; |
0b6dac664bbb
Moved some generic double array code from BackjumpCorrector to DoubleUtil
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
742
diff
changeset
|
21 |
343
f165c7d5d6db
Implementation of the "Ruecksprungkorrektur" to be done in "W fuer angepassten Abflusslaengschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
22 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
|
23 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
|
24 { |
f165c7d5d6db
Implementation of the "Ruecksprungkorrektur" to be done in "W fuer angepassten Abflusslaengschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
25 private static Logger log = Logger.getLogger(BackJumpCorrector.class); |
f165c7d5d6db
Implementation of the "Ruecksprungkorrektur" to be done in "W fuer angepassten Abflusslaengschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
26 |
f165c7d5d6db
Implementation of the "Ruecksprungkorrektur" to be done in "W fuer angepassten Abflusslaengschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
27 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
|
28 |
f165c7d5d6db
Implementation of the "Ruecksprungkorrektur" to be done in "W fuer angepassten Abflusslaengschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
29 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
|
30 |
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 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 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
|
33 } |
f165c7d5d6db
Implementation of the "Ruecksprungkorrektur" to be done in "W fuer angepassten Abflusslaengschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
34 |
f165c7d5d6db
Implementation of the "Ruecksprungkorrektur" to be done in "W fuer angepassten Abflusslaengschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
35 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
|
36 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
|
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 |
f165c7d5d6db
Implementation of the "Ruecksprungkorrektur" to be done in "W fuer angepassten Abflusslaengschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
39 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
|
40 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
|
41 } |
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 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
|
44 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
|
45 } |
f165c7d5d6db
Implementation of the "Ruecksprungkorrektur" to be done in "W fuer angepassten Abflusslaengschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
46 |
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
|
47 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
|
48 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
|
49 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
|
50 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
|
51 ) { |
1672
0b6dac664bbb
Moved some generic double array code from BackjumpCorrector to DoubleUtil
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
742
diff
changeset
|
52 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
|
53 |
2dbbb5be30a1
Re-eanbled the calculation of the backjump correction.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
406
diff
changeset
|
54 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
|
55 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
|
56 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
|
57 } |
663aa18bee7f
Back jump correction should work now for both flow directions.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
343
diff
changeset
|
58 |
1672
0b6dac664bbb
Moved some generic double array code from BackjumpCorrector to DoubleUtil
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
742
diff
changeset
|
59 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
|
60 |
2dbbb5be30a1
Re-eanbled the calculation of the backjump correction.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
406
diff
changeset
|
61 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
|
62 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
|
63 } |
2dbbb5be30a1
Re-eanbled the calculation of the backjump correction.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
406
diff
changeset
|
64 |
2dbbb5be30a1
Re-eanbled the calculation of the backjump correction.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
406
diff
changeset
|
65 if (log.isDebugEnabled()) { |
2dbbb5be30a1
Re-eanbled the calculation of the backjump correction.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
406
diff
changeset
|
66 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
|
67 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
|
68 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
|
69 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
|
70 } |
663aa18bee7f
Back jump correction should work now for both flow directions.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
343
diff
changeset
|
71 |
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
|
72 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
|
73 |
642
2dbbb5be30a1
Re-eanbled the calculation of the backjump correction.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
406
diff
changeset
|
74 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
|
75 // 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
|
76 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
|
77 } |
663aa18bee7f
Back jump correction should work now for both flow directions.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
343
diff
changeset
|
78 |
663aa18bee7f
Back jump correction should work now for both flow directions.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
343
diff
changeset
|
79 return hasBackJumps; |
663aa18bee7f
Back jump correction should work now for both flow directions.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
343
diff
changeset
|
80 } |
663aa18bee7f
Back jump correction should work now for both flow directions.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
343
diff
changeset
|
81 |
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
|
82 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
|
83 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
|
84 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
|
85 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
|
86 ) { |
343
f165c7d5d6db
Implementation of the "Ruecksprungkorrektur" to be done in "W fuer angepassten Abflusslaengschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
87 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
|
88 |
f165c7d5d6db
Implementation of the "Ruecksprungkorrektur" to be done in "W fuer angepassten Abflusslaengschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
89 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
|
90 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
|
91 } |
f165c7d5d6db
Implementation of the "Ruecksprungkorrektur" to be done in "W fuer angepassten Abflusslaengschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
92 |
f165c7d5d6db
Implementation of the "Ruecksprungkorrektur" to be done in "W fuer angepassten Abflusslaengschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
93 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
|
94 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
|
95 } |
f165c7d5d6db
Implementation of the "Ruecksprungkorrektur" to be done in "W fuer angepassten Abflusslaengschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
96 |
f165c7d5d6db
Implementation of the "Ruecksprungkorrektur" to be done in "W fuer angepassten Abflusslaengschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
97 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
|
98 |
f165c7d5d6db
Implementation of the "Ruecksprungkorrektur" to be done in "W fuer angepassten Abflusslaengschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
99 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
|
100 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
|
101 // 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
|
102 continue; |
f165c7d5d6db
Implementation of the "Ruecksprungkorrektur" to be done in "W fuer angepassten Abflusslaengschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
103 } |
f165c7d5d6db
Implementation of the "Ruecksprungkorrektur" to be done in "W fuer angepassten Abflusslaengschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
104 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
|
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 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
|
107 // 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
|
108 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
|
109 } |
f165c7d5d6db
Implementation of the "Ruecksprungkorrektur" to be done in "W fuer angepassten Abflusslaengschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
110 |
1674
b5209452f6bb
flys/issue31: Simplified the back jump correction code a lot.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1672
diff
changeset
|
111 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
|
112 |
1674
b5209452f6bb
flys/issue31: Simplified the back jump correction code a lot.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1672
diff
changeset
|
113 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
|
114 // 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
|
115 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
|
116 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
|
117 } |
f165c7d5d6db
Implementation of the "Ruecksprungkorrektur" to be done in "W fuer angepassten Abflusslaengschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
118 continue; |
f165c7d5d6db
Implementation of the "Ruecksprungkorrektur" to be done in "W fuer angepassten Abflusslaengschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
119 } |
f165c7d5d6db
Implementation of the "Ruecksprungkorrektur" to be done in "W fuer angepassten Abflusslaengschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
120 |
1674
b5209452f6bb
flys/issue31: Simplified the back jump correction code a lot.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1672
diff
changeset
|
121 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
|
122 |
343
f165c7d5d6db
Implementation of the "Ruecksprungkorrektur" to be done in "W fuer angepassten Abflusslaengschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
123 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
|
124 |
1674
b5209452f6bb
flys/issue31: Simplified the back jump correction code a lot.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1672
diff
changeset
|
125 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
|
126 |
1674
b5209452f6bb
flys/issue31: Simplified the back jump correction code a lot.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1672
diff
changeset
|
127 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
|
128 |
b5209452f6bb
flys/issue31: Simplified the back jump correction code a lot.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1672
diff
changeset
|
129 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
|
130 // 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
|
131 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
|
132 } |
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 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
|
135 |
1676
6e840e213fdf
Backjump correction: Finally looks fine.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1674
diff
changeset
|
136 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
|
137 |
1676
6e840e213fdf
Backjump correction: Finally looks fine.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1674
diff
changeset
|
138 double [] x = { start, above, between }; |
6e840e213fdf
Backjump correction: Finally looks fine.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1674
diff
changeset
|
139 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
|
140 |
642
2dbbb5be30a1
Re-eanbled the calculation of the backjump correction.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
406
diff
changeset
|
141 if (log.isDebugEnabled()) { |
2dbbb5be30a1
Re-eanbled the calculation of the backjump correction.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
406
diff
changeset
|
142 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
|
143 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
|
144 } |
2dbbb5be30a1
Re-eanbled the calculation of the backjump correction.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
406
diff
changeset
|
145 } |
2dbbb5be30a1
Re-eanbled the calculation of the backjump correction.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
406
diff
changeset
|
146 |
1674
b5209452f6bb
flys/issue31: Simplified the back jump correction code a lot.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1672
diff
changeset
|
147 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
|
148 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
|
149 } |
b5209452f6bb
flys/issue31: Simplified the back jump correction code a lot.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1672
diff
changeset
|
150 |
649
44175d4720f8
Fix crashes in back jump correction.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
642
diff
changeset
|
151 PolynomialSplineFunction spline; |
742
c09c9e05ecfa
Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
674
diff
changeset
|
152 |
649
44175d4720f8
Fix crashes in back jump correction.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
642
diff
changeset
|
153 try { |
44175d4720f8
Fix crashes in back jump correction.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
642
diff
changeset
|
154 spline = interpolator.interpolate(x, y); |
44175d4720f8
Fix crashes in back jump correction.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
642
diff
changeset
|
155 } |
44175d4720f8
Fix crashes in back jump correction.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
642
diff
changeset
|
156 catch (MathIllegalArgumentException miae) { |
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
|
157 // TODO: I18N |
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
|
158 errors.addProblem("creating spline interpolation failed."); |
649
44175d4720f8
Fix crashes in back jump correction.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
642
diff
changeset
|
159 log.error(miae); |
44175d4720f8
Fix crashes in back jump correction.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
642
diff
changeset
|
160 continue; |
44175d4720f8
Fix crashes in back jump correction.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
642
diff
changeset
|
161 } |
343
f165c7d5d6db
Implementation of the "Ruecksprungkorrektur" to be done in "W fuer angepassten Abflusslaengschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
162 |
f165c7d5d6db
Implementation of the "Ruecksprungkorrektur" to be done in "W fuer angepassten Abflusslaengschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
163 try { |
f165c7d5d6db
Implementation of the "Ruecksprungkorrektur" to be done in "W fuer angepassten Abflusslaengschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
164 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
|
165 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
|
166 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
|
167 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
|
168 } |
f165c7d5d6db
Implementation of the "Ruecksprungkorrektur" to be done in "W fuer angepassten Abflusslaengschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
169 } |
f165c7d5d6db
Implementation of the "Ruecksprungkorrektur" to be done in "W fuer angepassten Abflusslaengschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
170 |
1676
6e840e213fdf
Backjump correction: Finally looks fine.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1674
diff
changeset
|
171 int j = i-1; |
6e840e213fdf
Backjump correction: Finally looks fine.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1674
diff
changeset
|
172 |
6e840e213fdf
Backjump correction: Finally looks fine.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1674
diff
changeset
|
173 for (; j >= 0 && km[j] >= between; --j) { |
6e840e213fdf
Backjump correction: Finally looks fine.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1674
diff
changeset
|
174 ws[j] = ws[i]; |
6e840e213fdf
Backjump correction: Finally looks fine.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1674
diff
changeset
|
175 } |
6e840e213fdf
Backjump correction: Finally looks fine.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1674
diff
changeset
|
176 |
6e840e213fdf
Backjump correction: Finally looks fine.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1674
diff
changeset
|
177 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
|
178 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
|
179 } |
f165c7d5d6db
Implementation of the "Ruecksprungkorrektur" to be done in "W fuer angepassten Abflusslaengschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
180 } |
f165c7d5d6db
Implementation of the "Ruecksprungkorrektur" to be done in "W fuer angepassten Abflusslaengschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
181 catch (ArgumentOutsideDomainException aode) { |
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
|
182 // TODO: I18N |
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
|
183 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
|
184 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
|
185 } |
f165c7d5d6db
Implementation of the "Ruecksprungkorrektur" to be done in "W fuer angepassten Abflusslaengschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
186 } // 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
|
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 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
|
189 } |
1674
b5209452f6bb
flys/issue31: Simplified the back jump correction code a lot.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1672
diff
changeset
|
190 |
b5209452f6bb
flys/issue31: Simplified the back jump correction code a lot.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1672
diff
changeset
|
191 |
b5209452f6bb
flys/issue31: Simplified the back jump correction code a lot.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1672
diff
changeset
|
192 protected static double aboveWaterKM( |
b5209452f6bb
flys/issue31: Simplified the back jump correction code a lot.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1672
diff
changeset
|
193 double [] km, |
b5209452f6bb
flys/issue31: Simplified the back jump correction code a lot.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1672
diff
changeset
|
194 double [] ws, |
b5209452f6bb
flys/issue31: Simplified the back jump correction code a lot.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1672
diff
changeset
|
195 int wIndex |
b5209452f6bb
flys/issue31: Simplified the back jump correction code a lot.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1672
diff
changeset
|
196 ) { |
b5209452f6bb
flys/issue31: Simplified the back jump correction code a lot.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1672
diff
changeset
|
197 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
|
198 |
b5209452f6bb
flys/issue31: Simplified the back jump correction code a lot.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1672
diff
changeset
|
199 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
|
200 // 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
|
201 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
|
202 |
b5209452f6bb
flys/issue31: Simplified the back jump correction code a lot.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1672
diff
changeset
|
203 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
|
204 // 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
|
205 // 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
|
206 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
|
207 w, |
b5209452f6bb
flys/issue31: Simplified the back jump correction code a lot.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1672
diff
changeset
|
208 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
|
209 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
|
210 } |
b5209452f6bb
flys/issue31: Simplified the back jump correction code a lot.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1672
diff
changeset
|
211 else { |
b5209452f6bb
flys/issue31: Simplified the back jump correction code a lot.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1672
diff
changeset
|
212 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
|
213 } |
b5209452f6bb
flys/issue31: Simplified the back jump correction code a lot.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1672
diff
changeset
|
214 } |
b5209452f6bb
flys/issue31: Simplified the back jump correction code a lot.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1672
diff
changeset
|
215 |
b5209452f6bb
flys/issue31: Simplified the back jump correction code a lot.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1672
diff
changeset
|
216 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
|
217 } |
343
f165c7d5d6db
Implementation of the "Ruecksprungkorrektur" to be done in "W fuer angepassten Abflusslaengschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
218 } |
f165c7d5d6db
Implementation of the "Ruecksprungkorrektur" to be done in "W fuer angepassten Abflusslaengschnitt".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
219 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |