Mercurial > dive4elements > river
annotate artifacts/src/main/java/org/dive4elements/river/artifacts/bundu/bezugswst/BunduAccess.java @ 9636:ac41551a8e4d
Bundu/Bzws: Error message for missing channel/year, Nachtrag Pos. 20: import of two levels of infrastructure types
author | mschaefer |
---|---|
date | Mon, 11 Nov 2019 16:29:36 +0100 |
parents | 967ca59cc11a |
children |
rev | line source |
---|---|
9267 | 1 /* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde |
2 * Software engineering by Intevation GmbH | |
3 * | |
4 * This file is Free Software under the GNU AGPL (>=v3) | |
5 * and comes with ABSOLUTELY NO WARRANTY! Check out the | |
6 * documentation coming with Dive4Elements River for details. | |
7 */ | |
8 | |
9 package org.dive4elements.river.artifacts.bundu.bezugswst; | |
10 | |
11 import org.apache.log4j.Logger; | |
12 import org.dive4elements.river.artifacts.D4EArtifact; | |
13 import org.dive4elements.river.artifacts.access.FixAnalysisAccess; | |
9432
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9396
diff
changeset
|
14 import org.dive4elements.river.artifacts.states.SoundingsSelect; |
9267 | 15 |
16 public class BunduAccess extends FixAnalysisAccess { | |
17 | |
18 private static Logger log = Logger.getLogger(BunduAccess.class); | |
19 | |
20 public BunduAccess(final D4EArtifact artifact) { | |
21 super(artifact); | |
22 } | |
23 | |
24 public boolean isAutoSelect() { | |
25 final String fixChoice = this.artifact.getDataAsString("fix_choice"); | |
9366 | 26 if (fixChoice != null && fixChoice.equals("state.bundu.wst.fix.auto")) { |
9267 | 27 return true; |
28 } | |
29 return false; | |
30 } | |
31 | |
32 public Integer getBezugsJahr() { | |
33 return this.artifact.getDataAsInteger("singleyear"); | |
34 } | |
35 | |
36 public int[] getEventsTemp() { | |
37 return getIntArray("events_temp"); | |
38 } | |
39 | |
9277 | 40 public int getQSeriesLength() { |
41 return this.artifact.getDataAsInteger("year_input_q_series"); | |
42 } | |
43 | |
9323 | 44 public int getStartYear() { |
9396 | 45 return this.getBezugsJahr() - this.getQSeriesLength() + 1; |
9323 | 46 } |
47 | |
48 public Integer getUd() { | |
49 if (getUd_Q_mode().equals("UD")) | |
50 return getInteger("bundu.wst.ud_value"); | |
9525 | 51 |
52 return null; | |
9323 | 53 } |
54 | |
55 @Override | |
56 public double[] getQs() { | |
57 if (getUd_Q_mode().equals("Q")) | |
58 return super.getQs(); | |
9525 | 59 |
60 return null; | |
9323 | 61 } |
62 | |
63 private String getUd_Q_mode() { | |
64 return getString("bundu.wst.mode"); | |
65 } | |
66 | |
67 public Double getMissingVolFrom() { | |
9495
bb278c927b66
Datenkorb bezugswasserstände längsschnitte + minor fixes
gernotbelger
parents:
9465
diff
changeset
|
68 if (isCalculateMissingVolume()) |
9323 | 69 return getDouble("ld_from_part"); |
9525 | 70 |
71 return null; | |
9323 | 72 } |
73 | |
74 public Double getMissingVolTo() { | |
9495
bb278c927b66
Datenkorb bezugswasserstände längsschnitte + minor fixes
gernotbelger
parents:
9465
diff
changeset
|
75 if (isCalculateMissingVolume()) |
9323 | 76 return getDouble("ld_to_part"); |
9525 | 77 |
78 return null; | |
9323 | 79 } |
80 | |
9495
bb278c927b66
Datenkorb bezugswasserstände längsschnitte + minor fixes
gernotbelger
parents:
9465
diff
changeset
|
81 public boolean isCalculateMissingVolume() { |
9323 | 82 return getBoolean("missing_volume"); |
83 } | |
84 | |
9465
be9bd06a1e3f
bezugswst sounding select for miss'vol only (calc crashes)
gernotbelger
parents:
9446
diff
changeset
|
85 public Integer getBedHeightID() { |
9432
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9396
diff
changeset
|
86 |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9396
diff
changeset
|
87 final String data = getString("soundings"); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9396
diff
changeset
|
88 |
9495
bb278c927b66
Datenkorb bezugswasserstände längsschnitte + minor fixes
gernotbelger
parents:
9465
diff
changeset
|
89 if (data == null || !isCalculateMissingVolume()) { |
9432
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9396
diff
changeset
|
90 log.warn("No 'soundings' parameter specified!"); |
9465
be9bd06a1e3f
bezugswst sounding select for miss'vol only (calc crashes)
gernotbelger
parents:
9446
diff
changeset
|
91 return null; |
9432
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9396
diff
changeset
|
92 } |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9396
diff
changeset
|
93 |
9525 | 94 log.debug("getBedHeightIDs(): data=" + data); |
9432
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9396
diff
changeset
|
95 |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9396
diff
changeset
|
96 int singleID = 0; |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9396
diff
changeset
|
97 |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9396
diff
changeset
|
98 if (data.indexOf(SoundingsSelect.PREFIX_SINGLE) >= 0) { |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9396
diff
changeset
|
99 final String tmp = data.replace(SoundingsSelect.PREFIX_SINGLE, ""); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9396
diff
changeset
|
100 try { |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9396
diff
changeset
|
101 singleID = Integer.parseInt(tmp); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9396
diff
changeset
|
102 } |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9396
diff
changeset
|
103 catch (final NumberFormatException nfe) { |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9396
diff
changeset
|
104 log.warn("Cannot parse int from string: '" + tmp + "'"); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9396
diff
changeset
|
105 } |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9396
diff
changeset
|
106 } |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9396
diff
changeset
|
107 return singleID; |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9396
diff
changeset
|
108 } |
9525 | 109 } |