comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/Calculation2.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 c1f445b94d03
children
comparison
equal deleted inserted replaced
3387:5ffad8bde8ad 3468:f37e7e8907cb
1 package de.intevation.flys.artifacts.model;
2
3 import java.util.Arrays;
4
5 import org.apache.log4j.Logger;
6
7
8 /** ComputedDischargeCurve. */
9 public class Calculation2
10 extends Calculation
11 {
12 private static Logger logger = Logger.getLogger(Calculation2.class);
13
14 protected double km;
15
16 public Calculation2() {
17 }
18
19 public Calculation2(double km) {
20 this.km = km;
21 }
22
23 public CalculationResult calculate(WstValueTable wst) {
24
25 logger.debug("Calculation2.calculate");
26
27 double [][] wqs = wst.interpolateWQ(km, this);
28
29 if (wqs == null || wqs[0].length == 0) {
30 addProblem("cannot.compute.discharge.curve");
31 return new CalculationResult(new WQKms[0], this);
32 }
33
34 double [] ws = wqs[0];
35 double [] qs = wqs[1];
36 double [] kms = new double[ws.length];
37
38 Arrays.fill(kms, km);
39
40 WQKms wqkms = new WQKms(kms, qs, ws, String.valueOf(km));
41
42 if (hasProblems()) {
43 logger.debug("found " + numProblems() + " problems.");
44 wqkms.removeNaNs();
45 }
46
47 return new CalculationResult(new WQKms[] { wqkms }, this);
48 }
49 }
50 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org