Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/DischargeTables.java @ 2671:055315495f8d
Modified floodmap specific datacage configuration and improved WMS catchment layer.
flys-artifacts/trunk@4359 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Tue, 08 May 2012 12:14:55 +0000 |
parents | 899ca89f497e |
children | 02254d763bc0 |
rev | line source |
---|---|
146
e8dfe6ba2000
Fetch w/q values of discharge tables for given gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.artifacts.model; |
e8dfe6ba2000
Fetch w/q values of discharge tables for given gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
2 |
e8dfe6ba2000
Fetch w/q values of discharge tables for given gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
3 import java.util.List; |
e8dfe6ba2000
Fetch w/q values of discharge tables for given gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
4 import java.util.Map; |
e8dfe6ba2000
Fetch w/q values of discharge tables for given gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
5 import java.util.HashMap; |
e8dfe6ba2000
Fetch w/q values of discharge tables for given gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
6 import java.util.Arrays; |
e8dfe6ba2000
Fetch w/q values of discharge tables for given gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
7 |
e8dfe6ba2000
Fetch w/q values of discharge tables for given gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
8 import java.io.Serializable; |
e8dfe6ba2000
Fetch w/q values of discharge tables for given gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
9 |
e8dfe6ba2000
Fetch w/q values of discharge tables for given gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
10 import org.hibernate.Session; |
e8dfe6ba2000
Fetch w/q values of discharge tables for given gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
11 import org.hibernate.Query; |
e8dfe6ba2000
Fetch w/q values of discharge tables for given gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
12 |
e8dfe6ba2000
Fetch w/q values of discharge tables for given gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
13 import org.apache.log4j.Logger; |
e8dfe6ba2000
Fetch w/q values of discharge tables for given gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
14 |
315
94c176fdcb89
Removed the SessionHolder and adapted imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
311
diff
changeset
|
15 import de.intevation.flys.backend.SessionHolder; |
146
e8dfe6ba2000
Fetch w/q values of discharge tables for given gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
16 import de.intevation.flys.model.Gauge; |
e8dfe6ba2000
Fetch w/q values of discharge tables for given gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
17 import de.intevation.flys.model.DischargeTable; |
e8dfe6ba2000
Fetch w/q values of discharge tables for given gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
18 import de.intevation.flys.model.DischargeTableValue; |
e8dfe6ba2000
Fetch w/q values of discharge tables for given gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
19 |
2418
899ca89f497e
Another partial fix for flys/issue499: Do the W to Q conversions
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2230
diff
changeset
|
20 import gnu.trove.TDoubleArrayList; |
899ca89f497e
Another partial fix for flys/issue499: Do the W to Q conversions
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2230
diff
changeset
|
21 |
146
e8dfe6ba2000
Fetch w/q values of discharge tables for given gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
22 public class DischargeTables |
e8dfe6ba2000
Fetch w/q values of discharge tables for given gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
23 implements Serializable |
e8dfe6ba2000
Fetch w/q values of discharge tables for given gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
24 { |
329
0b2358bc716d
Discharge table: Added static method getWForQ() to interpolate a w value for a given q value based on a given discharge table.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
328
diff
changeset
|
25 private static Logger log = Logger.getLogger(DischargeTables.class); |
0b2358bc716d
Discharge table: Added static method getWForQ() to interpolate a w value for a given q value based on a given discharge table.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
328
diff
changeset
|
26 |
328
07e642030172
Discharge tables: Added convenience constructors/methods to ease the access to the master discharge table of a gauge.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
315
diff
changeset
|
27 public static final double DEFAULT_SCALE = 100.0; |
07e642030172
Discharge tables: Added convenience constructors/methods to ease the access to the master discharge table of a gauge.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
315
diff
changeset
|
28 |
07e642030172
Discharge tables: Added convenience constructors/methods to ease the access to the master discharge table of a gauge.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
315
diff
changeset
|
29 public static final int MASTER = 0; |
07e642030172
Discharge tables: Added convenience constructors/methods to ease the access to the master discharge table of a gauge.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
315
diff
changeset
|
30 |
146
e8dfe6ba2000
Fetch w/q values of discharge tables for given gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
31 protected List<String> gaugeNames; |
e8dfe6ba2000
Fetch w/q values of discharge tables for given gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
32 |
e8dfe6ba2000
Fetch w/q values of discharge tables for given gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
33 protected String riverName; |
e8dfe6ba2000
Fetch w/q values of discharge tables for given gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
34 |
154
03362976fa0f
DischargeTables: Cache the scale, too. Otherwise two calls to getValues() with different arguments will result in the same output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
153
diff
changeset
|
35 protected double scale; |
03362976fa0f
DischargeTables: Cache the scale, too. Otherwise two calls to getValues() with different arguments will result in the same output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
153
diff
changeset
|
36 |
328
07e642030172
Discharge tables: Added convenience constructors/methods to ease the access to the master discharge table of a gauge.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
315
diff
changeset
|
37 protected int kind; |
07e642030172
Discharge tables: Added convenience constructors/methods to ease the access to the master discharge table of a gauge.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
315
diff
changeset
|
38 |
150
c904d52cdfd0
Don't used interleaved x/y data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
146
diff
changeset
|
39 protected Map<String, double [][]> values; |
146
e8dfe6ba2000
Fetch w/q values of discharge tables for given gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
40 |
e8dfe6ba2000
Fetch w/q values of discharge tables for given gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
41 public DischargeTables() { |
e8dfe6ba2000
Fetch w/q values of discharge tables for given gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
42 } |
e8dfe6ba2000
Fetch w/q values of discharge tables for given gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
43 |
328
07e642030172
Discharge tables: Added convenience constructors/methods to ease the access to the master discharge table of a gauge.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
315
diff
changeset
|
44 public DischargeTables(String riverName, String gaugeName) { |
07e642030172
Discharge tables: Added convenience constructors/methods to ease the access to the master discharge table of a gauge.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
315
diff
changeset
|
45 this(riverName, gaugeName, MASTER); |
146
e8dfe6ba2000
Fetch w/q values of discharge tables for given gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
46 } |
e8dfe6ba2000
Fetch w/q values of discharge tables for given gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
47 |
328
07e642030172
Discharge tables: Added convenience constructors/methods to ease the access to the master discharge table of a gauge.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
315
diff
changeset
|
48 public DischargeTables(String riverName, String gaugeName, int kind) { |
07e642030172
Discharge tables: Added convenience constructors/methods to ease the access to the master discharge table of a gauge.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
315
diff
changeset
|
49 this(riverName, new String [] { gaugeName }, kind); |
07e642030172
Discharge tables: Added convenience constructors/methods to ease the access to the master discharge table of a gauge.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
315
diff
changeset
|
50 } |
07e642030172
Discharge tables: Added convenience constructors/methods to ease the access to the master discharge table of a gauge.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
315
diff
changeset
|
51 |
07e642030172
Discharge tables: Added convenience constructors/methods to ease the access to the master discharge table of a gauge.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
315
diff
changeset
|
52 public DischargeTables(String riverName, String [] gaugeNames) { |
07e642030172
Discharge tables: Added convenience constructors/methods to ease the access to the master discharge table of a gauge.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
315
diff
changeset
|
53 this(riverName, gaugeNames, MASTER); |
07e642030172
Discharge tables: Added convenience constructors/methods to ease the access to the master discharge table of a gauge.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
315
diff
changeset
|
54 } |
07e642030172
Discharge tables: Added convenience constructors/methods to ease the access to the master discharge table of a gauge.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
315
diff
changeset
|
55 |
07e642030172
Discharge tables: Added convenience constructors/methods to ease the access to the master discharge table of a gauge.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
315
diff
changeset
|
56 public DischargeTables(String riverName, String [] gaugeNames, int kind) { |
07e642030172
Discharge tables: Added convenience constructors/methods to ease the access to the master discharge table of a gauge.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
315
diff
changeset
|
57 this(riverName, Arrays.asList(gaugeNames), kind); |
07e642030172
Discharge tables: Added convenience constructors/methods to ease the access to the master discharge table of a gauge.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
315
diff
changeset
|
58 } |
07e642030172
Discharge tables: Added convenience constructors/methods to ease the access to the master discharge table of a gauge.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
315
diff
changeset
|
59 |
07e642030172
Discharge tables: Added convenience constructors/methods to ease the access to the master discharge table of a gauge.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
315
diff
changeset
|
60 public DischargeTables( |
07e642030172
Discharge tables: Added convenience constructors/methods to ease the access to the master discharge table of a gauge.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
315
diff
changeset
|
61 String riverName, |
07e642030172
Discharge tables: Added convenience constructors/methods to ease the access to the master discharge table of a gauge.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
315
diff
changeset
|
62 List<String> gaugeNames, |
07e642030172
Discharge tables: Added convenience constructors/methods to ease the access to the master discharge table of a gauge.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
315
diff
changeset
|
63 int kind |
07e642030172
Discharge tables: Added convenience constructors/methods to ease the access to the master discharge table of a gauge.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
315
diff
changeset
|
64 ) { |
154
03362976fa0f
DischargeTables: Cache the scale, too. Otherwise two calls to getValues() with different arguments will result in the same output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
153
diff
changeset
|
65 scale = Double.NaN; |
328
07e642030172
Discharge tables: Added convenience constructors/methods to ease the access to the master discharge table of a gauge.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
315
diff
changeset
|
66 this.kind = kind; |
146
e8dfe6ba2000
Fetch w/q values of discharge tables for given gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
67 this.riverName = riverName; |
e8dfe6ba2000
Fetch w/q values of discharge tables for given gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
68 this.gaugeNames = gaugeNames; |
e8dfe6ba2000
Fetch w/q values of discharge tables for given gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
69 } |
e8dfe6ba2000
Fetch w/q values of discharge tables for given gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
70 |
328
07e642030172
Discharge tables: Added convenience constructors/methods to ease the access to the master discharge table of a gauge.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
315
diff
changeset
|
71 public double [][] getFirstTable() { |
07e642030172
Discharge tables: Added convenience constructors/methods to ease the access to the master discharge table of a gauge.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
315
diff
changeset
|
72 return getFirstTable(DEFAULT_SCALE); |
07e642030172
Discharge tables: Added convenience constructors/methods to ease the access to the master discharge table of a gauge.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
315
diff
changeset
|
73 } |
07e642030172
Discharge tables: Added convenience constructors/methods to ease the access to the master discharge table of a gauge.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
315
diff
changeset
|
74 |
07e642030172
Discharge tables: Added convenience constructors/methods to ease the access to the master discharge table of a gauge.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
315
diff
changeset
|
75 public double [][] getFirstTable(double scale) { |
07e642030172
Discharge tables: Added convenience constructors/methods to ease the access to the master discharge table of a gauge.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
315
diff
changeset
|
76 Map<String, double [][]> values = getValues(scale); |
07e642030172
Discharge tables: Added convenience constructors/methods to ease the access to the master discharge table of a gauge.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
315
diff
changeset
|
77 for (double [][] table: values.values()) { |
07e642030172
Discharge tables: Added convenience constructors/methods to ease the access to the master discharge table of a gauge.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
315
diff
changeset
|
78 return table; |
07e642030172
Discharge tables: Added convenience constructors/methods to ease the access to the master discharge table of a gauge.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
315
diff
changeset
|
79 } |
07e642030172
Discharge tables: Added convenience constructors/methods to ease the access to the master discharge table of a gauge.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
315
diff
changeset
|
80 return null; |
07e642030172
Discharge tables: Added convenience constructors/methods to ease the access to the master discharge table of a gauge.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
315
diff
changeset
|
81 } |
07e642030172
Discharge tables: Added convenience constructors/methods to ease the access to the master discharge table of a gauge.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
315
diff
changeset
|
82 |
07e642030172
Discharge tables: Added convenience constructors/methods to ease the access to the master discharge table of a gauge.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
315
diff
changeset
|
83 public Map<String, double [][]> getValues() { |
07e642030172
Discharge tables: Added convenience constructors/methods to ease the access to the master discharge table of a gauge.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
315
diff
changeset
|
84 return getValues(DEFAULT_SCALE); |
07e642030172
Discharge tables: Added convenience constructors/methods to ease the access to the master discharge table of a gauge.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
315
diff
changeset
|
85 } |
07e642030172
Discharge tables: Added convenience constructors/methods to ease the access to the master discharge table of a gauge.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
315
diff
changeset
|
86 |
153
c97f9bc9b642
The out() operation of the WINFO artifact draws discharge tables for gauges specified by the user.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
150
diff
changeset
|
87 public Map<String, double [][]> getValues(double scale) { |
154
03362976fa0f
DischargeTables: Cache the scale, too. Otherwise two calls to getValues() with different arguments will result in the same output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
153
diff
changeset
|
88 if (values == null || scale != this.scale) { |
153
c97f9bc9b642
The out() operation of the WINFO artifact draws discharge tables for gauges specified by the user.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
150
diff
changeset
|
89 values = loadValues(scale); |
154
03362976fa0f
DischargeTables: Cache the scale, too. Otherwise two calls to getValues() with different arguments will result in the same output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
153
diff
changeset
|
90 this.scale = scale; |
146
e8dfe6ba2000
Fetch w/q values of discharge tables for given gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
91 } |
e8dfe6ba2000
Fetch w/q values of discharge tables for given gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
92 return values; |
e8dfe6ba2000
Fetch w/q values of discharge tables for given gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
93 } |
e8dfe6ba2000
Fetch w/q values of discharge tables for given gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
94 |
1929
6b0ae0f2cae6
(Minor) cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
735
diff
changeset
|
95 /** |
6b0ae0f2cae6
(Minor) cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
735
diff
changeset
|
96 * Returns mapping of gauge name to values. |
6b0ae0f2cae6
(Minor) cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
735
diff
changeset
|
97 */ |
153
c97f9bc9b642
The out() operation of the WINFO artifact draws discharge tables for gauges specified by the user.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
150
diff
changeset
|
98 protected Map<String, double [][]> loadValues(double scale) { |
150
c904d52cdfd0
Don't used interleaved x/y data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
146
diff
changeset
|
99 Map<String, double [][]> values = new HashMap<String, double [][]>(); |
146
e8dfe6ba2000
Fetch w/q values of discharge tables for given gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
100 |
311
ea3a438a7021
Backend access: Static methods are using the SessionHolder, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
154
diff
changeset
|
101 Session session = SessionHolder.HOLDER.get(); |
146
e8dfe6ba2000
Fetch w/q values of discharge tables for given gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
102 |
311
ea3a438a7021
Backend access: Static methods are using the SessionHolder, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
154
diff
changeset
|
103 Query gaugeQuery = session.createQuery( |
336
7f13ed751277
Fixed broken HQL statement.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
334
diff
changeset
|
104 "from Gauge where name=:gauge and river.name=:river"); |
311
ea3a438a7021
Backend access: Static methods are using the SessionHolder, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
154
diff
changeset
|
105 gaugeQuery.setParameter("river", riverName); |
146
e8dfe6ba2000
Fetch w/q values of discharge tables for given gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
106 |
311
ea3a438a7021
Backend access: Static methods are using the SessionHolder, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
154
diff
changeset
|
107 for (String gaugeName: gaugeNames) { |
ea3a438a7021
Backend access: Static methods are using the SessionHolder, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
154
diff
changeset
|
108 gaugeQuery.setParameter("gauge", gaugeName); |
ea3a438a7021
Backend access: Static methods are using the SessionHolder, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
154
diff
changeset
|
109 List<Gauge> gauges = gaugeQuery.list(); |
ea3a438a7021
Backend access: Static methods are using the SessionHolder, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
154
diff
changeset
|
110 if (gauges.isEmpty()) { |
ea3a438a7021
Backend access: Static methods are using the SessionHolder, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
154
diff
changeset
|
111 log.warn( |
ea3a438a7021
Backend access: Static methods are using the SessionHolder, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
154
diff
changeset
|
112 "no gauge '"+gaugeName+"' at river '"+riverName+"'"); |
ea3a438a7021
Backend access: Static methods are using the SessionHolder, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
154
diff
changeset
|
113 continue; |
ea3a438a7021
Backend access: Static methods are using the SessionHolder, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
154
diff
changeset
|
114 } |
ea3a438a7021
Backend access: Static methods are using the SessionHolder, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
154
diff
changeset
|
115 Gauge gauge = gauges.get(0); |
146
e8dfe6ba2000
Fetch w/q values of discharge tables for given gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
116 |
311
ea3a438a7021
Backend access: Static methods are using the SessionHolder, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
154
diff
changeset
|
117 List<DischargeTable> tables = gauge.getDischargeTables(); |
146
e8dfe6ba2000
Fetch w/q values of discharge tables for given gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
118 |
311
ea3a438a7021
Backend access: Static methods are using the SessionHolder, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
154
diff
changeset
|
119 if (tables.isEmpty()) { |
ea3a438a7021
Backend access: Static methods are using the SessionHolder, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
154
diff
changeset
|
120 log.warn( |
ea3a438a7021
Backend access: Static methods are using the SessionHolder, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
154
diff
changeset
|
121 "no discharge table for gauge '" + gaugeName + "'"); |
ea3a438a7021
Backend access: Static methods are using the SessionHolder, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
154
diff
changeset
|
122 continue; |
146
e8dfe6ba2000
Fetch w/q values of discharge tables for given gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
123 } |
e8dfe6ba2000
Fetch w/q values of discharge tables for given gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
124 |
311
ea3a438a7021
Backend access: Static methods are using the SessionHolder, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
154
diff
changeset
|
125 // TODO: Filter by time interval |
ea3a438a7021
Backend access: Static methods are using the SessionHolder, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
154
diff
changeset
|
126 DischargeTable table = tables.get(0); |
ea3a438a7021
Backend access: Static methods are using the SessionHolder, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
154
diff
changeset
|
127 |
2418
899ca89f497e
Another partial fix for flys/issue499: Do the W to Q conversions
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2230
diff
changeset
|
128 double [][] vs = loadDischargeTableValues(table, scale); |
329
0b2358bc716d
Discharge table: Added static method getWForQ() to interpolate a w value for a given q value based on a given discharge table.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
328
diff
changeset
|
129 |
2418
899ca89f497e
Another partial fix for flys/issue499: Do the W to Q conversions
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2230
diff
changeset
|
130 values.put(gaugeName, vs); |
146
e8dfe6ba2000
Fetch w/q values of discharge tables for given gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
131 } |
311
ea3a438a7021
Backend access: Static methods are using the SessionHolder, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
154
diff
changeset
|
132 |
ea3a438a7021
Backend access: Static methods are using the SessionHolder, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
154
diff
changeset
|
133 return values; |
146
e8dfe6ba2000
Fetch w/q values of discharge tables for given gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
134 } |
329
0b2358bc716d
Discharge table: Added static method getWForQ() to interpolate a w value for a given q value based on a given discharge table.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
328
diff
changeset
|
135 |
2230
59af81364eb1
Improved the 'historical discharge' calculation: implemented findValueForW().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1929
diff
changeset
|
136 |
59af81364eb1
Improved the 'historical discharge' calculation: implemented findValueForW().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1929
diff
changeset
|
137 /** |
59af81364eb1
Improved the 'historical discharge' calculation: implemented findValueForW().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1929
diff
changeset
|
138 * @param table The discharge table |
59af81364eb1
Improved the 'historical discharge' calculation: implemented findValueForW().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1929
diff
changeset
|
139 * @param scale The scale factor to adjust W and Q values. |
59af81364eb1
Improved the 'historical discharge' calculation: implemented findValueForW().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1929
diff
changeset
|
140 * @param qSorted Boolean flag that is used to evaluate if the values should |
59af81364eb1
Improved the 'historical discharge' calculation: implemented findValueForW().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1929
diff
changeset
|
141 * be sorted. |
59af81364eb1
Improved the 'historical discharge' calculation: implemented findValueForW().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1929
diff
changeset
|
142 * |
59af81364eb1
Improved the 'historical discharge' calculation: implemented findValueForW().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1929
diff
changeset
|
143 * @return the values of a discharge table. |
59af81364eb1
Improved the 'historical discharge' calculation: implemented findValueForW().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1929
diff
changeset
|
144 */ |
59af81364eb1
Improved the 'historical discharge' calculation: implemented findValueForW().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1929
diff
changeset
|
145 public static double[][] loadDischargeTableValues( |
59af81364eb1
Improved the 'historical discharge' calculation: implemented findValueForW().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1929
diff
changeset
|
146 DischargeTable table, |
2418
899ca89f497e
Another partial fix for flys/issue499: Do the W to Q conversions
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2230
diff
changeset
|
147 double scale |
2230
59af81364eb1
Improved the 'historical discharge' calculation: implemented findValueForW().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1929
diff
changeset
|
148 ) { |
59af81364eb1
Improved the 'historical discharge' calculation: implemented findValueForW().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1929
diff
changeset
|
149 List<DischargeTableValue> dtvs = table.getDischargeTableValues(); |
59af81364eb1
Improved the 'historical discharge' calculation: implemented findValueForW().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1929
diff
changeset
|
150 |
59af81364eb1
Improved the 'historical discharge' calculation: implemented findValueForW().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1929
diff
changeset
|
151 final double [][] vs = new double[2][dtvs.size()]; |
59af81364eb1
Improved the 'historical discharge' calculation: implemented findValueForW().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1929
diff
changeset
|
152 |
59af81364eb1
Improved the 'historical discharge' calculation: implemented findValueForW().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1929
diff
changeset
|
153 int idx = 0; |
59af81364eb1
Improved the 'historical discharge' calculation: implemented findValueForW().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1929
diff
changeset
|
154 for (DischargeTableValue dtv: dtvs) { |
59af81364eb1
Improved the 'historical discharge' calculation: implemented findValueForW().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1929
diff
changeset
|
155 double q = dtv.getQ().doubleValue(); |
59af81364eb1
Improved the 'historical discharge' calculation: implemented findValueForW().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1929
diff
changeset
|
156 vs[0][idx] = q * scale; |
59af81364eb1
Improved the 'historical discharge' calculation: implemented findValueForW().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1929
diff
changeset
|
157 vs[1][idx] = dtv.getW().doubleValue() * scale; |
59af81364eb1
Improved the 'historical discharge' calculation: implemented findValueForW().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1929
diff
changeset
|
158 ++idx; |
59af81364eb1
Improved the 'historical discharge' calculation: implemented findValueForW().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1929
diff
changeset
|
159 } |
59af81364eb1
Improved the 'historical discharge' calculation: implemented findValueForW().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1929
diff
changeset
|
160 |
59af81364eb1
Improved the 'historical discharge' calculation: implemented findValueForW().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1929
diff
changeset
|
161 return vs; |
59af81364eb1
Improved the 'historical discharge' calculation: implemented findValueForW().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1929
diff
changeset
|
162 } |
59af81364eb1
Improved the 'historical discharge' calculation: implemented findValueForW().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1929
diff
changeset
|
163 |
2418
899ca89f497e
Another partial fix for flys/issue499: Do the W to Q conversions
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2230
diff
changeset
|
164 private static final double EPSILON = 1e-5; |
2230
59af81364eb1
Improved the 'historical discharge' calculation: implemented findValueForW().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1929
diff
changeset
|
165 |
2418
899ca89f497e
Another partial fix for flys/issue499: Do the W to Q conversions
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2230
diff
changeset
|
166 private static final boolean epsEquals(double a, double b) { |
899ca89f497e
Another partial fix for flys/issue499: Do the W to Q conversions
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2230
diff
changeset
|
167 return Math.abs(a - b) < EPSILON; |
899ca89f497e
Another partial fix for flys/issue499: Do the W to Q conversions
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2230
diff
changeset
|
168 } |
899ca89f497e
Another partial fix for flys/issue499: Do the W to Q conversions
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2230
diff
changeset
|
169 |
899ca89f497e
Another partial fix for flys/issue499: Do the W to Q conversions
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2230
diff
changeset
|
170 private static final boolean between(double a, double b, double x) { |
899ca89f497e
Another partial fix for flys/issue499: Do the W to Q conversions
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2230
diff
changeset
|
171 if (a > b) { double t = a; a = b; b = t; } |
899ca89f497e
Another partial fix for flys/issue499: Do the W to Q conversions
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2230
diff
changeset
|
172 return x > a && x < b; |
899ca89f497e
Another partial fix for flys/issue499: Do the W to Q conversions
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2230
diff
changeset
|
173 } |
899ca89f497e
Another partial fix for flys/issue499: Do the W to Q conversions
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2230
diff
changeset
|
174 |
899ca89f497e
Another partial fix for flys/issue499: Do the W to Q conversions
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2230
diff
changeset
|
175 public static double [] getQsForW(double [][] values, double w) { |
378
20c3a5b36434
Repaired DischargeTables.getQForW()
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
376
diff
changeset
|
176 |
20c3a5b36434
Repaired DischargeTables.getQForW()
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
376
diff
changeset
|
177 boolean debug = log.isDebugEnabled(); |
20c3a5b36434
Repaired DischargeTables.getQForW()
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
376
diff
changeset
|
178 |
20c3a5b36434
Repaired DischargeTables.getQForW()
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
376
diff
changeset
|
179 if (debug) { |
2418
899ca89f497e
Another partial fix for flys/issue499: Do the W to Q conversions
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2230
diff
changeset
|
180 log.debug("getQsForW: W = " + w); |
329
0b2358bc716d
Discharge table: Added static method getWForQ() to interpolate a w value for a given q value based on a given discharge table.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
328
diff
changeset
|
181 } |
0b2358bc716d
Discharge table: Added static method getWForQ() to interpolate a w value for a given q value based on a given discharge table.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
328
diff
changeset
|
182 |
2418
899ca89f497e
Another partial fix for flys/issue499: Do the W to Q conversions
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2230
diff
changeset
|
183 double [] qs = values[0]; |
899ca89f497e
Another partial fix for flys/issue499: Do the W to Q conversions
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2230
diff
changeset
|
184 double [] ws = values[1]; |
329
0b2358bc716d
Discharge table: Added static method getWForQ() to interpolate a w value for a given q value based on a given discharge table.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
328
diff
changeset
|
185 |
2418
899ca89f497e
Another partial fix for flys/issue499: Do the W to Q conversions
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2230
diff
changeset
|
186 int N = Math.min(qs.length, ws.length); |
329
0b2358bc716d
Discharge table: Added static method getWForQ() to interpolate a w value for a given q value based on a given discharge table.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
328
diff
changeset
|
187 |
2418
899ca89f497e
Another partial fix for flys/issue499: Do the W to Q conversions
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2230
diff
changeset
|
188 if (N == 0) { |
378
20c3a5b36434
Repaired DischargeTables.getQForW()
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
376
diff
changeset
|
189 if (debug) { |
2418
899ca89f497e
Another partial fix for flys/issue499: Do the W to Q conversions
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2230
diff
changeset
|
190 log.debug("Q(" + w + ") = []"); |
899ca89f497e
Another partial fix for flys/issue499: Do the W to Q conversions
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2230
diff
changeset
|
191 } |
899ca89f497e
Another partial fix for flys/issue499: Do the W to Q conversions
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2230
diff
changeset
|
192 return new double [0]; |
899ca89f497e
Another partial fix for flys/issue499: Do the W to Q conversions
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2230
diff
changeset
|
193 } |
899ca89f497e
Another partial fix for flys/issue499: Do the W to Q conversions
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2230
diff
changeset
|
194 |
899ca89f497e
Another partial fix for flys/issue499: Do the W to Q conversions
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2230
diff
changeset
|
195 TDoubleArrayList outQs = new TDoubleArrayList(); |
899ca89f497e
Another partial fix for flys/issue499: Do the W to Q conversions
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2230
diff
changeset
|
196 |
899ca89f497e
Another partial fix for flys/issue499: Do the W to Q conversions
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2230
diff
changeset
|
197 if (epsEquals(ws[0], w)) { |
899ca89f497e
Another partial fix for flys/issue499: Do the W to Q conversions
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2230
diff
changeset
|
198 outQs.add(qs[0]); |
899ca89f497e
Another partial fix for flys/issue499: Do the W to Q conversions
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2230
diff
changeset
|
199 } |
899ca89f497e
Another partial fix for flys/issue499: Do the W to Q conversions
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2230
diff
changeset
|
200 |
899ca89f497e
Another partial fix for flys/issue499: Do the W to Q conversions
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2230
diff
changeset
|
201 for (int i = 1; i < N; ++i) { |
899ca89f497e
Another partial fix for flys/issue499: Do the W to Q conversions
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2230
diff
changeset
|
202 if (epsEquals(ws[i], w)) { |
899ca89f497e
Another partial fix for flys/issue499: Do the W to Q conversions
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2230
diff
changeset
|
203 outQs.add(qs[i]); |
899ca89f497e
Another partial fix for flys/issue499: Do the W to Q conversions
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2230
diff
changeset
|
204 } |
899ca89f497e
Another partial fix for flys/issue499: Do the W to Q conversions
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2230
diff
changeset
|
205 else if (between(ws[i-1], ws[i], w)) { |
899ca89f497e
Another partial fix for flys/issue499: Do the W to Q conversions
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2230
diff
changeset
|
206 double w1 = ws[i-1]; |
899ca89f497e
Another partial fix for flys/issue499: Do the W to Q conversions
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2230
diff
changeset
|
207 double w2 = ws[i]; |
899ca89f497e
Another partial fix for flys/issue499: Do the W to Q conversions
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2230
diff
changeset
|
208 double q1 = qs[i-1]; |
899ca89f497e
Another partial fix for flys/issue499: Do the W to Q conversions
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2230
diff
changeset
|
209 double q2 = qs[i]; |
899ca89f497e
Another partial fix for flys/issue499: Do the W to Q conversions
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2230
diff
changeset
|
210 |
899ca89f497e
Another partial fix for flys/issue499: Do the W to Q conversions
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2230
diff
changeset
|
211 // q1 = m*w1 + b |
899ca89f497e
Another partial fix for flys/issue499: Do the W to Q conversions
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2230
diff
changeset
|
212 // q2 = m*w2 + b |
899ca89f497e
Another partial fix for flys/issue499: Do the W to Q conversions
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2230
diff
changeset
|
213 // q2 - q1 = m*(w2 - w1) |
899ca89f497e
Another partial fix for flys/issue499: Do the W to Q conversions
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2230
diff
changeset
|
214 // m = (q2 - q1)/(w2 - w1) # w2 != w1 |
899ca89f497e
Another partial fix for flys/issue499: Do the W to Q conversions
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2230
diff
changeset
|
215 // b = q1 - m*w1 |
899ca89f497e
Another partial fix for flys/issue499: Do the W to Q conversions
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2230
diff
changeset
|
216 // w1 != w2 |
899ca89f497e
Another partial fix for flys/issue499: Do the W to Q conversions
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2230
diff
changeset
|
217 |
899ca89f497e
Another partial fix for flys/issue499: Do the W to Q conversions
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2230
diff
changeset
|
218 double m = (q2 - q1)/(w2 - w1); |
899ca89f497e
Another partial fix for flys/issue499: Do the W to Q conversions
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2230
diff
changeset
|
219 double b = q1 - m*w1; |
899ca89f497e
Another partial fix for flys/issue499: Do the W to Q conversions
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2230
diff
changeset
|
220 double q = w*m + b; |
899ca89f497e
Another partial fix for flys/issue499: Do the W to Q conversions
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2230
diff
changeset
|
221 |
899ca89f497e
Another partial fix for flys/issue499: Do the W to Q conversions
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2230
diff
changeset
|
222 outQs.add(q); |
378
20c3a5b36434
Repaired DischargeTables.getQForW()
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
376
diff
changeset
|
223 } |
329
0b2358bc716d
Discharge table: Added static method getWForQ() to interpolate a w value for a given q value based on a given discharge table.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
328
diff
changeset
|
224 } |
2418
899ca89f497e
Another partial fix for flys/issue499: Do the W to Q conversions
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2230
diff
changeset
|
225 |
899ca89f497e
Another partial fix for flys/issue499: Do the W to Q conversions
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2230
diff
changeset
|
226 double [] result = outQs.toNativeArray(); |
899ca89f497e
Another partial fix for flys/issue499: Do the W to Q conversions
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2230
diff
changeset
|
227 |
899ca89f497e
Another partial fix for flys/issue499: Do the W to Q conversions
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2230
diff
changeset
|
228 if (debug) { |
899ca89f497e
Another partial fix for flys/issue499: Do the W to Q conversions
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2230
diff
changeset
|
229 log.debug("Q(" + w + ") = " + Arrays.toString(result)); |
378
20c3a5b36434
Repaired DischargeTables.getQForW()
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
376
diff
changeset
|
230 } |
2418
899ca89f497e
Another partial fix for flys/issue499: Do the W to Q conversions
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2230
diff
changeset
|
231 |
899ca89f497e
Another partial fix for flys/issue499: Do the W to Q conversions
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2230
diff
changeset
|
232 return result; |
329
0b2358bc716d
Discharge table: Added static method getWForQ() to interpolate a w value for a given q value based on a given discharge table.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
328
diff
changeset
|
233 } |
146
e8dfe6ba2000
Fetch w/q values of discharge tables for given gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
234 } |
e8dfe6ba2000
Fetch w/q values of discharge tables for given gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
235 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |