Mercurial > dive4elements > river
annotate backend/src/main/java/org/dive4elements/river/importer/parsers/SedimentLoadLSParser.java @ 8081:3ae11daff343
Removed obsolete imports.
author | Sascha L. Teichmann <teichmann@intevation.de> |
---|---|
date | Mon, 11 Aug 2014 16:41:15 +0200 |
parents | bde5f5ec7c72 |
children | 5e38e2924c07 |
rev | line source |
---|---|
8025
c915e99d9e52
Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
1 /* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde |
c915e99d9e52
Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
2 * Software engineering by Intevation GmbH |
c915e99d9e52
Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
3 * |
c915e99d9e52
Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
4 * This file is Free Software under the GNU AGPL (>=v3) |
c915e99d9e52
Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
5 * and comes with ABSOLUTELY NO WARRANTY! Check out the |
c915e99d9e52
Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
6 * documentation coming with Dive4Elements River for details. |
c915e99d9e52
Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
7 */ |
c915e99d9e52
Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
8 |
c915e99d9e52
Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
9 package org.dive4elements.river.importer.parsers; |
c915e99d9e52
Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
10 |
c915e99d9e52
Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
11 import java.text.ParseException; |
c915e99d9e52
Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
12 |
c915e99d9e52
Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
13 import java.util.ArrayList; |
c915e99d9e52
Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
14 import java.util.List; |
8056
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
8043
diff
changeset
|
15 import java.util.regex.Matcher; |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
8043
diff
changeset
|
16 import java.util.regex.Pattern; |
8025
c915e99d9e52
Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
17 |
c915e99d9e52
Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
18 import org.apache.log4j.Logger; |
c915e99d9e52
Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
19 |
8031
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8025
diff
changeset
|
20 import org.dive4elements.river.importer.ImportSedimentLoadLS; |
8025
c915e99d9e52
Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
21 import org.dive4elements.river.importer.ImportSedimentLoadLSValue; |
c915e99d9e52
Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
22 import org.dive4elements.river.importer.ImportUnit; |
8032
fd3a24336e6a
SCHEMA CHANGE and Importer (only longitudinal section data so far): only grain fractions given now in schema are valid. We are handling sediment loads, not yields.
"Tom Gottfried <tom@intevation.de>"
parents:
8031
diff
changeset
|
23 |
fd3a24336e6a
SCHEMA CHANGE and Importer (only longitudinal section data so far): only grain fractions given now in schema are valid. We are handling sediment loads, not yields.
"Tom Gottfried <tom@intevation.de>"
parents:
8031
diff
changeset
|
24 |
fd3a24336e6a
SCHEMA CHANGE and Importer (only longitudinal section data so far): only grain fractions given now in schema are valid. We are handling sediment loads, not yields.
"Tom Gottfried <tom@intevation.de>"
parents:
8031
diff
changeset
|
25 /** Parses sediment load longitudinal section files. */ |
8043
bd0dea643440
Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
8042
diff
changeset
|
26 public class SedimentLoadLSParser extends AbstractSedimentLoadParser { |
8025
c915e99d9e52
Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
27 |
c915e99d9e52
Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
28 private static final Logger log = |
c915e99d9e52
Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
29 Logger.getLogger(SedimentLoadLSParser.class); |
c915e99d9e52
Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
30 |
c915e99d9e52
Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
31 |
8056
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
8043
diff
changeset
|
32 public static final Pattern META_UNIT = |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
8043
diff
changeset
|
33 Pattern.compile("^Einheit: \\[(.*)\\].*"); |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
8043
diff
changeset
|
34 |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
8043
diff
changeset
|
35 |
8032
fd3a24336e6a
SCHEMA CHANGE and Importer (only longitudinal section data so far): only grain fractions given now in schema are valid. We are handling sediment loads, not yields.
"Tom Gottfried <tom@intevation.de>"
parents:
8031
diff
changeset
|
36 protected List<ImportSedimentLoadLS> sedimentLoadLSs; |
8025
c915e99d9e52
Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
37 |
8031
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8025
diff
changeset
|
38 protected ImportSedimentLoadLS[] current; |
8025
c915e99d9e52
Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
39 |
8056
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
8043
diff
changeset
|
40 protected ImportUnit unit; |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
8043
diff
changeset
|
41 |
8025
c915e99d9e52
Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
42 |
c915e99d9e52
Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
43 public SedimentLoadLSParser() { |
8032
fd3a24336e6a
SCHEMA CHANGE and Importer (only longitudinal section data so far): only grain fractions given now in schema are valid. We are handling sediment loads, not yields.
"Tom Gottfried <tom@intevation.de>"
parents:
8031
diff
changeset
|
44 sedimentLoadLSs = new ArrayList<ImportSedimentLoadLS>(); |
8025
c915e99d9e52
Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
45 } |
c915e99d9e52
Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
46 |
c915e99d9e52
Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
47 |
c915e99d9e52
Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
48 @Override |
c915e99d9e52
Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
49 protected void reset() { |
c915e99d9e52
Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
50 current = null; |
c915e99d9e52
Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
51 grainFraction = null; |
c915e99d9e52
Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
52 unit = null; |
c915e99d9e52
Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
53 } |
c915e99d9e52
Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
54 |
c915e99d9e52
Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
55 |
c915e99d9e52
Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
56 @Override |
c915e99d9e52
Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
57 protected void finish() { |
c915e99d9e52
Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
58 if (current != null) { |
8031
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8025
diff
changeset
|
59 for (ImportSedimentLoadLS isy: current) { |
8032
fd3a24336e6a
SCHEMA CHANGE and Importer (only longitudinal section data so far): only grain fractions given now in schema are valid. We are handling sediment loads, not yields.
"Tom Gottfried <tom@intevation.de>"
parents:
8031
diff
changeset
|
60 sedimentLoadLSs.add(isy); |
8025
c915e99d9e52
Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
61 } |
c915e99d9e52
Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
62 } |
c915e99d9e52
Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
63 |
c915e99d9e52
Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
64 description = null; |
c915e99d9e52
Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
65 } |
c915e99d9e52
Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
66 |
c915e99d9e52
Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
67 |
c915e99d9e52
Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
68 @Override |
8056
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
8043
diff
changeset
|
69 protected void handleMetaLine(String line) throws LineParserException { |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
8043
diff
changeset
|
70 if (handleMetaUnit(line)) { |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
8043
diff
changeset
|
71 return; |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
8043
diff
changeset
|
72 } |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
8043
diff
changeset
|
73 if (handleMetaFraction(line)) { |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
8043
diff
changeset
|
74 return; |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
8043
diff
changeset
|
75 } |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
8043
diff
changeset
|
76 if (handleMetaFractionName(line)) { |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
8043
diff
changeset
|
77 return; |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
8043
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:
8043
diff
changeset
|
82 if (handleColumnNames(line)) { |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
8043
diff
changeset
|
83 return; |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
8043
diff
changeset
|
84 } |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
8043
diff
changeset
|
85 log.warn("ASLP: Unknown meta line: '" + line + "'"); |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
8043
diff
changeset
|
86 } |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
8043
diff
changeset
|
87 |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
8043
diff
changeset
|
88 |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
8043
diff
changeset
|
89 protected boolean handleMetaUnit(String line) { |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
8043
diff
changeset
|
90 Matcher m = META_UNIT.matcher(line); |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
8043
diff
changeset
|
91 |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
8043
diff
changeset
|
92 if (m.matches()) { |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
8043
diff
changeset
|
93 unit = new ImportUnit(m.group(1)); |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
8043
diff
changeset
|
94 return true; |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
8043
diff
changeset
|
95 } |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
8043
diff
changeset
|
96 |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
8043
diff
changeset
|
97 return false; |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
8043
diff
changeset
|
98 } |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
8043
diff
changeset
|
99 |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
8043
diff
changeset
|
100 |
d86cc6a17b7a
Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
8043
diff
changeset
|
101 @Override |
8025
c915e99d9e52
Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
102 protected void handleDataLine(String line) { |
c915e99d9e52
Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
103 String[] vals = line.split(SEPERATOR_CHAR); |
c915e99d9e52
Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
104 |
c915e99d9e52
Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
105 if (vals == null || vals.length < columnNames.length-1) { |
8032
fd3a24336e6a
SCHEMA CHANGE and Importer (only longitudinal section data so far): only grain fractions given now in schema are valid. We are handling sediment loads, not yields.
"Tom Gottfried <tom@intevation.de>"
parents:
8031
diff
changeset
|
106 log.warn("SLLSP: skip invalid data line: '" + line + "'"); |
8025
c915e99d9e52
Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
107 return; |
c915e99d9e52
Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
108 } |
c915e99d9e52
Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
109 |
c915e99d9e52
Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
110 try { |
c915e99d9e52
Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
111 Double km = nf.parse(vals[0]).doubleValue(); |
c915e99d9e52
Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
112 |
c915e99d9e52
Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
113 for (int i = 1, n = columnNames.length-1; i < n; i++) { |
c915e99d9e52
Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
114 String curVal = vals[i]; |
c915e99d9e52
Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
115 |
c915e99d9e52
Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
116 if (curVal != null && curVal.length() > 0) { |
c915e99d9e52
Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
117 current[i-1].addValue(new ImportSedimentLoadLSValue( |
c915e99d9e52
Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
118 km, nf.parse(vals[i]).doubleValue() |
c915e99d9e52
Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
119 )); |
c915e99d9e52
Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
120 } |
c915e99d9e52
Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
121 } |
c915e99d9e52
Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
122 } |
c915e99d9e52
Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
123 catch (ParseException pe) { |
8032
fd3a24336e6a
SCHEMA CHANGE and Importer (only longitudinal section data so far): only grain fractions given now in schema are valid. We are handling sediment loads, not yields.
"Tom Gottfried <tom@intevation.de>"
parents:
8031
diff
changeset
|
124 log.warn("SLLSP: unparseable number in data row '" + line + "':", pe); |
8025
c915e99d9e52
Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
125 } |
c915e99d9e52
Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
126 } |
c915e99d9e52
Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
127 |
c915e99d9e52
Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
128 |
8043
bd0dea643440
Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
8042
diff
changeset
|
129 @Override |
bd0dea643440
Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
8042
diff
changeset
|
130 protected void initializeSedimentLoads() { |
8025
c915e99d9e52
Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
131 // skip first column (Fluss-km) and last column (Hinweise) |
8031
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8025
diff
changeset
|
132 current = new ImportSedimentLoadLS[columnNames.length-2]; |
8025
c915e99d9e52
Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
133 |
c915e99d9e52
Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
134 Integer kind; |
c915e99d9e52
Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
135 |
c915e99d9e52
Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
136 if (inputFile.getAbsolutePath().contains("amtliche Epochen")) { |
c915e99d9e52
Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
137 kind = new Integer(1); |
c915e99d9e52
Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
138 } |
c915e99d9e52
Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
139 else { |
c915e99d9e52
Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
140 kind = new Integer(0); |
c915e99d9e52
Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
141 } |
c915e99d9e52
Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
142 |
c915e99d9e52
Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
143 for (int i = 0, n = columnNames.length; i < n-2; i++) { |
8031
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8025
diff
changeset
|
144 current[i] = new ImportSedimentLoadLS(this.description); |
8025
c915e99d9e52
Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
145 current[i].setTimeInterval(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
|
146 current[i].setSQTimeInterval(sqTimeInterval); |
8025
c915e99d9e52
Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
147 current[i].setUnit(unit); |
c915e99d9e52
Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
148 current[i].setGrainFraction(grainFraction); |
c915e99d9e52
Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
149 current[i].setKind(kind); |
c915e99d9e52
Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
150 } |
c915e99d9e52
Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
151 } |
c915e99d9e52
Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
152 |
c915e99d9e52
Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
153 |
8032
fd3a24336e6a
SCHEMA CHANGE and Importer (only longitudinal section data so far): only grain fractions given now in schema are valid. We are handling sediment loads, not yields.
"Tom Gottfried <tom@intevation.de>"
parents:
8031
diff
changeset
|
154 public List<ImportSedimentLoadLS> getSedimentLoadLSs() { |
fd3a24336e6a
SCHEMA CHANGE and Importer (only longitudinal section data so far): only grain fractions given now in schema are valid. We are handling sediment loads, not yields.
"Tom Gottfried <tom@intevation.de>"
parents:
8031
diff
changeset
|
155 return sedimentLoadLSs; |
8025
c915e99d9e52
Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
156 } |
c915e99d9e52
Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
157 } |
c915e99d9e52
Renamed SedimentYield to SedimentLoadLS and SedimentYieldValue to SedimentLoadLSValue. Adjust the names of the parsers and the rest of the glue.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
158 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |