Mercurial > dive4elements > river
annotate artifacts/src/main/java/org/dive4elements/river/artifacts/model/WQKms.java @ 8962:708f210ff242
Fetching year informations for waterlevels used in sinfo
author | gernotbelger |
---|---|
date | Wed, 28 Mar 2018 17:03:11 +0200 |
parents | 5e38e2924c07 |
children | 0a5239a1e46e |
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:
4821
diff
changeset
|
9 package org.dive4elements.river.artifacts.model; |
361
3e3ec9613883
Introduced a model class to store a set of triple data objects that consist of W, Q and Kms information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
10 |
7081
3c4efd4b2c19
Simplyfy / unify "invert axis" logic
Andre Heinecke <aheinecke@intevation.de>
parents:
6599
diff
changeset
|
11 import org.dive4elements.river.utils.DataUtil; |
5831
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4821
diff
changeset
|
12 import org.dive4elements.river.utils.DoubleUtil; |
4821
bcf25d8c183e
Moved NaN removal code from W to DoubleUtil. Create QKms when calculating the 'Umhuellende'.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4817
diff
changeset
|
13 |
365
c13ca9d632d6
Introduced GNU Trove to store WQKms values in a more performant data structure.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
361
diff
changeset
|
14 import gnu.trove.TDoubleArrayList; |
361
3e3ec9613883
Introduced a model class to store a set of triple data objects that consist of W, Q and Kms information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
15 |
402
eb22ffe4d74c
Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
380
diff
changeset
|
16 import org.apache.log4j.Logger; |
eb22ffe4d74c
Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
380
diff
changeset
|
17 |
361
3e3ec9613883
Introduced a model class to store a set of triple data objects that consist of W, Q and Kms information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
18 |
3e3ec9613883
Introduced a model class to store a set of triple data objects that consist of W, Q and Kms information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
19 /** |
3e3ec9613883
Introduced a model class to store a set of triple data objects that consist of W, Q and Kms information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
20 * This class represents a pool of data triples that consists of 'W', 'Q' and |
3e3ec9613883
Introduced a model class to store a set of triple data objects that consist of W, Q and Kms information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
21 * 'KM' data. |
3e3ec9613883
Introduced a model class to store a set of triple data objects that consist of W, Q and Kms information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
22 * |
3e3ec9613883
Introduced a model class to store a set of triple data objects that consist of W, Q and Kms information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
23 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> |
3e3ec9613883
Introduced a model class to store a set of triple data objects that consist of W, Q and Kms information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
24 */ |
742
c09c9e05ecfa
Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
726
diff
changeset
|
25 public class WQKms |
726
cbaa3ca86f2f
Added base class WQ for WQKms.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
719
diff
changeset
|
26 extends WQ |
4817
4d457c68b1d3
Added QKms model.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3269
diff
changeset
|
27 implements WKms, QKms |
726
cbaa3ca86f2f
Added base class WQ for WQKms.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
719
diff
changeset
|
28 { |
8202
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7645
diff
changeset
|
29 private static Logger log = Logger.getLogger(WQKms.class); |
402
eb22ffe4d74c
Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
380
diff
changeset
|
30 |
1029
3f3988bb6284
Picky Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
925
diff
changeset
|
31 /** The array that contains the 'KMs' values. */ |
365
c13ca9d632d6
Introduced GNU Trove to store WQKms values in a more performant data structure.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
361
diff
changeset
|
32 protected TDoubleArrayList kms; |
361
3e3ec9613883
Introduced a model class to store a set of triple data objects that consist of W, Q and Kms information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
33 |
3e3ec9613883
Introduced a model class to store a set of triple data objects that consist of W, Q and Kms information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
34 |
3e3ec9613883
Introduced a model class to store a set of triple data objects that consist of W, Q and Kms information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
35 public WQKms() { |
447
5606ba4139e0
WSTs will now have a header that contains the names of the Ws or Qs that had been defined for the computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
402
diff
changeset
|
36 this(""); |
5606ba4139e0
WSTs will now have a header that contains the names of the Ws or Qs that had been defined for the computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
402
diff
changeset
|
37 } |
5606ba4139e0
WSTs will now have a header that contains the names of the Ws or Qs that had been defined for the computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
402
diff
changeset
|
38 |
5606ba4139e0
WSTs will now have a header that contains the names of the Ws or Qs that had been defined for the computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
402
diff
changeset
|
39 |
5606ba4139e0
WSTs will now have a header that contains the names of the Ws or Qs that had been defined for the computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
402
diff
changeset
|
40 public WQKms(String name) { |
5606ba4139e0
WSTs will now have a header that contains the names of the Ws or Qs that had been defined for the computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
402
diff
changeset
|
41 super(name); |
365
c13ca9d632d6
Introduced GNU Trove to store WQKms values in a more performant data structure.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
361
diff
changeset
|
42 this.kms = new TDoubleArrayList(); |
361
3e3ec9613883
Introduced a model class to store a set of triple data objects that consist of W, Q and Kms information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
43 } |
3e3ec9613883
Introduced a model class to store a set of triple data objects that consist of W, Q and Kms information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
44 |
447
5606ba4139e0
WSTs will now have a header that contains the names of the Ws or Qs that had been defined for the computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
402
diff
changeset
|
45 |
380
5f55047a17e8
Moved expensive allocation of result arrays out of km loop.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
367
diff
changeset
|
46 public WQKms(int capacity) { |
447
5606ba4139e0
WSTs will now have a header that contains the names of the Ws or Qs that had been defined for the computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
402
diff
changeset
|
47 this(capacity, ""); |
5606ba4139e0
WSTs will now have a header that contains the names of the Ws or Qs that had been defined for the computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
402
diff
changeset
|
48 } |
5606ba4139e0
WSTs will now have a header that contains the names of the Ws or Qs that had been defined for the computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
402
diff
changeset
|
49 |
5606ba4139e0
WSTs will now have a header that contains the names of the Ws or Qs that had been defined for the computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
402
diff
changeset
|
50 |
5606ba4139e0
WSTs will now have a header that contains the names of the Ws or Qs that had been defined for the computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
402
diff
changeset
|
51 public WQKms(int capacity, String name) { |
2182
5ff481ab24a1
Refactored class hierachy to integrate model for W~W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1678
diff
changeset
|
52 super(capacity, name); |
380
5f55047a17e8
Moved expensive allocation of result arrays out of km loop.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
367
diff
changeset
|
53 this.kms = new TDoubleArrayList(capacity); |
5f55047a17e8
Moved expensive allocation of result arrays out of km loop.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
367
diff
changeset
|
54 } |
5f55047a17e8
Moved expensive allocation of result arrays out of km loop.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
367
diff
changeset
|
55 |
726
cbaa3ca86f2f
Added base class WQ for WQKms.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
719
diff
changeset
|
56 public WQKms(double [] kms, double [] qs, double [] ws) { |
447
5606ba4139e0
WSTs will now have a header that contains the names of the Ws or Qs that had been defined for the computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
402
diff
changeset
|
57 this(kms, qs, ws, ""); |
5606ba4139e0
WSTs will now have a header that contains the names of the Ws or Qs that had been defined for the computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
402
diff
changeset
|
58 } |
5606ba4139e0
WSTs will now have a header that contains the names of the Ws or Qs that had been defined for the computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
402
diff
changeset
|
59 |
6303
5fda7065b74a
Add another constructor that takes a WQ object as parameter
Andre Heinecke <aheinecke@intevation.de>
parents:
6301
diff
changeset
|
60 public WQKms(double []kms, WQ wq) { |
8362
839032ac1523
Purge obsolete representation of reference system for discharge tables.
Tom Gottfried <tom@intevation.de>
parents:
8202
diff
changeset
|
61 this(kms, wq.getQs(), wq.getWs(), wq.getName()); |
6303
5fda7065b74a
Add another constructor that takes a WQ object as parameter
Andre Heinecke <aheinecke@intevation.de>
parents:
6301
diff
changeset
|
62 } |
5fda7065b74a
Add another constructor that takes a WQ object as parameter
Andre Heinecke <aheinecke@intevation.de>
parents:
6301
diff
changeset
|
63 |
8856 | 64 public WQKms( |
65 TDoubleArrayList kms, | |
66 TDoubleArrayList qs, | |
67 TDoubleArrayList ws, | |
68 String name | |
69 ) { | |
7645
7e5d4a0d9bad
issue1020: Make WQKms able to build from WKms.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7081
diff
changeset
|
70 super(qs, ws, name); |
7e5d4a0d9bad
issue1020: Make WQKms able to build from WKms.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7081
diff
changeset
|
71 this.kms = kms; |
7e5d4a0d9bad
issue1020: Make WQKms able to build from WKms.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7081
diff
changeset
|
72 } |
7e5d4a0d9bad
issue1020: Make WQKms able to build from WKms.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7081
diff
changeset
|
73 |
8362
839032ac1523
Purge obsolete representation of reference system for discharge tables.
Tom Gottfried <tom@intevation.de>
parents:
8202
diff
changeset
|
74 public WQKms(double [] kms, double [] qs, double [] ws, String name) { |
726
cbaa3ca86f2f
Added base class WQ for WQKms.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
719
diff
changeset
|
75 super(qs, ws, name); |
402
eb22ffe4d74c
Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
380
diff
changeset
|
76 this.kms = new TDoubleArrayList(kms); |
eb22ffe4d74c
Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
380
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:
380
diff
changeset
|
78 |
7645
7e5d4a0d9bad
issue1020: Make WQKms able to build from WKms.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7081
diff
changeset
|
79 /** Create a WQKms from WKms, filling the Qs with given q. */ |
7e5d4a0d9bad
issue1020: Make WQKms able to build from WKms.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7081
diff
changeset
|
80 public static WQKms fromWKms(WKms wkms, double q) { |
7e5d4a0d9bad
issue1020: Make WQKms able to build from WKms.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7081
diff
changeset
|
81 TDoubleArrayList qs = new TDoubleArrayList(wkms.allKms().size()); |
7e5d4a0d9bad
issue1020: Make WQKms able to build from WKms.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7081
diff
changeset
|
82 qs.fill(q); |
8856 | 83 WQKms wqkms = |
84 new WQKms(wkms.allKms(), qs, wkms.allWs(), wkms.getName()); | |
7645
7e5d4a0d9bad
issue1020: Make WQKms able to build from WKms.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7081
diff
changeset
|
85 return wqkms; |
7e5d4a0d9bad
issue1020: Make WQKms able to build from WKms.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7081
diff
changeset
|
86 } |
7e5d4a0d9bad
issue1020: Make WQKms able to build from WKms.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7081
diff
changeset
|
87 |
726
cbaa3ca86f2f
Added base class WQ for WQKms.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
719
diff
changeset
|
88 @Override |
cbaa3ca86f2f
Added base class WQ for WQKms.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
719
diff
changeset
|
89 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:
4817
diff
changeset
|
90 DoubleUtil.removeNaNs(new TDoubleArrayList [] { ws, qs, kms }); |
726
cbaa3ca86f2f
Added base class WQ for WQKms.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
719
diff
changeset
|
91 } |
402
eb22ffe4d74c
Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
380
diff
changeset
|
92 |
361
3e3ec9613883
Introduced a model class to store a set of triple data objects that consist of W, Q and Kms information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
93 /** |
3e3ec9613883
Introduced a model class to store a set of triple data objects that consist of W, Q and Kms information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
94 * Adds a new row to this data pool. |
3e3ec9613883
Introduced a model class to store a set of triple data objects that consist of W, Q and Kms information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
95 * |
3e3ec9613883
Introduced a model class to store a set of triple data objects that consist of W, Q and Kms information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
96 * @param w a W. |
3e3ec9613883
Introduced a model class to store a set of triple data objects that consist of W, Q and Kms information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
97 * @param q a Q. |
3269
b2ea89a665bc
Fix issues in 'documentation'.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2182
diff
changeset
|
98 * @param km a kms. |
361
3e3ec9613883
Introduced a model class to store a set of triple data objects that consist of W, Q and Kms information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
99 */ |
726
cbaa3ca86f2f
Added base class WQ for WQKms.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
719
diff
changeset
|
100 public void add(double w, double q, double km) { |
cbaa3ca86f2f
Added base class WQ for WQKms.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
719
diff
changeset
|
101 super.add(w, q); |
cbaa3ca86f2f
Added base class WQ for WQKms.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
719
diff
changeset
|
102 kms.add(km); |
366
d64339f9f38f
WQKms model: Added a get() method which takes destination array as an argument.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
365
diff
changeset
|
103 } |
d64339f9f38f
WQKms model: Added a get() method which takes destination array as an argument.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
365
diff
changeset
|
104 |
2182
5ff481ab24a1
Refactored class hierachy to integrate model for W~W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1678
diff
changeset
|
105 @Override |
5ff481ab24a1
Refactored class hierachy to integrate model for W~W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1678
diff
changeset
|
106 public double [] get(int idx) { |
5ff481ab24a1
Refactored class hierachy to integrate model for W~W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1678
diff
changeset
|
107 return get(idx, new double [3]); |
5ff481ab24a1
Refactored class hierachy to integrate model for W~W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1678
diff
changeset
|
108 } |
5ff481ab24a1
Refactored class hierachy to integrate model for W~W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1678
diff
changeset
|
109 |
366
d64339f9f38f
WQKms model: Added a get() method which takes destination array as an argument.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
365
diff
changeset
|
110 /** |
d64339f9f38f
WQKms model: Added a get() method which takes destination array as an argument.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
365
diff
changeset
|
111 * This method returns a triple of W, Q and Kms in a single 3dim array. |
d64339f9f38f
WQKms model: Added a get() method which takes destination array as an argument.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
365
diff
changeset
|
112 * |
d64339f9f38f
WQKms model: Added a get() method which takes destination array as an argument.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
365
diff
changeset
|
113 * @param idx The position of the triple. |
d64339f9f38f
WQKms model: Added a get() method which takes destination array as an argument.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
365
diff
changeset
|
114 * @param dst destination array |
d64339f9f38f
WQKms model: Added a get() method which takes destination array as an argument.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
365
diff
changeset
|
115 * |
d64339f9f38f
WQKms model: Added a get() method which takes destination array as an argument.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
365
diff
changeset
|
116 * @return a triple of [W, Q, Kms] in dst. |
d64339f9f38f
WQKms model: Added a get() method which takes destination array as an argument.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
365
diff
changeset
|
117 */ |
726
cbaa3ca86f2f
Added base class WQ for WQKms.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
719
diff
changeset
|
118 @Override |
2182
5ff481ab24a1
Refactored class hierachy to integrate model for W~W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1678
diff
changeset
|
119 public double [] get(int idx, double [] dst) { |
5ff481ab24a1
Refactored class hierachy to integrate model for W~W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1678
diff
changeset
|
120 dst[0] = ws .getQuick(idx); |
5ff481ab24a1
Refactored class hierachy to integrate model for W~W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1678
diff
changeset
|
121 dst[1] = qs .getQuick(idx); |
686
3dc61e00385e
Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
447
diff
changeset
|
122 dst[2] = kms.getQuick(idx); |
366
d64339f9f38f
WQKms model: Added a get() method which takes destination array as an argument.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
365
diff
changeset
|
123 return dst; |
361
3e3ec9613883
Introduced a model class to store a set of triple data objects that consist of W, Q and Kms information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
124 } |
367
0960df8358ec
New method WQKms.size() to retrieve the number of elements in the data pool.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
366
diff
changeset
|
125 |
925
0cb1a70b8b92
Added the math needed to calculate "W-Differenzen" in "Laengsschnitten"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
742
diff
changeset
|
126 @Override |
0cb1a70b8b92
Added the math needed to calculate "W-Differenzen" in "Laengsschnitten"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
742
diff
changeset
|
127 public double getKm(int idx) { |
686
3dc61e00385e
Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
447
diff
changeset
|
128 return kms.getQuick(idx); |
367
0960df8358ec
New method WQKms.size() to retrieve the number of elements in the data pool.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
366
diff
changeset
|
129 } |
402
eb22ffe4d74c
Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
380
diff
changeset
|
130 |
1678
03fbf1b30e72
Removed code duplication of guessWaterIncreasing()
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1029
diff
changeset
|
131 @Override |
03fbf1b30e72
Removed code duplication of guessWaterIncreasing()
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1029
diff
changeset
|
132 public TDoubleArrayList allKms() { |
03fbf1b30e72
Removed code duplication of guessWaterIncreasing()
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1029
diff
changeset
|
133 return kms; |
03fbf1b30e72
Removed code duplication of guessWaterIncreasing()
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1029
diff
changeset
|
134 } |
03fbf1b30e72
Removed code duplication of guessWaterIncreasing()
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1029
diff
changeset
|
135 |
03fbf1b30e72
Removed code duplication of guessWaterIncreasing()
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1029
diff
changeset
|
136 @Override |
03fbf1b30e72
Removed code duplication of guessWaterIncreasing()
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1029
diff
changeset
|
137 public TDoubleArrayList allWs() { |
2182
5ff481ab24a1
Refactored class hierachy to integrate model for W~W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1678
diff
changeset
|
138 return ws; |
1678
03fbf1b30e72
Removed code duplication of guessWaterIncreasing()
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1029
diff
changeset
|
139 } |
03fbf1b30e72
Removed code duplication of guessWaterIncreasing()
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1029
diff
changeset
|
140 |
4817
4d457c68b1d3
Added QKms model.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3269
diff
changeset
|
141 @Override |
4d457c68b1d3
Added QKms model.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3269
diff
changeset
|
142 public TDoubleArrayList allQs() { |
4d457c68b1d3
Added QKms model.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3269
diff
changeset
|
143 return qs; |
4d457c68b1d3
Added QKms model.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3269
diff
changeset
|
144 } |
4d457c68b1d3
Added QKms model.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3269
diff
changeset
|
145 |
8549
1cff4c98df76
(issue1754) Extend WKms interface for KM filtering
Andre Heinecke <andre.heinecke@intevation.de>
parents:
8421
diff
changeset
|
146 @Override |
1cff4c98df76
(issue1754) Extend WKms interface for KM filtering
Andre Heinecke <andre.heinecke@intevation.de>
parents:
8421
diff
changeset
|
147 public WKms filteredKms(double from, double to) { |
1cff4c98df76
(issue1754) Extend WKms interface for KM filtering
Andre Heinecke <andre.heinecke@intevation.de>
parents:
8421
diff
changeset
|
148 WQKms retval = new WQKms(getName()); |
8651
81a8e3043794
Improve coding style in KMFilter loops
Andre Heinecke <andre.heinecke@intevation.de>
parents:
8549
diff
changeset
|
149 for (int i = 0, S = size(); i < S; i++) { |
81a8e3043794
Improve coding style in KMFilter loops
Andre Heinecke <andre.heinecke@intevation.de>
parents:
8549
diff
changeset
|
150 double km = getKm(i); |
8549
1cff4c98df76
(issue1754) Extend WKms interface for KM filtering
Andre Heinecke <andre.heinecke@intevation.de>
parents:
8421
diff
changeset
|
151 if (km >= from && km <= to) { |
8651
81a8e3043794
Improve coding style in KMFilter loops
Andre Heinecke <andre.heinecke@intevation.de>
parents:
8549
diff
changeset
|
152 retval.add(getW(i), getQ(i), km); |
8549
1cff4c98df76
(issue1754) Extend WKms interface for KM filtering
Andre Heinecke <andre.heinecke@intevation.de>
parents:
8421
diff
changeset
|
153 } |
1cff4c98df76
(issue1754) Extend WKms interface for KM filtering
Andre Heinecke <andre.heinecke@intevation.de>
parents:
8421
diff
changeset
|
154 } |
1cff4c98df76
(issue1754) Extend WKms interface for KM filtering
Andre Heinecke <andre.heinecke@intevation.de>
parents:
8421
diff
changeset
|
155 return retval; |
1cff4c98df76
(issue1754) Extend WKms interface for KM filtering
Andre Heinecke <andre.heinecke@intevation.de>
parents:
8421
diff
changeset
|
156 } |
1cff4c98df76
(issue1754) Extend WKms interface for KM filtering
Andre Heinecke <andre.heinecke@intevation.de>
parents:
8421
diff
changeset
|
157 |
402
eb22ffe4d74c
Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
380
diff
changeset
|
158 public double[] getKms() { |
eb22ffe4d74c
Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
380
diff
changeset
|
159 return kms.toNativeArray(); |
eb22ffe4d74c
Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
380
diff
changeset
|
160 } |
eb22ffe4d74c
Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
380
diff
changeset
|
161 |
eb22ffe4d74c
Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
380
diff
changeset
|
162 /** |
eb22ffe4d74c
Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
380
diff
changeset
|
163 * Returns a string that consist of the first and last kilometer. |
eb22ffe4d74c
Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
380
diff
changeset
|
164 * |
eb22ffe4d74c
Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
380
diff
changeset
|
165 * @return a string that consist of the first and last kilometer. |
eb22ffe4d74c
Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
380
diff
changeset
|
166 */ |
eb22ffe4d74c
Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
380
diff
changeset
|
167 public String toString() { |
925
0cb1a70b8b92
Added the math needed to calculate "W-Differenzen" in "Laengsschnitten"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
742
diff
changeset
|
168 double from = getKm(0); |
0cb1a70b8b92
Added the math needed to calculate "W-Differenzen" in "Laengsschnitten"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
742
diff
changeset
|
169 double to = getKm(size()-1); |
686
3dc61e00385e
Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
447
diff
changeset
|
170 return from + " - " + to; |
402
eb22ffe4d74c
Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
380
diff
changeset
|
171 } |
6599
38ee580a30cb
Add getFirstLastKM utiltity function to WQKms
Andre Heinecke <aheinecke@intevation.de>
parents:
6303
diff
changeset
|
172 |
38ee580a30cb
Add getFirstLastKM utiltity function to WQKms
Andre Heinecke <aheinecke@intevation.de>
parents:
6303
diff
changeset
|
173 /** |
38ee580a30cb
Add getFirstLastKM utiltity function to WQKms
Andre Heinecke <aheinecke@intevation.de>
parents:
6303
diff
changeset
|
174 * Returns an array of two double values the first and last kilometer. |
38ee580a30cb
Add getFirstLastKM utiltity function to WQKms
Andre Heinecke <aheinecke@intevation.de>
parents:
6303
diff
changeset
|
175 * |
38ee580a30cb
Add getFirstLastKM utiltity function to WQKms
Andre Heinecke <aheinecke@intevation.de>
parents:
6303
diff
changeset
|
176 * @return a double array with the first and last km |
38ee580a30cb
Add getFirstLastKM utiltity function to WQKms
Andre Heinecke <aheinecke@intevation.de>
parents:
6303
diff
changeset
|
177 */ |
38ee580a30cb
Add getFirstLastKM utiltity function to WQKms
Andre Heinecke <aheinecke@intevation.de>
parents:
6303
diff
changeset
|
178 public double[] getFirstLastKM() { |
38ee580a30cb
Add getFirstLastKM utiltity function to WQKms
Andre Heinecke <aheinecke@intevation.de>
parents:
6303
diff
changeset
|
179 /* Behold the first km might be larger then the last! */ |
38ee580a30cb
Add getFirstLastKM utiltity function to WQKms
Andre Heinecke <aheinecke@intevation.de>
parents:
6303
diff
changeset
|
180 return new double[] {getKm(0), getKm(size()-1)}; |
38ee580a30cb
Add getFirstLastKM utiltity function to WQKms
Andre Heinecke <aheinecke@intevation.de>
parents:
6303
diff
changeset
|
181 } |
7081
3c4efd4b2c19
Simplyfy / unify "invert axis" logic
Andre Heinecke <aheinecke@intevation.de>
parents:
6599
diff
changeset
|
182 |
8421
0fa963038c61
Only draw discharge curve if on same station as navigation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8362
diff
changeset
|
183 private static final double EPS = 1e-5; |
0fa963038c61
Only draw discharge curve if on same station as navigation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8362
diff
changeset
|
184 |
0fa963038c61
Only draw discharge curve if on same station as navigation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8362
diff
changeset
|
185 public Double sameKm() { |
0fa963038c61
Only draw discharge curve if on same station as navigation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8362
diff
changeset
|
186 int s = size(); |
0fa963038c61
Only draw discharge curve if on same station as navigation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8362
diff
changeset
|
187 if (s < 1) return null; |
0fa963038c61
Only draw discharge curve if on same station as navigation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8362
diff
changeset
|
188 if (s == 1) return getKm(0); |
0fa963038c61
Only draw discharge curve if on same station as navigation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8362
diff
changeset
|
189 double a = getKm(0); |
0fa963038c61
Only draw discharge curve if on same station as navigation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8362
diff
changeset
|
190 double b = getKm(s-1); |
0fa963038c61
Only draw discharge curve if on same station as navigation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8362
diff
changeset
|
191 double c = getKm(s/2); |
0fa963038c61
Only draw discharge curve if on same station as navigation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8362
diff
changeset
|
192 |
8856 | 193 return Math.abs(a-b) > EPS |
194 || Math.abs(a-c) > EPS | |
195 || Math.abs(b-c) > EPS | |
8421
0fa963038c61
Only draw discharge curve if on same station as navigation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8362
diff
changeset
|
196 ? null |
0fa963038c61
Only draw discharge curve if on same station as navigation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8362
diff
changeset
|
197 : a; |
0fa963038c61
Only draw discharge curve if on same station as navigation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8362
diff
changeset
|
198 } |
0fa963038c61
Only draw discharge curve if on same station as navigation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8362
diff
changeset
|
199 |
7081
3c4efd4b2c19
Simplyfy / unify "invert axis" logic
Andre Heinecke <aheinecke@intevation.de>
parents:
6599
diff
changeset
|
200 @Override |
3c4efd4b2c19
Simplyfy / unify "invert axis" logic
Andre Heinecke <aheinecke@intevation.de>
parents:
6599
diff
changeset
|
201 public boolean guessRTLData() { |
3c4efd4b2c19
Simplyfy / unify "invert axis" logic
Andre Heinecke <aheinecke@intevation.de>
parents:
6599
diff
changeset
|
202 return DataUtil.guessSameDirectionData(ws, allKms()); |
3c4efd4b2c19
Simplyfy / unify "invert axis" logic
Andre Heinecke <aheinecke@intevation.de>
parents:
6599
diff
changeset
|
203 } |
361
3e3ec9613883
Introduced a model class to store a set of triple data objects that consist of W, Q and Kms information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
204 } |
3e3ec9613883
Introduced a model class to store a set of triple data objects that consist of W, Q and Kms information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
205 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |