Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/WQCKms.java @ 5811:67e07c29dd29
ImportTimeInterval: Verbosity increased and fixed bug
in getPeer when stoptime is null.
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Wed, 24 Apr 2013 14:49:00 +0200 |
parents | bcf25d8c183e |
children |
rev | line source |
---|---|
402
eb22ffe4d74c
Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.artifacts.model; |
eb22ffe4d74c
Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
2 |
4821
bcf25d8c183e
Moved NaN removal code from W to DoubleUtil. Create QKms when calculating the 'Umhuellende'.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3076
diff
changeset
|
3 import de.intevation.flys.utils.DoubleUtil; |
bcf25d8c183e
Moved NaN removal code from W to DoubleUtil. Create QKms when calculating the 'Umhuellende'.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3076
diff
changeset
|
4 |
402
eb22ffe4d74c
Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
5 import gnu.trove.TDoubleArrayList; |
eb22ffe4d74c
Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
6 |
eb22ffe4d74c
Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
7 /** |
eb22ffe4d74c
Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
8 * This class represents a pool of data triples that consists of 'W', 'Q' and |
eb22ffe4d74c
Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
9 * 'KM' data with corrected 'W' values computed by a BackJumpCorrector. |
eb22ffe4d74c
Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
10 * |
eb22ffe4d74c
Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
11 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> |
eb22ffe4d74c
Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
12 */ |
3076
5642a83420f2
FLYS artifacts: Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2182
diff
changeset
|
13 public class WQCKms |
2182
5ff481ab24a1
Refactored class hierachy to integrate model for W~W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
719
diff
changeset
|
14 extends WQKms |
5ff481ab24a1
Refactored class hierachy to integrate model for W~W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
719
diff
changeset
|
15 { |
5ff481ab24a1
Refactored class hierachy to integrate model for W~W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
719
diff
changeset
|
16 protected TDoubleArrayList cws; |
402
eb22ffe4d74c
Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
17 |
655
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
402
diff
changeset
|
18 public WQCKms() { |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
402
diff
changeset
|
19 } |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
402
diff
changeset
|
20 |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
402
diff
changeset
|
21 public WQCKms(WQKms other, double [] cws) { |
2182
5ff481ab24a1
Refactored class hierachy to integrate model for W~W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
719
diff
changeset
|
22 this.ws = other.ws; |
5ff481ab24a1
Refactored class hierachy to integrate model for W~W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
719
diff
changeset
|
23 this.qs = other.qs; |
655
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
402
diff
changeset
|
24 this.kms = other.kms; |
2182
5ff481ab24a1
Refactored class hierachy to integrate model for W~W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
719
diff
changeset
|
25 this.cws = new TDoubleArrayList(cws); |
655
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
402
diff
changeset
|
26 } |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
402
diff
changeset
|
27 |
402
eb22ffe4d74c
Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
28 |
eb22ffe4d74c
Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
29 public WQCKms(double[] kms, double[] qs, double[] ws, double[] cws) { |
eb22ffe4d74c
Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
30 super(kms, qs, ws); |
eb22ffe4d74c
Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
31 |
2182
5ff481ab24a1
Refactored class hierachy to integrate model for W~W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
719
diff
changeset
|
32 this.cws = new TDoubleArrayList(cws); |
402
eb22ffe4d74c
Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
33 } |
eb22ffe4d74c
Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
34 |
686
3dc61e00385e
Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
655
diff
changeset
|
35 @Override |
3dc61e00385e
Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
655
diff
changeset
|
36 public void removeNaNs() { |
4821
bcf25d8c183e
Moved NaN removal code from W to DoubleUtil. Create QKms when calculating the 'Umhuellende'.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3076
diff
changeset
|
37 DoubleUtil.removeNaNs(new TDoubleArrayList [] { ws, qs, cws, kms }); |
686
3dc61e00385e
Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
655
diff
changeset
|
38 } |
3dc61e00385e
Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
655
diff
changeset
|
39 |
402
eb22ffe4d74c
Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
40 /** |
eb22ffe4d74c
Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
41 * Adds a new row to this data pool with corrected W. |
eb22ffe4d74c
Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
42 * |
eb22ffe4d74c
Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
43 * @param w a W. |
eb22ffe4d74c
Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
44 * @param q a Q. |
eb22ffe4d74c
Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
45 * @param kms a Kms. |
eb22ffe4d74c
Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
46 * @param cw The corrected W. |
eb22ffe4d74c
Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
47 */ |
eb22ffe4d74c
Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
48 public void add(double w, double q, double kms, double cw) { |
2182
5ff481ab24a1
Refactored class hierachy to integrate model for W~W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
719
diff
changeset
|
49 super.add(w, q, kms); |
5ff481ab24a1
Refactored class hierachy to integrate model for W~W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
719
diff
changeset
|
50 cws.add(cw); |
402
eb22ffe4d74c
Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
51 } |
eb22ffe4d74c
Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
52 |
2182
5ff481ab24a1
Refactored class hierachy to integrate model for W~W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
719
diff
changeset
|
53 @Override |
5ff481ab24a1
Refactored class hierachy to integrate model for W~W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
719
diff
changeset
|
54 public double[] get(int idx) { |
5ff481ab24a1
Refactored class hierachy to integrate model for W~W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
719
diff
changeset
|
55 return get(idx, new double[4]); |
5ff481ab24a1
Refactored class hierachy to integrate model for W~W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
719
diff
changeset
|
56 } |
402
eb22ffe4d74c
Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
57 |
eb22ffe4d74c
Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
58 /** |
eb22ffe4d74c
Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
59 * This method returns a 4dim array of W, Q,Kms and corrected W. |
eb22ffe4d74c
Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
60 * |
eb22ffe4d74c
Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
61 * @param idx The position of the triple. |
eb22ffe4d74c
Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
62 * @param dst destination array |
eb22ffe4d74c
Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
63 * |
eb22ffe4d74c
Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
64 * @return a 4dim array of [W, Q, Kms, CW] in dst. |
eb22ffe4d74c
Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
65 */ |
686
3dc61e00385e
Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
655
diff
changeset
|
66 @Override |
402
eb22ffe4d74c
Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
67 public double[] get(int idx, double[] dst) { |
eb22ffe4d74c
Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
68 dst = super.get(idx, dst); |
eb22ffe4d74c
Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
69 |
eb22ffe4d74c
Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
70 if (dst.length < 4) { |
eb22ffe4d74c
Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
71 return dst; |
eb22ffe4d74c
Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
72 } |
eb22ffe4d74c
Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
73 |
2182
5ff481ab24a1
Refactored class hierachy to integrate model for W~W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
719
diff
changeset
|
74 if (cws != null && cws.size() > idx) { |
5ff481ab24a1
Refactored class hierachy to integrate model for W~W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
719
diff
changeset
|
75 dst[3] = cws.getQuick(idx); |
402
eb22ffe4d74c
Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
76 } |
eb22ffe4d74c
Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
77 |
eb22ffe4d74c
Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
78 return dst; |
eb22ffe4d74c
Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
79 } |
eb22ffe4d74c
Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
80 |
719
035c0095b427
Draw correction curve again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
704
diff
changeset
|
81 public double getC(int idx) { |
2182
5ff481ab24a1
Refactored class hierachy to integrate model for W~W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
719
diff
changeset
|
82 return cws.getQuick(idx); |
719
035c0095b427
Draw correction curve again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
704
diff
changeset
|
83 } |
035c0095b427
Draw correction curve again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
704
diff
changeset
|
84 |
402
eb22ffe4d74c
Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
85 |
eb22ffe4d74c
Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
86 /** |
eb22ffe4d74c
Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
87 * Returns the double array of corrected W values. |
eb22ffe4d74c
Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
88 * |
eb22ffe4d74c
Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
89 * @return the double array of corrected W values. |
eb22ffe4d74c
Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
90 */ |
eb22ffe4d74c
Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
91 public double[] getCWs() { |
2182
5ff481ab24a1
Refactored class hierachy to integrate model for W~W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
719
diff
changeset
|
92 return cws.toNativeArray(); |
402
eb22ffe4d74c
Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
93 } |
eb22ffe4d74c
Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
94 } |
eb22ffe4d74c
Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
95 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |