Mercurial > dive4elements > river
annotate backend/src/main/java/org/dive4elements/river/importer/parsers/SedimentLoadParser.java @ 8056:d86cc6a17b7a
Importer: Import sediment load at measurement stations.
author | Tom Gottfried <tom@intevation.de> |
---|---|
date | Fri, 18 Jul 2014 15:37:26 +0200 |
parents | |
children | bde5f5ec7c72 |
rev | line source |
---|---|
8056
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
1 /* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
2 * Software engineering by Intevation GmbH |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
3 * |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
4 * This file is Free Software under the GNU AGPL (>=v3) |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
5 * and comes with ABSOLUTELY NO WARRANTY! Check out the |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
6 * documentation coming with Dive4Elements River for details. |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
7 */ |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
8 |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
9 package org.dive4elements.river.importer.parsers; |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
10 |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
11 import java.io.File; |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
12 import java.io.IOException; |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
13 |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
14 import java.text.NumberFormat; |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
15 import java.text.ParseException; |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
16 |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
17 import java.util.ArrayList; |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
18 import java.util.List; |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
19 |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
20 import org.apache.log4j.Logger; |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
21 |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
22 import org.dive4elements.river.importer.ImporterSession; |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
23 import org.dive4elements.river.importer.ImportRiver; |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
24 import org.dive4elements.river.importer.ImportGrainFraction; |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
25 import org.dive4elements.river.importer.ImportSedimentLoad; |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
26 import org.dive4elements.river.importer.ImportSedimentLoadValue; |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
27 import org.dive4elements.river.importer.ImportTimeInterval; |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
28 import org.dive4elements.river.importer.ImportMeasurementStation; |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
29 |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
30 import org.dive4elements.river.model.GrainFraction; |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
31 import org.dive4elements.river.model.MeasurementStation; |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
32 |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
33 /** Parses sediment load longitudinal section files. */ |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
34 public class SedimentLoadParser extends AbstractSedimentLoadParser { |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
35 private static final Logger log = |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
36 Logger.getLogger(SedimentLoadParser.class); |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
37 |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
38 |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
39 public static final String MEASUREMENT_TYPE_BEDLOAD = "Geschiebe"; |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
40 |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
41 public static final String MEASUREMENT_TYPE_SUSP = "Schwebstoff"; |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
42 |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
43 public static final String GRAINFRACTION_NAME_SUSP = "suspended_sediment"; |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
44 |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
45 public static final String GRAINFRACTION_NAME_TOTAL = "total"; |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
46 |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
47 protected List<ImportSedimentLoad> sedimentLoads; |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
48 |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
49 protected ImportSedimentLoad[] current; |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
50 |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
51 protected String rivername; |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
52 |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
53 public SedimentLoadParser() { |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
54 sedimentLoads = new ArrayList<ImportSedimentLoad>(); |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
55 } |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
56 |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
57 public SedimentLoadParser(String rivername) { |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
58 sedimentLoads = new ArrayList<ImportSedimentLoad>(); |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
59 this.rivername = rivername; |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
60 } |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
61 |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
62 |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
63 |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
64 @Override |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
65 protected void reset() { |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
66 current = null; |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
67 grainFraction = null; |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
68 } |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
69 |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
70 |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
71 @Override |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
72 protected void finish() { |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
73 if (current != null) { |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
74 for (ImportSedimentLoad isy: current) { |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
75 sedimentLoads.add(isy); |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
76 } |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
77 } |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
78 |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
79 description = null; |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
80 } |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
81 |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
82 |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
83 @Override |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
84 protected void handleMetaLine(String line) throws LineParserException { |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
85 if (handleMetaFraction(line)) { |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
86 return; |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
87 } |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
88 if (handleMetaFractionName(line)) { |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
89 return; |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
90 } |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
91 if (handleColumnNames(line)) { |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
92 return; |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
93 } |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
94 log.warn("ASLP: Unknown meta line: '" + line + "'"); |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
95 } |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
96 |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
97 |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
98 private void initializeSedimentLoadValues(String[] vals, |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
99 MeasurementStation m) throws ParseException { |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
100 for (int i = 1, n = columnNames.length-1; i < n; i++) { |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
101 String curVal = vals[i]; |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
102 |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
103 if (curVal != null && curVal.length() > 0) { |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
104 current[i-1].addValue(new ImportSedimentLoadValue( |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
105 m, nf.parse(curVal).doubleValue() |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
106 )); |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
107 } |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
108 } |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
109 } |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
110 |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
111 @Override |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
112 protected void handleDataLine(String line) { |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
113 String[] vals = line.split(SEPERATOR_CHAR); |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
114 |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
115 if (vals == null || vals.length < columnNames.length-1) { |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
116 log.warn("SLP: skip invalid data line: '" + line + "'"); |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
117 return; |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
118 } |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
119 |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
120 try { |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
121 Double km = nf.parse(vals[0]).doubleValue(); |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
122 |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
123 List<MeasurementStation> ms = |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
124 ImporterSession.getInstance().getMeasurementStations( |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
125 rivername, km); |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
126 |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
127 String gfn = grainFraction.getPeer().getName(); |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
128 |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
129 if (ms != null && !ms.isEmpty()) { |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
130 |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
131 // Check for measurement station at km fitting grain fraction |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
132 for (MeasurementStation m : ms) { |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
133 if (gfn.equals(GRAINFRACTION_NAME_TOTAL)) { |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
134 // total load can be at any station type |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
135 initializeSedimentLoadValues(vals, m); |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
136 return; |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
137 } |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
138 if (gfn.equals(GRAINFRACTION_NAME_SUSP) && |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
139 m.getMeasurementType().equals(MEASUREMENT_TYPE_SUSP)) { |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
140 // susp. sediment can only be at respective stations |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
141 initializeSedimentLoadValues(vals, m); |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
142 return; |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
143 } |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
144 if (!gfn.equals(GRAINFRACTION_NAME_SUSP) && |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
145 m.getMeasurementType().equals(MEASUREMENT_TYPE_BEDLOAD)) { |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
146 /** anything but total load and susp. sediment |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
147 can only be at bed load measurement stations */ |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
148 initializeSedimentLoadValues(vals, m); |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
149 return; |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
150 } |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
151 } |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
152 log.error("SLP: No measurement station at km " + km + |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
153 " fitting grain fraction " + gfn + |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
154 " on river " + rivername); |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
155 return; |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
156 } |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
157 else { |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
158 log.error("SLP: No measurement station at km " + km + |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
159 " on river " + rivername); |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
160 return; |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
161 } |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
162 } |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
163 catch (ParseException pe) { |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
164 log.warn("SLP: unparseable number in data row '" + line + "':", pe); |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
165 } |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
166 } |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
167 |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
168 |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
169 @Override |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
170 protected void initializeSedimentLoads() { |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
171 // skip first column (Fluss-km) and last column (Hinweise) |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
172 current = new ImportSedimentLoad[columnNames.length-2]; |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
173 |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
174 Integer kind; |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
175 |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
176 if (inputFile.getAbsolutePath().contains("amtliche Epochen")) { |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
177 kind = new Integer(1); |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
178 } |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
179 else { |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
180 kind = new Integer(0); |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
181 } |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
182 |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
183 for (int i = 0, n = columnNames.length; i < n-2; i++) { |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
184 current[i] = new ImportSedimentLoad( |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
185 grainFraction, |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
186 getTimeInterval(columnNames[i+1]), |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
187 description, |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
188 kind); |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
189 } |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
190 } |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
191 |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
192 |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
193 public List<ImportSedimentLoad> getSedimentLoads() { |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
194 return sedimentLoads; |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
195 } |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
196 } |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
197 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |