annotate backend/src/main/java/org/dive4elements/river/importer/parsers/SedimentLoadParser.java @ 8412:17db08570637

SCHEMA CHANGE: removed superfluous columns station and river_id from measurement_stations and adapted other components accordingly.
author Tom Gottfried <tom@intevation.de>
date Wed, 15 Oct 2014 19:20:26 +0200
parents 3ae11daff343
children 9db1f48bfea9
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 MEASUREMENT_TYPE_BEDLOAD = "Geschiebe";
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 MEASUREMENT_TYPE_SUSP = "Schwebstoff";
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 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
36
d86cc6a17b7a Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
37 public static final String GRAINFRACTION_NAME_TOTAL = "total";
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 protected List<ImportSedimentLoad> sedimentLoads;
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 protected ImportSedimentLoad[] current;
d86cc6a17b7a Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
42
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
43 protected River river;
8056
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 SedimentLoadParser() {
d86cc6a17b7a Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
46 sedimentLoads = new ArrayList<ImportSedimentLoad>();
d86cc6a17b7a Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
47 }
d86cc6a17b7a Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
48
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
49 public SedimentLoadParser(River river) {
8056
d86cc6a17b7a Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
50 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
51 this.river = river;
8056
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
d86cc6a17b7a Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
54
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 @Override
d86cc6a17b7a Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
57 protected void reset() {
d86cc6a17b7a Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
58 current = null;
d86cc6a17b7a Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
59 grainFraction = null;
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 @Override
d86cc6a17b7a Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
64 protected void finish() {
d86cc6a17b7a Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
65 if (current != null) {
d86cc6a17b7a Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
66 for (ImportSedimentLoad isy: current) {
d86cc6a17b7a Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
67 sedimentLoads.add(isy);
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 description = null;
d86cc6a17b7a Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
72 }
d86cc6a17b7a Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
73
d86cc6a17b7a Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
74
d86cc6a17b7a Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
75 @Override
d86cc6a17b7a Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
76 protected void handleMetaLine(String line) throws LineParserException {
d86cc6a17b7a Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
77 if (handleMetaFraction(line)) {
d86cc6a17b7a Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
78 return;
d86cc6a17b7a Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
79 }
d86cc6a17b7a Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
80 if (handleMetaFractionName(line)) {
d86cc6a17b7a Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
81 return;
d86cc6a17b7a Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
82 }
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
83 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
84 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
85 }
8056
d86cc6a17b7a Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
86 if (handleColumnNames(line)) {
d86cc6a17b7a Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
87 return;
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 log.warn("ASLP: Unknown meta line: '" + line + "'");
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
d86cc6a17b7a Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
92
d86cc6a17b7a Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
93 private void initializeSedimentLoadValues(String[] vals,
d86cc6a17b7a Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
94 MeasurementStation m) throws ParseException {
d86cc6a17b7a Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
95 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
96 String curVal = vals[i];
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 if (curVal != null && curVal.length() > 0) {
d86cc6a17b7a Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
99 current[i-1].addValue(new ImportSedimentLoadValue(
d86cc6a17b7a Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
100 m, nf.parse(curVal).doubleValue()
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 }
d86cc6a17b7a Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
103 }
d86cc6a17b7a Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
104 }
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 @Override
d86cc6a17b7a Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
107 protected void handleDataLine(String line) {
d86cc6a17b7a Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
108 String[] vals = line.split(SEPERATOR_CHAR);
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 if (vals == null || vals.length < columnNames.length-1) {
d86cc6a17b7a Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
111 log.warn("SLP: skip invalid data line: '" + line + "'");
d86cc6a17b7a Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
112 return;
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
d86cc6a17b7a Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
115 try {
d86cc6a17b7a Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
116 Double km = nf.parse(vals[0]).doubleValue();
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 List<MeasurementStation> ms =
d86cc6a17b7a Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
119 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
120 river, km);
8056
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 String gfn = grainFraction.getPeer().getName();
d86cc6a17b7a Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
123
d86cc6a17b7a Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
124 if (ms != null && !ms.isEmpty()) {
d86cc6a17b7a Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
125
d86cc6a17b7a Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
126 // 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
127 for (MeasurementStation m : ms) {
d86cc6a17b7a Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
128 if (gfn.equals(GRAINFRACTION_NAME_TOTAL)) {
d86cc6a17b7a Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
129 // total load can be at any station type
d86cc6a17b7a Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
130 initializeSedimentLoadValues(vals, m);
d86cc6a17b7a Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
131 return;
d86cc6a17b7a Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
132 }
d86cc6a17b7a Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
133 if (gfn.equals(GRAINFRACTION_NAME_SUSP) &&
d86cc6a17b7a Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
134 m.getMeasurementType().equals(MEASUREMENT_TYPE_SUSP)) {
d86cc6a17b7a Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
135 // susp. sediment can only be at respective stations
d86cc6a17b7a Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
136 initializeSedimentLoadValues(vals, m);
d86cc6a17b7a Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
137 return;
d86cc6a17b7a Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
138 }
d86cc6a17b7a Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
139 if (!gfn.equals(GRAINFRACTION_NAME_SUSP) &&
d86cc6a17b7a Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
140 m.getMeasurementType().equals(MEASUREMENT_TYPE_BEDLOAD)) {
d86cc6a17b7a Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
141 /** anything but total load and susp. sediment
d86cc6a17b7a Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
142 can only be at bed load measurement stations */
d86cc6a17b7a Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
143 initializeSedimentLoadValues(vals, m);
d86cc6a17b7a Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
144 return;
d86cc6a17b7a Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
145 }
d86cc6a17b7a Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
146 }
d86cc6a17b7a Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
147 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
148 " 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
149 " on river " + river.getName());
8056
d86cc6a17b7a Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
150 return;
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 else {
d86cc6a17b7a Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
153 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
154 " on river " + river.getName());
8056
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 }
d86cc6a17b7a Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
158 catch (ParseException pe) {
d86cc6a17b7a Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
159 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
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
d86cc6a17b7a Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
163
d86cc6a17b7a Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
164 @Override
d86cc6a17b7a Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
165 protected void initializeSedimentLoads() {
d86cc6a17b7a Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
166 // 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
167 current = new ImportSedimentLoad[columnNames.length-2];
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 Integer kind;
d86cc6a17b7a Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
170
d86cc6a17b7a Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
171 if (inputFile.getAbsolutePath().contains("amtliche Epochen")) {
d86cc6a17b7a Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
172 kind = new Integer(1);
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 else {
d86cc6a17b7a Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
175 kind = new Integer(0);
d86cc6a17b7a Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
176 }
d86cc6a17b7a Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
177
d86cc6a17b7a Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
178 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
179 current[i] = new ImportSedimentLoad(
d86cc6a17b7a Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
180 grainFraction,
d86cc6a17b7a Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
181 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
182 sqTimeInterval,
8056
d86cc6a17b7a Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
183 description,
d86cc6a17b7a Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
184 kind);
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
d86cc6a17b7a Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
188
d86cc6a17b7a Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
189 public List<ImportSedimentLoad> getSedimentLoads() {
d86cc6a17b7a Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
190 return sedimentLoads;
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 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org