Mercurial > dive4elements > river
annotate artifacts/src/main/java/org/dive4elements/river/exports/fixings/DeltaWtExporter.java @ 9082:42c15e2f95fb
2.3.4.1.4 Wasserstand falsche Einheit
FixAnalysis PDF start
author | gernotbelger |
---|---|
date | Fri, 25 May 2018 10:44:24 +0200 |
parents | 5e38e2924c07 |
children | 8024e51e828a |
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:
5603
diff
changeset
|
9 package org.dive4elements.river.exports.fixings; |
3216
a46910e61dfb
FixA: Moved DeltaWtExporter to fixings exporter package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
10 |
a46910e61dfb
FixA: Moved DeltaWtExporter to fixings exporter package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
11 import java.io.IOException; |
a46910e61dfb
FixA: Moved DeltaWtExporter to fixings exporter package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
12 import java.io.OutputStream; |
a46910e61dfb
FixA: Moved DeltaWtExporter to fixings exporter package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
13 import java.text.DateFormat; |
3398
7f9fe694f8d1
FixA: Added time range column to Delta W(t) CSV export.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3397
diff
changeset
|
14 import java.text.MessageFormat; |
3216
a46910e61dfb
FixA: Moved DeltaWtExporter to fixings exporter package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
15 import java.text.NumberFormat; |
a46910e61dfb
FixA: Moved DeltaWtExporter to fixings exporter package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
16 import java.util.ArrayList; |
a46910e61dfb
FixA: Moved DeltaWtExporter to fixings exporter package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
17 import java.util.List; |
5603
47e5bc64d3de
FixA: tab output ist now grouped by km and periods. Fixes flys/issue1163
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4736
diff
changeset
|
18 import java.util.TreeMap; |
3216
a46910e61dfb
FixA: Moved DeltaWtExporter to fixings exporter package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
19 |
a46910e61dfb
FixA: Moved DeltaWtExporter to fixings exporter package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
20 import org.apache.log4j.Logger; |
9082 | 21 import org.dive4elements.artifacts.CallMeta; |
22 import org.dive4elements.river.artifacts.D4EArtifact; | |
23 import org.dive4elements.river.artifacts.access.RiverAccess; | |
24 import org.dive4elements.river.artifacts.model.CalculationResult; | |
25 import org.dive4elements.river.artifacts.model.fixings.AnalysisPeriod; | |
26 import org.dive4elements.river.artifacts.model.fixings.FixAnalysisResult; | |
27 import org.dive4elements.river.artifacts.model.fixings.QWD; | |
28 import org.dive4elements.river.artifacts.resources.Resources; | |
29 import org.dive4elements.river.exports.AbstractExporter; | |
30 import org.dive4elements.river.utils.Formatter; | |
31 import org.dive4elements.river.utils.KMIndex; | |
32 | |
33 import au.com.bytecode.opencsv.CSVWriter; | |
3216
a46910e61dfb
FixA: Moved DeltaWtExporter to fixings exporter package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
34 |
3644
fa633f6a5fd9
smaller part of issue825 fixed (column ordering of dwt-export).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3415
diff
changeset
|
35 /** Exports fixation analysis deltaw(t) computation results to csv. */ |
9082 | 36 public class DeltaWtExporter extends AbstractExporter { |
8202
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7088
diff
changeset
|
37 /** Private log. */ |
3216
a46910e61dfb
FixA: Moved DeltaWtExporter to fixings exporter package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
38 private static Logger log = Logger.getLogger(DeltaWtExporter.class); |
a46910e61dfb
FixA: Moved DeltaWtExporter to fixings exporter package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
39 |
9082 | 40 public static final String CSV_KM_HEADER = "export.fixings.deltawt.csv.header.km"; |
3397
6d1740533810
FixA: Added discharge column to DeltaW(t) CSV export.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3217
diff
changeset
|
41 |
9082 | 42 public static final String CSV_DELTA_W_HEADER = "export.fixings.deltawt.csv.header.deltaw"; |
3402
0336132ec9db
Adjusted Delta W(t) CSV exporter to customers wishes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3398
diff
changeset
|
43 |
9082 | 44 public static final String CSV_Q_HEADER = "export.fixings.deltawt.csv.header.q"; |
3398
7f9fe694f8d1
FixA: Added time range column to Delta W(t) CSV export.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3397
diff
changeset
|
45 |
9082 | 46 public static final String CSV_W_HEADER = "export.fixings.deltawt.csv.header.w"; |
3216
a46910e61dfb
FixA: Moved DeltaWtExporter to fixings exporter package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
47 |
9082 | 48 public static final String CSV_TRANGE_HEADER = "export.fixings.deltawt.csv.header.time.range"; |
49 | |
50 public static final String CSV_T_HEADER = "export.fixings.deltawt.csv.header.t"; | |
51 | |
52 public static final String CSV_T_FORMAT = "export.fixings.deltawt.csv.t.format"; | |
3216
a46910e61dfb
FixA: Moved DeltaWtExporter to fixings exporter package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
53 |
a46910e61dfb
FixA: Moved DeltaWtExporter to fixings exporter package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
54 public static final String DEFAULT_CSV_KM_HEADER = "km"; |
a46910e61dfb
FixA: Moved DeltaWtExporter to fixings exporter package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
55 |
a46910e61dfb
FixA: Moved DeltaWtExporter to fixings exporter package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
56 public static final String DEFAULT_CSV_DELTA_W_HEADER = "\u0394 W [cm]"; |
a46910e61dfb
FixA: Moved DeltaWtExporter to fixings exporter package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
57 |
3402
0336132ec9db
Adjusted Delta W(t) CSV exporter to customers wishes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3398
diff
changeset
|
58 public static final String DEFAULT_CSV_W_HEADER = "Wasserstand [m]"; |
0336132ec9db
Adjusted Delta W(t) CSV exporter to customers wishes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3398
diff
changeset
|
59 |
3397
6d1740533810
FixA: Added discharge column to DeltaW(t) CSV export.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3217
diff
changeset
|
60 public static final String DEFAULT_CSV_Q_HEADER = "Abfluss [m\u00b3/s]"; |
6d1740533810
FixA: Added discharge column to DeltaW(t) CSV export.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3217
diff
changeset
|
61 |
3216
a46910e61dfb
FixA: Moved DeltaWtExporter to fixings exporter package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
62 public static final String DEFAULT_CSV_T_HEADER = "Datum"; |
a46910e61dfb
FixA: Moved DeltaWtExporter to fixings exporter package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
63 |
9082 | 64 public static final String DEFAULT_CSV_TRANGE_DESC_HEADER = "Status"; |
3398
7f9fe694f8d1
FixA: Added time range column to Delta W(t) CSV export.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3397
diff
changeset
|
65 |
9082 | 66 public static final String CSV_REFERENCE = "export.fixings.deltawt.csv.reference"; |
3398
7f9fe694f8d1
FixA: Added time range column to Delta W(t) CSV export.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3397
diff
changeset
|
67 |
9082 | 68 public static final String CSV_ANALYSIS = "export.fixings.deltawt.csv.analysis"; |
3402
0336132ec9db
Adjusted Delta W(t) CSV exporter to customers wishes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3398
diff
changeset
|
69 |
9082 | 70 public static final String DEFAULT_CSV_REFERENCE = "B"; |
3398
7f9fe694f8d1
FixA: Added time range column to Delta W(t) CSV export.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3397
diff
changeset
|
71 |
9082 | 72 public static final String DEFAULT_CSV_ANALYSIS = "A{0,number,integer}"; |
73 | |
74 public static final String DEFAULT_CSV_T_FORMAT = "dd.MM.yyyy"; | |
75 | |
76 protected List<KMIndex<AnalysisPeriod[]>> analysisPeriods; | |
3216
a46910e61dfb
FixA: Moved DeltaWtExporter to fixings exporter package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
77 |
a46910e61dfb
FixA: Moved DeltaWtExporter to fixings exporter package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
78 protected List<KMIndex<QWD[]>> referenceEvents; |
a46910e61dfb
FixA: Moved DeltaWtExporter to fixings exporter package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
79 |
7077
0a337f0005c2
Extended init() of OutGenerator to take name of the out to serve.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5994
diff
changeset
|
80 public DeltaWtExporter() { |
9082 | 81 this.analysisPeriods = new ArrayList<>(); |
82 this.referenceEvents = new ArrayList<>(); | |
3216
a46910e61dfb
FixA: Moved DeltaWtExporter to fixings exporter package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
83 } |
a46910e61dfb
FixA: Moved DeltaWtExporter to fixings exporter package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
84 |
a46910e61dfb
FixA: Moved DeltaWtExporter to fixings exporter package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
85 @Override |
9082 | 86 protected void addData(final Object d) { |
3216
a46910e61dfb
FixA: Moved DeltaWtExporter to fixings exporter package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
87 log.debug("DeltaWtExporter.addData"); |
a46910e61dfb
FixA: Moved DeltaWtExporter to fixings exporter package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
88 if (!(d instanceof CalculationResult)) { |
a46910e61dfb
FixA: Moved DeltaWtExporter to fixings exporter package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
89 log.warn("Invalid data type"); |
a46910e61dfb
FixA: Moved DeltaWtExporter to fixings exporter package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
90 return; |
a46910e61dfb
FixA: Moved DeltaWtExporter to fixings exporter package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
91 } |
a46910e61dfb
FixA: Moved DeltaWtExporter to fixings exporter package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
92 |
9082 | 93 final Object data = ((CalculationResult) d).getData(); |
3415
e3c7a3228bc2
FixA: Renamed FixResult to FixAnalysisResult.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3402
diff
changeset
|
94 if (!(data instanceof FixAnalysisResult)) { |
3216
a46910e61dfb
FixA: Moved DeltaWtExporter to fixings exporter package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
95 log.warn("Invalid data stored in result."); |
a46910e61dfb
FixA: Moved DeltaWtExporter to fixings exporter package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
96 } |
9082 | 97 final FixAnalysisResult result = (FixAnalysisResult) data; |
98 this.analysisPeriods.add(result.getAnalysisPeriods()); | |
99 this.referenceEvents.add(result.getReferenced()); | |
3216
a46910e61dfb
FixA: Moved DeltaWtExporter to fixings exporter package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
100 } |
a46910e61dfb
FixA: Moved DeltaWtExporter to fixings exporter package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
101 |
a46910e61dfb
FixA: Moved DeltaWtExporter to fixings exporter package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
102 @Override |
9082 | 103 protected void writeCSVData(final CSVWriter writer) throws IOException { |
3216
a46910e61dfb
FixA: Moved DeltaWtExporter to fixings exporter package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
104 |
9082 | 105 final boolean debug = log.isDebugEnabled(); |
3216
a46910e61dfb
FixA: Moved DeltaWtExporter to fixings exporter package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
106 |
a46910e61dfb
FixA: Moved DeltaWtExporter to fixings exporter package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
107 writeCSVHeader(writer); |
a46910e61dfb
FixA: Moved DeltaWtExporter to fixings exporter package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
108 |
9082 | 109 final NumberFormat kmF = getKMFormatter(); |
110 final NumberFormat dwF = getDeltaWFormatter(); | |
111 final NumberFormat qF = getQFormatter(); | |
112 final NumberFormat wF = getWFormatter(); | |
3216
a46910e61dfb
FixA: Moved DeltaWtExporter to fixings exporter package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
113 |
9082 | 114 final DateFormat dF = getDateFormatter(); |
3398
7f9fe694f8d1
FixA: Added time range column to Delta W(t) CSV export.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3397
diff
changeset
|
115 |
9082 | 116 final TreeMap<Double, ArrayList<String[]>> sorted = new TreeMap<>(); |
3216
a46910e61dfb
FixA: Moved DeltaWtExporter to fixings exporter package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
117 |
9082 | 118 final String referenceS = getReference(); |
3216
a46910e61dfb
FixA: Moved DeltaWtExporter to fixings exporter package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
119 |
9082 | 120 for (final KMIndex<QWD[]> reference : this.referenceEvents) { |
5603
47e5bc64d3de
FixA: tab output ist now grouped by km and periods. Fixes flys/issue1163
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4736
diff
changeset
|
121 |
9082 | 122 for (final KMIndex.Entry<QWD[]> kmEntry : reference) { |
123 | |
124 final Double km = kmEntry.getKm(); | |
125 | |
126 ArrayList<String[]> list = sorted.get(km); | |
5603
47e5bc64d3de
FixA: tab output ist now grouped by km and periods. Fixes flys/issue1163
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4736
diff
changeset
|
127 |
47e5bc64d3de
FixA: tab output ist now grouped by km and periods. Fixes flys/issue1163
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4736
diff
changeset
|
128 if (list == null) { |
9082 | 129 list = new ArrayList<>(); |
5603
47e5bc64d3de
FixA: tab output ist now grouped by km and periods. Fixes flys/issue1163
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4736
diff
changeset
|
130 sorted.put(km, list); |
47e5bc64d3de
FixA: tab output ist now grouped by km and periods. Fixes flys/issue1163
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4736
diff
changeset
|
131 } |
47e5bc64d3de
FixA: tab output ist now grouped by km and periods. Fixes flys/issue1163
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4736
diff
changeset
|
132 |
9082 | 133 final String kmS = kmF.format(kmEntry.getKm()); |
134 for (final QWD qwd : kmEntry.getValue()) { | |
135 final String deltaWS = dwF.format(qwd.getDeltaW()); | |
136 final String qS = qF.format(qwd.getQ()); | |
137 final String wS = wF.format(qwd.getW()); | |
138 final String dateS = dF.format(qwd.getDate()); | |
3216
a46910e61dfb
FixA: Moved DeltaWtExporter to fixings exporter package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
139 |
9082 | 140 list.add(new String[] { kmS, dateS, qS, wS, referenceS, deltaWS }); |
5603
47e5bc64d3de
FixA: tab output ist now grouped by km and periods. Fixes flys/issue1163
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4736
diff
changeset
|
141 } |
3216
a46910e61dfb
FixA: Moved DeltaWtExporter to fixings exporter package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
142 } |
a46910e61dfb
FixA: Moved DeltaWtExporter to fixings exporter package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
143 } |
a46910e61dfb
FixA: Moved DeltaWtExporter to fixings exporter package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
144 |
a46910e61dfb
FixA: Moved DeltaWtExporter to fixings exporter package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
145 if (debug) { |
9082 | 146 log.debug("AnalysisPeriods: " + this.analysisPeriods.size()); |
3216
a46910e61dfb
FixA: Moved DeltaWtExporter to fixings exporter package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
147 } |
a46910e61dfb
FixA: Moved DeltaWtExporter to fixings exporter package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
148 |
9082 | 149 final String analysisTemplate = getAnalysisTemplate(); |
3216
a46910e61dfb
FixA: Moved DeltaWtExporter to fixings exporter package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
150 |
9082 | 151 for (final KMIndex<AnalysisPeriod[]> periods : this.analysisPeriods) { |
4736
b195fede1c3b
Remove trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4238
diff
changeset
|
152 |
9082 | 153 for (final KMIndex.Entry<AnalysisPeriod[]> kmEntry : periods) { |
5603
47e5bc64d3de
FixA: tab output ist now grouped by km and periods. Fixes flys/issue1163
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4736
diff
changeset
|
154 |
9082 | 155 final Double km = kmEntry.getKm(); |
156 | |
157 ArrayList<String[]> list = sorted.get(km); | |
5603
47e5bc64d3de
FixA: tab output ist now grouped by km and periods. Fixes flys/issue1163
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4736
diff
changeset
|
158 |
47e5bc64d3de
FixA: tab output ist now grouped by km and periods. Fixes flys/issue1163
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4736
diff
changeset
|
159 if (list == null) { |
9082 | 160 list = new ArrayList<>(); |
5603
47e5bc64d3de
FixA: tab output ist now grouped by km and periods. Fixes flys/issue1163
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4736
diff
changeset
|
161 sorted.put(km, list); |
47e5bc64d3de
FixA: tab output ist now grouped by km and periods. Fixes flys/issue1163
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4736
diff
changeset
|
162 } |
47e5bc64d3de
FixA: tab output ist now grouped by km and periods. Fixes flys/issue1163
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4736
diff
changeset
|
163 |
9082 | 164 final String kmS = kmF.format(kmEntry.getKm()); |
4238
50273de4cf63
flys/issue825/2 Fix labeling of Analysisperiods (like A1, A2....)
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3915
diff
changeset
|
165 int analysisCount = 1; |
3216
a46910e61dfb
FixA: Moved DeltaWtExporter to fixings exporter package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
166 |
9082 | 167 for (final AnalysisPeriod period : kmEntry.getValue()) { |
4238
50273de4cf63
flys/issue825/2 Fix labeling of Analysisperiods (like A1, A2....)
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3915
diff
changeset
|
168 // Typically resulting in A1,A2... |
9082 | 169 final String analyisS = MessageFormat.format(analysisTemplate, analysisCount); |
170 final QWD[] qwds = period.getQWDs(); | |
3644
fa633f6a5fd9
smaller part of issue825 fixed (column ordering of dwt-export).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3415
diff
changeset
|
171 |
3216
a46910e61dfb
FixA: Moved DeltaWtExporter to fixings exporter package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
172 if (qwds != null) { |
9082 | 173 for (final QWD qwd : qwds) { |
174 final String deltaWS = dwF.format(qwd.getDeltaW()); | |
175 final String qS = qF.format(qwd.getQ()); | |
176 final String wS = wF.format(qwd.getW()); | |
177 final String dateS = dF.format(qwd.getDate()); | |
3216
a46910e61dfb
FixA: Moved DeltaWtExporter to fixings exporter package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
178 |
9082 | 179 list.add(new String[] { kmS, dateS, qS, wS, analyisS, deltaWS }); |
3216
a46910e61dfb
FixA: Moved DeltaWtExporter to fixings exporter package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
180 } |
a46910e61dfb
FixA: Moved DeltaWtExporter to fixings exporter package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
181 } |
4238
50273de4cf63
flys/issue825/2 Fix labeling of Analysisperiods (like A1, A2....)
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3915
diff
changeset
|
182 ++analysisCount; |
3216
a46910e61dfb
FixA: Moved DeltaWtExporter to fixings exporter package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
183 } |
a46910e61dfb
FixA: Moved DeltaWtExporter to fixings exporter package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
184 } |
a46910e61dfb
FixA: Moved DeltaWtExporter to fixings exporter package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
185 } |
5603
47e5bc64d3de
FixA: tab output ist now grouped by km and periods. Fixes flys/issue1163
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4736
diff
changeset
|
186 |
9082 | 187 for (final ArrayList<String[]> list : sorted.values()) { |
188 for (final String[] row : list) { | |
5603
47e5bc64d3de
FixA: tab output ist now grouped by km and periods. Fixes flys/issue1163
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4736
diff
changeset
|
189 writer.writeNext(row); |
47e5bc64d3de
FixA: tab output ist now grouped by km and periods. Fixes flys/issue1163
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4736
diff
changeset
|
190 } |
47e5bc64d3de
FixA: tab output ist now grouped by km and periods. Fixes flys/issue1163
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4736
diff
changeset
|
191 } |
47e5bc64d3de
FixA: tab output ist now grouped by km and periods. Fixes flys/issue1163
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4736
diff
changeset
|
192 |
3216
a46910e61dfb
FixA: Moved DeltaWtExporter to fixings exporter package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
193 writer.flush(); |
a46910e61dfb
FixA: Moved DeltaWtExporter to fixings exporter package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
194 } |
a46910e61dfb
FixA: Moved DeltaWtExporter to fixings exporter package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
195 |
3644
fa633f6a5fd9
smaller part of issue825 fixed (column ordering of dwt-export).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3415
diff
changeset
|
196 /** Template to create "State" strings like A1,A2... */ |
3398
7f9fe694f8d1
FixA: Added time range column to Delta W(t) CSV export.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3397
diff
changeset
|
197 protected String getAnalysisTemplate() { |
9082 | 198 return Resources.getMsg(this.context.getMeta(), CSV_ANALYSIS, DEFAULT_CSV_ANALYSIS); |
3398
7f9fe694f8d1
FixA: Added time range column to Delta W(t) CSV export.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3397
diff
changeset
|
199 } |
7f9fe694f8d1
FixA: Added time range column to Delta W(t) CSV export.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3397
diff
changeset
|
200 |
7f9fe694f8d1
FixA: Added time range column to Delta W(t) CSV export.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3397
diff
changeset
|
201 protected String getReference() { |
9082 | 202 return Resources.getMsg(this.context.getMeta(), CSV_REFERENCE, DEFAULT_CSV_REFERENCE); |
3398
7f9fe694f8d1
FixA: Added time range column to Delta W(t) CSV export.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3397
diff
changeset
|
203 } |
3216
a46910e61dfb
FixA: Moved DeltaWtExporter to fixings exporter package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
204 |
a46910e61dfb
FixA: Moved DeltaWtExporter to fixings exporter package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
205 protected NumberFormat getKMFormatter() { |
9082 | 206 return Formatter.getFixDeltaWKM(this.context); |
3216
a46910e61dfb
FixA: Moved DeltaWtExporter to fixings exporter package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
207 } |
a46910e61dfb
FixA: Moved DeltaWtExporter to fixings exporter package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
208 |
a46910e61dfb
FixA: Moved DeltaWtExporter to fixings exporter package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
209 protected NumberFormat getDeltaWFormatter() { |
9082 | 210 return Formatter.getFixDeltaWDeltaW(this.context); |
3216
a46910e61dfb
FixA: Moved DeltaWtExporter to fixings exporter package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
211 } |
a46910e61dfb
FixA: Moved DeltaWtExporter to fixings exporter package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
212 |
9082 | 213 @Override |
3397
6d1740533810
FixA: Added discharge column to DeltaW(t) CSV export.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3217
diff
changeset
|
214 protected NumberFormat getQFormatter() { |
9082 | 215 return Formatter.getFixDeltaWQ(this.context); |
3397
6d1740533810
FixA: Added discharge column to DeltaW(t) CSV export.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3217
diff
changeset
|
216 } |
6d1740533810
FixA: Added discharge column to DeltaW(t) CSV export.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3217
diff
changeset
|
217 |
9082 | 218 @Override |
3402
0336132ec9db
Adjusted Delta W(t) CSV exporter to customers wishes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3398
diff
changeset
|
219 protected NumberFormat getWFormatter() { |
9082 | 220 return Formatter.getFixDeltaWW(this.context); |
3402
0336132ec9db
Adjusted Delta W(t) CSV exporter to customers wishes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3398
diff
changeset
|
221 } |
0336132ec9db
Adjusted Delta W(t) CSV exporter to customers wishes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3398
diff
changeset
|
222 |
0336132ec9db
Adjusted Delta W(t) CSV exporter to customers wishes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3398
diff
changeset
|
223 protected DateFormat getDateFormatter() { |
9082 | 224 final CallMeta meta = this.context.getMeta(); |
225 return Formatter.getDateFormatter(meta, Resources.getMsg(meta, CSV_T_FORMAT, DEFAULT_CSV_T_FORMAT)); | |
3402
0336132ec9db
Adjusted Delta W(t) CSV exporter to customers wishes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3398
diff
changeset
|
226 } |
0336132ec9db
Adjusted Delta W(t) CSV exporter to customers wishes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3398
diff
changeset
|
227 |
9082 | 228 protected void writeCSVHeader(final CSVWriter writer) { |
3216
a46910e61dfb
FixA: Moved DeltaWtExporter to fixings exporter package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
229 log.debug("DeltaWtExporter.writeCSVHeader"); |
a46910e61dfb
FixA: Moved DeltaWtExporter to fixings exporter package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
230 |
9082 | 231 /* |
232 * issue825 | |
233 * km; Ereignis, Abfluss, GEMESSENER Wasserstand; | |
234 * Status (RECHTSBÜNDIG), del W | |
235 */ | |
236 final RiverAccess river = new RiverAccess((D4EArtifact) this.master); | |
237 final String unit = river.getRiver().getWstUnit().getName(); | |
3644
fa633f6a5fd9
smaller part of issue825 fixed (column ordering of dwt-export).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3415
diff
changeset
|
238 |
9082 | 239 writer.writeNext(new String[] { msg(CSV_KM_HEADER, DEFAULT_CSV_KM_HEADER), msg(CSV_T_HEADER, DEFAULT_CSV_T_HEADER), |
240 msg(CSV_Q_HEADER, DEFAULT_CSV_Q_HEADER), msg(CSV_W_HEADER, DEFAULT_CSV_W_HEADER, new Object[] { unit }), | |
241 msg(CSV_TRANGE_HEADER, DEFAULT_CSV_TRANGE_DESC_HEADER), msg(CSV_DELTA_W_HEADER, DEFAULT_CSV_DELTA_W_HEADER) }); | |
3216
a46910e61dfb
FixA: Moved DeltaWtExporter to fixings exporter package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
242 } |
a46910e61dfb
FixA: Moved DeltaWtExporter to fixings exporter package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
243 |
a46910e61dfb
FixA: Moved DeltaWtExporter to fixings exporter package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
244 @Override |
9082 | 245 protected void writePDF(final OutputStream out) { |
3216
a46910e61dfb
FixA: Moved DeltaWtExporter to fixings exporter package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
246 // TODO: Implement me! |
9082 | 247 // wird doch NICHT erledigt vom WaterlevelExporter |
3216
a46910e61dfb
FixA: Moved DeltaWtExporter to fixings exporter package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
248 } |
a46910e61dfb
FixA: Moved DeltaWtExporter to fixings exporter package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
249 } |
a46910e61dfb
FixA: Moved DeltaWtExporter to fixings exporter package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
250 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |