comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/WstValueTable.java @ 645:433f67a076aa

Use an explicit reference km for interpolation now. flys-artifacts/trunk@2029 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Tue, 31 May 2011 09:35:19 +0000
parents d08f77e7f7e8
children 44175d4720f8
comparison
equal deleted inserted replaced
644:02c0cce0e469 645:433f67a076aa
382 } 382 }
383 } 383 }
384 384
385 public QPosition interpolate( 385 public QPosition interpolate(
386 double q, 386 double q,
387 int referenceIndex, 387 double referenceKm,
388 double [] kms, 388 double [] kms,
389 double [] ws, 389 double [] ws,
390 double [] qs 390 double [] qs
391 ) { 391 ) {
392 Row kmKey = new Row(kms[referenceIndex]); 392 QPosition qPosition = getQPosition(referenceKm, q);
393
394 int rowIndex = Collections.binarySearch(rows, kmKey);
395
396 int R1 = rows.size()-1;
397
398 QPosition qPosition = getQPosition(kms[referenceIndex], q);
399 393
400 if (qPosition == null) { 394 if (qPosition == null) {
401 // we cannot locate q at km 395 // we cannot locate q at km
402 return null; 396 return null;
403 } 397 }
404 398
399 Row kmKey = new Row();
400
401 int R1 = rows.size()-1;
402
405 for (int i = 0; i < kms.length; ++i) { 403 for (int i = 0; i < kms.length; ++i) {
406 kmKey.km = kms[i]; 404 kmKey.km = kms[i];
407 405
408 rowIndex = Collections.binarySearch(rows, kmKey); 406 int rowIndex = Collections.binarySearch(rows, kmKey);
409 407
410 qs[i] = getQ(qPosition, kms[i]); 408 qs[i] = getQ(qPosition, kms[i]);
411 409
412 if (rowIndex >= 0) { 410 if (rowIndex >= 0) {
413 // direct row match 411 // direct row match

http://dive4elements.wald.intevation.org