comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java @ 738:5abdb2fa8eb1

Fix for flys/issue147 flys-artifacts/trunk@2234 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Sun, 26 Jun 2011 14:46:48 +0000
parents d9d9f67af984
children 9ff7e06bcb77
comparison
equal deleted inserted replaced
737:6b38b8488401 738:5abdb2fa8eb1
342 WstValueTable wst = WstValueTableFactory.getTable(river); 342 WstValueTable wst = WstValueTableFactory.getTable(river);
343 if (wst == null) { 343 if (wst == null) {
344 return error(new WQKms[0], "No Wst found for selected river."); 344 return error(new WQKms[0], "No Wst found for selected river.");
345 } 345 }
346 346
347 double refKm = Double.NaN; 347
348 348 double [] range = getDistance();
349 if (!isFreeQ()) { 349 if (range == null) {
350 double [] range = getDistance(); 350 return error(new WQKms[0], "No range found");
351 if (range == null) { 351 }
352 return error(new WQKms[0], "No range found"); 352
353 } 353 double refKm;
354 354
355 if (isFreeQ()) {
356 refKm = range[0];
357 logger.debug("'free' calculation (km " + refKm + ")");
358 }
359 else {
355 Gauge gauge = river.determineGaugeByPosition(range[0]); 360 Gauge gauge = river.determineGaugeByPosition(range[0]);
356 if (gauge == null) { 361 if (gauge == null) {
357 return error( 362 return error(
358 new WQKms[0], "No gauge found for km " + range[0]); 363 new WQKms[0], "No gauge found for km " + range[0]);
359 } 364 }
362 367
363 logger.debug( 368 logger.debug(
364 "reference gauge: " + gauge.getName() + " (km " + refKm + ")"); 369 "reference gauge: " + gauge.getName() + " (km " + refKm + ")");
365 } 370 }
366 371
367 return computeWaterlevelData( 372 return computeWaterlevelData(kms, qs, ws, wst, refKm);
368 kms, qs, ws, wst, refKm, river.getKmUp());
369 } 373 }
370 374
371 /** 375 /**
372 * Computes the data of a waterlevel computation based on the interpolation 376 * Computes the data of a waterlevel computation based on the interpolation
373 * in WstValueTable. 377 * in WstValueTable.
381 public static CalculationResult computeWaterlevelData( 385 public static CalculationResult computeWaterlevelData(
382 double [] kms, 386 double [] kms,
383 double [] qs, 387 double [] qs,
384 double [] ws, 388 double [] ws,
385 WstValueTable wst, 389 WstValueTable wst,
386 double refKm, 390 double refKm
387 boolean up
388 ) { 391 ) {
389 logger.info("WINFOArtifact.computeWaterlevelData"); 392 logger.info("WINFOArtifact.computeWaterlevelData");
390 393
391 Calculation1 calc1 = new Calculation1(kms, qs, ws, refKm, up); 394 Calculation1 calc1 = new Calculation1(kms, qs, ws, refKm);
392 395
393 return calc1.calculate(wst); 396 return calc1.calculate(wst);
394 } 397 }
395 398
396 399

http://dive4elements.wald.intevation.org