Mercurial > dive4elements > river
annotate backend/src/main/java/org/dive4elements/river/importer/parsers/SedimentLoadParser.java @ 8856:5e38e2924c07 3.2.x
Fix code style.
author | Tom Gottfried <tom@intevation.de> |
---|---|
date | Thu, 18 Jan 2018 20:12:01 +0100 |
parents | 8fbc0649da13 |
children | 0a5239a1e46e |
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.text.ParseException; |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
12 |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
13 import java.util.ArrayList; |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
14 import java.util.List; |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
15 |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
16 import org.apache.log4j.Logger; |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
17 |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
18 import org.dive4elements.river.importer.ImporterSession; |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
19 import org.dive4elements.river.importer.ImportSedimentLoad; |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
20 import org.dive4elements.river.importer.ImportSedimentLoadValue; |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
21 |
8412
17db08570637
SCHEMA CHANGE: removed superfluous columns station and river_id from measurement_stations and adapted other components accordingly.
Tom Gottfried <tom@intevation.de>
parents:
8081
diff
changeset
|
22 import org.dive4elements.river.model.River; |
8056
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
23 import org.dive4elements.river.model.MeasurementStation; |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
24 |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
25 /** Parses sediment load longitudinal section files. */ |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
26 public class SedimentLoadParser extends AbstractSedimentLoadParser { |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
27 private static final Logger log = |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
28 Logger.getLogger(SedimentLoadParser.class); |
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 |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
31 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
|
32 |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
33 public static final String GRAINFRACTION_NAME_TOTAL = "total"; |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
34 |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
35 protected List<ImportSedimentLoad> sedimentLoads; |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
36 |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
37 protected ImportSedimentLoad[] current; |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
38 |
8412
17db08570637
SCHEMA CHANGE: removed superfluous columns station and river_id from measurement_stations and adapted other components accordingly.
Tom Gottfried <tom@intevation.de>
parents:
8081
diff
changeset
|
39 protected River river; |
8056
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 SedimentLoadParser() { |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
42 sedimentLoads = new ArrayList<ImportSedimentLoad>(); |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
43 } |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
44 |
8412
17db08570637
SCHEMA CHANGE: removed superfluous columns station and river_id from measurement_stations and adapted other components accordingly.
Tom Gottfried <tom@intevation.de>
parents:
8081
diff
changeset
|
45 public SedimentLoadParser(River river) { |
8056
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
46 sedimentLoads = new ArrayList<ImportSedimentLoad>(); |
8412
17db08570637
SCHEMA CHANGE: removed superfluous columns station and river_id from measurement_stations and adapted other components accordingly.
Tom Gottfried <tom@intevation.de>
parents:
8081
diff
changeset
|
47 this.river = river; |
8056
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 |
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 |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
52 @Override |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
53 protected void reset() { |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
54 current = null; |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
55 grainFraction = null; |
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 |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
58 |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
59 @Override |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
60 protected void finish() { |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
61 if (current != null) { |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
62 for (ImportSedimentLoad isy: current) { |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
63 sedimentLoads.add(isy); |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
64 } |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
65 } |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
66 |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
67 description = 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 handleMetaLine(String line) throws LineParserException { |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
73 if (handleMetaFraction(line)) { |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
74 return; |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
75 } |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
76 if (handleMetaFractionName(line)) { |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
77 return; |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
78 } |
8059
bde5f5ec7c72
SCHEMA CHANGE and Importer: get time intervals of SQ-relations from metalines in sediment load files.
Tom Gottfried <tom@intevation.de>
parents:
8056
diff
changeset
|
79 if (handleMetaSQTimeInterval(line)) { |
bde5f5ec7c72
SCHEMA CHANGE and Importer: get time intervals of SQ-relations from metalines in sediment load files.
Tom Gottfried <tom@intevation.de>
parents:
8056
diff
changeset
|
80 return; |
bde5f5ec7c72
SCHEMA CHANGE and Importer: get time intervals of SQ-relations from metalines in sediment load files.
Tom Gottfried <tom@intevation.de>
parents:
8056
diff
changeset
|
81 } |
8056
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
82 if (handleColumnNames(line)) { |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
83 return; |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
84 } |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
85 log.warn("ASLP: Unknown meta line: '" + line + "'"); |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
86 } |
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 |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
89 private void initializeSedimentLoadValues(String[] vals, |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
90 MeasurementStation m) throws ParseException { |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
91 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
|
92 String curVal = vals[i]; |
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 if (curVal != null && curVal.length() > 0) { |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
95 current[i-1].addValue(new ImportSedimentLoadValue( |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
96 m, nf.parse(curVal).doubleValue() |
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 } |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
99 } |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
100 } |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
101 |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
102 @Override |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
103 protected void handleDataLine(String line) { |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
104 String[] vals = line.split(SEPERATOR_CHAR); |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
105 |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
106 if (vals == null || vals.length < columnNames.length-1) { |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
107 log.warn("SLP: skip invalid data line: '" + line + "'"); |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
108 return; |
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 try { |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
112 Double km = nf.parse(vals[0]).doubleValue(); |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
113 |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
114 List<MeasurementStation> ms = |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
115 ImporterSession.getInstance().getMeasurementStations( |
8412
17db08570637
SCHEMA CHANGE: removed superfluous columns station and river_id from measurement_stations and adapted other components accordingly.
Tom Gottfried <tom@intevation.de>
parents:
8081
diff
changeset
|
116 river, km); |
8056
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
117 |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
118 String gfn = grainFraction.getPeer().getName(); |
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 if (ms != null && !ms.isEmpty()) { |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
121 |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
122 // 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
|
123 for (MeasurementStation m : ms) { |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
124 if (gfn.equals(GRAINFRACTION_NAME_TOTAL)) { |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
125 // total load can be at any station type |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
126 initializeSedimentLoadValues(vals, m); |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
127 return; |
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 (gfn.equals(GRAINFRACTION_NAME_SUSP) && |
8665
8fbc0649da13
Move static measurement types to their natural home.
Tom Gottfried <tom@intevation.de>
parents:
8642
diff
changeset
|
130 m.getMeasurementType().equals( |
8fbc0649da13
Move static measurement types to their natural home.
Tom Gottfried <tom@intevation.de>
parents:
8642
diff
changeset
|
131 MeasurementStation.MEASUREMENT_TYPE_SUSP)) { |
8056
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
132 // susp. sediment can only be at respective stations |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
133 initializeSedimentLoadValues(vals, m); |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
134 return; |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
135 } |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
136 if (!gfn.equals(GRAINFRACTION_NAME_SUSP) && |
8665
8fbc0649da13
Move static measurement types to their natural home.
Tom Gottfried <tom@intevation.de>
parents:
8642
diff
changeset
|
137 m.getMeasurementType().equals( |
8fbc0649da13
Move static measurement types to their natural home.
Tom Gottfried <tom@intevation.de>
parents:
8642
diff
changeset
|
138 MeasurementStation.MEASUREMENT_TYPE_BEDLOAD)) { |
8056
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
139 /** anything but total load and susp. sediment |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
140 can only be at bed load measurement 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 } |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
145 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
|
146 " fitting grain fraction " + gfn + |
8412
17db08570637
SCHEMA CHANGE: removed superfluous columns station and river_id from measurement_stations and adapted other components accordingly.
Tom Gottfried <tom@intevation.de>
parents:
8081
diff
changeset
|
147 " on river " + river.getName()); |
8056
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
148 return; |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
149 } |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
150 else { |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
151 log.error("SLP: No measurement station at km " + km + |
8412
17db08570637
SCHEMA CHANGE: removed superfluous columns station and river_id from measurement_stations and adapted other components accordingly.
Tom Gottfried <tom@intevation.de>
parents:
8081
diff
changeset
|
152 " on river " + river.getName()); |
8056
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
153 return; |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
154 } |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
155 } |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
156 catch (ParseException pe) { |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
157 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
|
158 } |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
159 } |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
160 |
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 @Override |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
163 protected void initializeSedimentLoads() { |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
164 // 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
|
165 current = new ImportSedimentLoad[columnNames.length-2]; |
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 Integer kind; |
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 if (inputFile.getAbsolutePath().contains("amtliche Epochen")) { |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
170 kind = new Integer(1); |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
171 } |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
172 else { |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
173 kind = new Integer(0); |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
174 } |
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 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
|
177 current[i] = new ImportSedimentLoad( |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
178 grainFraction, |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
179 getTimeInterval(columnNames[i+1]), |
8059
bde5f5ec7c72
SCHEMA CHANGE and Importer: get time intervals of SQ-relations from metalines in sediment load files.
Tom Gottfried <tom@intevation.de>
parents:
8056
diff
changeset
|
180 sqTimeInterval, |
8056
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
181 description, |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
182 kind); |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
183 } |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
184 } |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
185 |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
186 |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
187 public List<ImportSedimentLoad> getSedimentLoads() { |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
188 return sedimentLoads; |
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 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |