comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/Calculation2.java @ 3818:dc18457b1cef

merged flys-artifacts/pre2.7-2012-03-16
author Thomas Arendsen Hein <thomas@intevation.de>
date Fri, 28 Sep 2012 12:14:59 +0200
parents 2898b1ff6013
children c1f445b94d03
comparison
equal deleted inserted replaced
2456:60ab1054069d 3818:dc18457b1cef
1 package de.intevation.flys.artifacts.model;
2
3 import java.util.Arrays;
4
5 import org.apache.log4j.Logger;
6
7 public class Calculation2
8 extends Calculation
9 {
10 private static Logger logger = Logger.getLogger(Calculation2.class);
11
12 protected double km;
13
14 public Calculation2() {
15 }
16
17 public Calculation2(double km) {
18 this.km = km;
19 }
20
21 public CalculationResult calculate(WstValueTable wst) {
22
23 logger.debug("Calculation2.calculate");
24
25 double [][] wqs = wst.interpolateWQ(km, this);
26
27 if (wqs == null || wqs[0].length == 0) {
28 addProblem("cannot.compute.discharge.curve");
29 return new CalculationResult(new WQKms[0], this);
30 }
31
32 double [] ws = wqs[0];
33 double [] qs = wqs[1];
34 double [] kms = new double[ws.length];
35
36 Arrays.fill(kms, km);
37
38 WQKms wqkms = new WQKms(kms, qs, ws, String.valueOf(km));
39
40 if (hasProblems()) {
41 logger.debug("found + "+numProblems()+" problems.");
42 wqkms.removeNaNs();
43 }
44
45 return new CalculationResult(new WQKms[] { wqkms }, this);
46 }
47 }
48 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org