comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/DischargeTables.java @ 735:db68806e6563

Fixed "W am Pegel" calculations. flys-artifacts/trunk@2230 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Sat, 25 Jun 2011 17:35:50 +0000
parents 20c3a5b36434
children 6b0ae0f2cae6
comparison
equal deleted inserted replaced
734:56d70e546800 735:db68806e6563
185 185
186 if (debug) { 186 if (debug) {
187 log.debug("calculating getQForW(" + w + ")"); 187 log.debug("calculating getQForW(" + w + ")");
188 } 188 }
189 189
190 int index = Arrays.binarySearch(values[0], w); 190 int index = Arrays.binarySearch(values[1], w);
191 if (index >= 0) { 191 if (index >= 0) {
192 return values[0][index]; 192 return values[0][index];
193 } 193 }
194 194
195 index = -index - 1; // insert position 195 index = -index - 1; // insert position
200 log.debug("we do not extrapolate: NaN"); 200 log.debug("we do not extrapolate: NaN");
201 } 201 }
202 return Double.NaN; 202 return Double.NaN;
203 } 203 }
204 204
205 double w1 = values[0][index-1]; 205 double w1 = values[1][index-1];
206 double w2 = values[0][index ]; 206 double w2 = values[1][index ];
207 double q1 = values[1][index-1]; 207 double q1 = values[0][index-1];
208 double q2 = values[1][index ]; 208 double q2 = values[0][index ];
209 209
210 // q1 = m*w1 + b 210 // q1 = m*w1 + b
211 // q2 = m*w2 + b 211 // q2 = m*w2 + b
212 // q2 - q1 = m*(w2 - w1) 212 // q2 - q1 = m*(w2 - w1)
213 // m = (q2 - q1)/(w2 - w1) # w2 != w1 213 // m = (q2 - q1)/(w2 - w1) # w2 != w1

http://dive4elements.wald.intevation.org