annotate artifacts/src/main/java/org/dive4elements/river/artifacts/model/Calculation3.java @ 8870:c26fb37899ca

Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui. Also using now the localization info from the server instead of localizing the modules again on the client side.
author gernotbelger
date Wed, 07 Feb 2018 11:59:13 +0100
parents e4606eae8ea5
children b380a5693514 0a5239a1e46e
rev   line source
5863
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
1 /* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
2 * Software engineering by Intevation GmbH
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
3 *
5994
af13ceeba52a Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5863
diff changeset
4 * This file is Free Software under the GNU AGPL (>=v3)
5863
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
5 * and comes with ABSOLUTELY NO WARRANTY! Check out the
5994
af13ceeba52a Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5863
diff changeset
6 * documentation coming with Dive4Elements River for details.
5863
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
7 */
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
8
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 2166
diff changeset
9 package org.dive4elements.river.artifacts.model;
676
c501f27c1f71 Added error reporting to 'Dauerzahlen' calculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
10
c501f27c1f71 Added error reporting to 'Dauerzahlen' calculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
11 import org.apache.log4j.Logger;
c501f27c1f71 Added error reporting to 'Dauerzahlen' calculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
12
c501f27c1f71 Added error reporting to 'Dauerzahlen' calculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
13 public class Calculation3
c501f27c1f71 Added error reporting to 'Dauerzahlen' calculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
14 extends Calculation
c501f27c1f71 Added error reporting to 'Dauerzahlen' calculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
15 {
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5994
diff changeset
16 private static Logger log = Logger.getLogger(Calculation3.class);
676
c501f27c1f71 Added error reporting to 'Dauerzahlen' calculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
17
c501f27c1f71 Added error reporting to 'Dauerzahlen' calculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
18 protected double km;
c501f27c1f71 Added error reporting to 'Dauerzahlen' calculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
19 protected int [] days;
c501f27c1f71 Added error reporting to 'Dauerzahlen' calculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
20 protected double [] 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 public Calculation3() {
c501f27c1f71 Added error reporting to 'Dauerzahlen' calculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
23 }
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 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
26 this.km = km;
c501f27c1f71 Added error reporting to 'Dauerzahlen' calculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
27 this.days = days;
c501f27c1f71 Added error reporting to 'Dauerzahlen' calculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
28 this.qs = qs;
c501f27c1f71 Added error reporting to 'Dauerzahlen' calculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
29 }
c501f27c1f71 Added error reporting to 'Dauerzahlen' calculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
30
709
3b7e9ddf6bb1 New model to transport data and error reports of calculations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 676
diff changeset
31 public CalculationResult calculate(WstValueTable wst) {
676
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 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
34
1669
0296684a5553 Bugfix: #330 Add problem if no data was found for duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 709
diff changeset
35 if (days == null || days.length == 0) {
2166
2898b1ff6013 I18N for WINFO calculation result messages.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1669
diff changeset
36 addProblem(km, "cannot.find.ds");
1669
0296684a5553 Bugfix: #330 Add problem if no data was found for duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 709
diff changeset
37 }
0296684a5553 Bugfix: #330 Add problem if no data was found for duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 709
diff changeset
38
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5994
diff changeset
39 if (log.isDebugEnabled()) {
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5994
diff changeset
40 log.debug("Calculate duration curve data:");
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5994
diff changeset
41 log.debug(" km : " + km);
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5994
diff changeset
42 log.debug(" num Days : " + (days != null ? days.length : 0));
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5994
diff changeset
43 log.debug(" num Qs : " + (qs != null ? qs.length : 0));
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5994
diff changeset
44 log.debug(" result Ws: " + (ws != null ? ws.length : 0));
1669
0296684a5553 Bugfix: #330 Add problem if no data was found for duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 709
diff changeset
45 }
0296684a5553 Bugfix: #330 Add problem if no data was found for duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 709
diff changeset
46
676
c501f27c1f71 Added error reporting to 'Dauerzahlen' calculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
47 WQDay wqday = new WQDay(days, ws, qs);
c501f27c1f71 Added error reporting to 'Dauerzahlen' calculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
48
c501f27c1f71 Added error reporting to 'Dauerzahlen' calculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
49 if (hasProblems()) {
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5994
diff changeset
50 log.debug("calculation caused "+numProblems()+" problem(s).");
676
c501f27c1f71 Added error reporting to 'Dauerzahlen' calculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
51 wqday.removeNaNs();
c501f27c1f71 Added error reporting to 'Dauerzahlen' calculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
52 }
c501f27c1f71 Added error reporting to 'Dauerzahlen' calculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
53
709
3b7e9ddf6bb1 New model to transport data and error reports of calculations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 676
diff changeset
54 return new CalculationResult(wqday, this);
676
c501f27c1f71 Added error reporting to 'Dauerzahlen' calculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
55 }
c501f27c1f71 Added error reporting to 'Dauerzahlen' calculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
56 }
c501f27c1f71 Added error reporting to 'Dauerzahlen' calculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
57 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org