Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/Calculation4.java @ 2422:44dc117aa2b7
Picked rev 4058,4063,4065,4068,4069 from trunk.
flys-artifacts/tags/2.6.1@4077 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Fri, 17 Feb 2012 11:29:41 +0000 |
parents | 899ca89f497e |
children | cb11919cccf9 |
comparison
equal
deleted
inserted
replaced
2421:59047dfed8be | 2422:44dc117aa2b7 |
---|---|
7 | 7 |
8 import de.intevation.flys.utils.DoubleUtil; | 8 import de.intevation.flys.utils.DoubleUtil; |
9 | 9 |
10 import de.intevation.flys.model.River; | 10 import de.intevation.flys.model.River; |
11 import de.intevation.flys.model.Gauge; | 11 import de.intevation.flys.model.Gauge; |
12 import de.intevation.flys.model.DischargeTable; | |
12 | 13 |
13 import de.intevation.flys.artifacts.model.WstValueTable.QPosition; | 14 import de.intevation.flys.artifacts.model.WstValueTable.QPosition; |
14 | 15 |
15 import de.intevation.flys.artifacts.math.Function; | 16 import de.intevation.flys.artifacts.math.Function; |
16 import de.intevation.flys.artifacts.math.Linear; | 17 import de.intevation.flys.artifacts.math.Linear; |
75 throw new IllegalArgumentException("wrong length of values"); | 76 throw new IllegalArgumentException("wrong length of values"); |
76 } | 77 } |
77 | 78 |
78 // convert to Q if needed | 79 // convert to Q if needed |
79 if (!isQ && gauge != null) { | 80 if (!isQ && gauge != null) { |
80 double [][] table = new DischargeTables( | 81 |
81 river.getName(), gauge.getName()).getFirstTable(); | 82 DischargeTable dt = gauge.fetchMasterDischargeTable(); |
83 | |
84 double [][] table = | |
85 DischargeTables.loadDischargeTableValues(dt, 1); | |
82 | 86 |
83 // need the original values for naming | 87 // need the original values for naming |
84 segment.backup(); | 88 segment.backup(); |
85 | 89 |
86 for (int i = 0; i < values.length; ++i) { | 90 for (int i = 0; i < values.length; ++i) { |
87 double w = values[i] * 100; | 91 double w = values[i] / 100.0; |
88 double [] qs = DischargeTables.getQsForW(table, w); | 92 double [] qs = DischargeTables.getQsForW(table, w); |
89 if (qs.length == 0) { | 93 if (qs.length == 0) { |
90 logger.warn("No Qs found for W = " + values[i]); | 94 logger.warn("No Qs found for W = " + values[i]); |
95 addProblem("cannot.find.w.for.q", values[i]); | |
91 values[i] = Double.NaN; | 96 values[i] = Double.NaN; |
92 } | 97 } |
93 else { | 98 else { |
94 values[i] = qs[0]; | 99 values[i] = qs[0]; |
95 if (qs.length > 1) { | 100 if (qs.length > 1) { |