comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/Calculation3.java @ 3468:f37e7e8907cb

merged flys-artifacts/2.8.1
author Thomas Arendsen Hein <thomas@intevation.de>
date Fri, 28 Sep 2012 12:14:39 +0200
parents 2898b1ff6013
children
comparison
equal deleted inserted replaced
3387:5ffad8bde8ad 3468:f37e7e8907cb
1 package de.intevation.flys.artifacts.model;
2
3 import org.apache.log4j.Logger;
4
5 public class Calculation3
6 extends Calculation
7 {
8 private static Logger logger = Logger.getLogger(Calculation3.class);
9
10 protected double km;
11 protected int [] days;
12 protected double [] qs;
13
14 public Calculation3() {
15 }
16
17 public Calculation3(double km, int [] days, double [] qs) {
18 this.km = km;
19 this.days = days;
20 this.qs = qs;
21 }
22
23 public CalculationResult calculate(WstValueTable wst) {
24
25 double [] ws = wst.interpolateW(km, qs, new double[qs.length], this);
26
27 if (days == null || days.length == 0) {
28 addProblem(km, "cannot.find.ds");
29 }
30
31 if (logger.isDebugEnabled()) {
32 logger.debug("Calculate duration curve data:");
33 logger.debug(" km : " + km);
34 logger.debug(" num Days : " + (days != null ? days.length : 0));
35 logger.debug(" num Qs : " + (qs != null ? qs.length : 0));
36 logger.debug(" result Ws: " + (ws != null ? ws.length : 0));
37 }
38
39 WQDay wqday = new WQDay(days, ws, qs);
40
41 if (hasProblems()) {
42 logger.debug("calculation caused "+numProblems()+" problem(s).");
43 wqday.removeNaNs();
44 }
45
46 return new CalculationResult(wqday, this);
47 }
48 }
49 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org