annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/Calculation3.java @ 1085:07878836ee0d

Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale. flys-artifacts/trunk@2588 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Fri, 26 Aug 2011 08:49:18 +0000
parents 3b7e9ddf6bb1
children 0296684a5553
rev   line source
676
c501f27c1f71 Added error reporting to 'Dauerzahlen' calculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1 package de.intevation.flys.artifacts.model;
c501f27c1f71 Added error reporting to 'Dauerzahlen' calculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
2
c501f27c1f71 Added error reporting to 'Dauerzahlen' calculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
3 import org.apache.log4j.Logger;
c501f27c1f71 Added error reporting to 'Dauerzahlen' calculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
4
c501f27c1f71 Added error reporting to 'Dauerzahlen' calculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
5 public class Calculation3
c501f27c1f71 Added error reporting to 'Dauerzahlen' calculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
6 extends Calculation
c501f27c1f71 Added error reporting to 'Dauerzahlen' calculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
7 {
c501f27c1f71 Added error reporting to 'Dauerzahlen' calculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
8 private static Logger logger = Logger.getLogger(Calculation3.class);
c501f27c1f71 Added error reporting to 'Dauerzahlen' calculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
9
c501f27c1f71 Added error reporting to 'Dauerzahlen' calculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
10 protected double km;
c501f27c1f71 Added error reporting to 'Dauerzahlen' calculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
11 protected int [] days;
c501f27c1f71 Added error reporting to 'Dauerzahlen' calculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
12 protected double [] qs;
c501f27c1f71 Added error reporting to 'Dauerzahlen' calculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
13
c501f27c1f71 Added error reporting to 'Dauerzahlen' calculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
14 public Calculation3() {
c501f27c1f71 Added error reporting to 'Dauerzahlen' calculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
15 }
c501f27c1f71 Added error reporting to 'Dauerzahlen' calculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
16
c501f27c1f71 Added error reporting to 'Dauerzahlen' calculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
17 public Calculation3(double km, int [] days, double [] qs) {
c501f27c1f71 Added error reporting to 'Dauerzahlen' calculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
18 this.km = km;
c501f27c1f71 Added error reporting to 'Dauerzahlen' calculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
19 this.days = days;
c501f27c1f71 Added error reporting to 'Dauerzahlen' calculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
20 this.qs = qs;
c501f27c1f71 Added error reporting to 'Dauerzahlen' calculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
21 }
c501f27c1f71 Added error reporting to 'Dauerzahlen' calculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
22
709
3b7e9ddf6bb1 New model to transport data and error reports of calculations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 676
diff changeset
23 public CalculationResult calculate(WstValueTable wst) {
676
c501f27c1f71 Added error reporting to 'Dauerzahlen' calculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
24
c501f27c1f71 Added error reporting to 'Dauerzahlen' calculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
25 double [] ws = wst.interpolateW(km, qs, new double[qs.length], this);
c501f27c1f71 Added error reporting to 'Dauerzahlen' calculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
26
c501f27c1f71 Added error reporting to 'Dauerzahlen' calculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
27 WQDay wqday = new WQDay(days, ws, qs);
c501f27c1f71 Added error reporting to 'Dauerzahlen' calculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
28
c501f27c1f71 Added error reporting to 'Dauerzahlen' calculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
29 if (hasProblems()) {
c501f27c1f71 Added error reporting to 'Dauerzahlen' calculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
30 logger.debug("calculation caused "+numProblems()+" problem(s).");
c501f27c1f71 Added error reporting to 'Dauerzahlen' calculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
31 wqday.removeNaNs();
c501f27c1f71 Added error reporting to 'Dauerzahlen' calculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
32 }
c501f27c1f71 Added error reporting to 'Dauerzahlen' calculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
33
709
3b7e9ddf6bb1 New model to transport data and error reports of calculations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 676
diff changeset
34 return new CalculationResult(wqday, this);
676
c501f27c1f71 Added error reporting to 'Dauerzahlen' calculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
35 }
c501f27c1f71 Added error reporting to 'Dauerzahlen' calculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
36 }
c501f27c1f71 Added error reporting to 'Dauerzahlen' calculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
37 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org