annotate backend/src/main/java/org/dive4elements/river/importer/parsers/BedHeightSingleParser.java @ 7354:809e76b7fe38

BedHeightSingleParser: do not omit lines if last column is empty.
author Tom Gottfried <tom@intevation.de>
date Wed, 16 Oct 2013 14:40:19 +0200
parents 6c003cbb27f1
children d12478cc5bb0
rev   line source
5844
4dd33b86dc61 Added header to river backend.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
1 /* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde
4dd33b86dc61 Added header to river backend.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
2 * Software engineering by Intevation GmbH
4dd33b86dc61 Added header to river backend.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
3 *
5992
4c3ccf2b0304 Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5844
diff changeset
4 * This file is Free Software under the GNU AGPL (>=v3)
5844
4dd33b86dc61 Added header to river backend.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
5 * and comes with ABSOLUTELY NO WARRANTY! Check out the
5992
4c3ccf2b0304 Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5844
diff changeset
6 * documentation coming with Dive4Elements River for details.
5844
4dd33b86dc61 Added header to river backend.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
7 */
4dd33b86dc61 Added header to river backend.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
8
5829
18619c1e7c2a Repaired internal references.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5828
diff changeset
9 package org.dive4elements.river.importer.parsers;
2806
33f40b23edd8 Initial checkin for parsing MINFO bed heights.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
10
2808
b57c95094b68 Finished work on parsing meta information and data specific to single bed heights files in MINFO.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2806
diff changeset
11 import java.math.BigDecimal;
b57c95094b68 Finished work on parsing meta information and data specific to single bed heights files in MINFO.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2806
diff changeset
12
b57c95094b68 Finished work on parsing meta information and data specific to single bed heights files in MINFO.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2806
diff changeset
13 import java.text.ParseException;
b57c95094b68 Finished work on parsing meta information and data specific to single bed heights files in MINFO.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2806
diff changeset
14
2806
33f40b23edd8 Initial checkin for parsing MINFO bed heights.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
15 import org.apache.log4j.Logger;
33f40b23edd8 Initial checkin for parsing MINFO bed heights.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
16
5829
18619c1e7c2a Repaired internal references.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5828
diff changeset
17 import org.dive4elements.river.importer.ImportBedHeight;
18619c1e7c2a Repaired internal references.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5828
diff changeset
18 import org.dive4elements.river.importer.ImportBedHeightSingle;
18619c1e7c2a Repaired internal references.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5828
diff changeset
19 import org.dive4elements.river.importer.ImportBedHeightSingleValue;
2806
33f40b23edd8 Initial checkin for parsing MINFO bed heights.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
20
33f40b23edd8 Initial checkin for parsing MINFO bed heights.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
21
2811
8926571e47fb Finished importing MINFO bed heights (single and epoch).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2809
diff changeset
22 public class BedHeightSingleParser extends BedHeightParser {
2806
33f40b23edd8 Initial checkin for parsing MINFO bed heights.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
23
33f40b23edd8 Initial checkin for parsing MINFO bed heights.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
24 private static final Logger log =
33f40b23edd8 Initial checkin for parsing MINFO bed heights.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
25 Logger.getLogger(BedHeightSingleParser.class);
33f40b23edd8 Initial checkin for parsing MINFO bed heights.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
26
33f40b23edd8 Initial checkin for parsing MINFO bed heights.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
27
2808
b57c95094b68 Finished work on parsing meta information and data specific to single bed heights files in MINFO.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2806
diff changeset
28
2811
8926571e47fb Finished importing MINFO bed heights (single and epoch).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2809
diff changeset
29 @Override
8926571e47fb Finished importing MINFO bed heights (single and epoch).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2809
diff changeset
30 protected ImportBedHeight newImportBedHeight(String description) {
8926571e47fb Finished importing MINFO bed heights (single and epoch).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2809
diff changeset
31 return new ImportBedHeightSingle(description);
2808
b57c95094b68 Finished work on parsing meta information and data specific to single bed heights files in MINFO.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2806
diff changeset
32 }
b57c95094b68 Finished work on parsing meta information and data specific to single bed heights files in MINFO.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2806
diff changeset
33
b57c95094b68 Finished work on parsing meta information and data specific to single bed heights files in MINFO.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2806
diff changeset
34
b57c95094b68 Finished work on parsing meta information and data specific to single bed heights files in MINFO.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2806
diff changeset
35
3955
26685b846a29 Let importer handle gappy single bed height values.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3662
diff changeset
36 /**
26685b846a29 Let importer handle gappy single bed height values.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3662
diff changeset
37 * Create ImportBedHeightSingleValue from a line of csv file, add
26685b846a29 Let importer handle gappy single bed height values.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3662
diff changeset
38 * it to the ImportBedHeight.
26685b846a29 Let importer handle gappy single bed height values.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3662
diff changeset
39 */
2811
8926571e47fb Finished importing MINFO bed heights (single and epoch).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2809
diff changeset
40 @Override
8926571e47fb Finished importing MINFO bed heights (single and epoch).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2809
diff changeset
41 protected void handleDataLine(ImportBedHeight obj, String line) {
7354
809e76b7fe38 BedHeightSingleParser: do not omit lines if last column is empty.
Tom Gottfried <tom@intevation.de>
parents: 7344
diff changeset
42 String[] values = line.split(SEPERATOR_CHAR, -1);
2808
b57c95094b68 Finished work on parsing meta information and data specific to single bed heights files in MINFO.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2806
diff changeset
43
7354
809e76b7fe38 BedHeightSingleParser: do not omit lines if last column is empty.
Tom Gottfried <tom@intevation.de>
parents: 7344
diff changeset
44 if (values == null) {
809e76b7fe38 BedHeightSingleParser: do not omit lines if last column is empty.
Tom Gottfried <tom@intevation.de>
parents: 7344
diff changeset
45 log.warn("BSP: Error while parsing data line: '" + line + "'");
2808
b57c95094b68 Finished work on parsing meta information and data specific to single bed heights files in MINFO.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2806
diff changeset
46 return;
b57c95094b68 Finished work on parsing meta information and data specific to single bed heights files in MINFO.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2806
diff changeset
47 }
b57c95094b68 Finished work on parsing meta information and data specific to single bed heights files in MINFO.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2806
diff changeset
48
6203
a3fb76cf79b6 backout backout as it is now safely in a branch
Tom Gottfried <tom.gottfried@intevation.de>
parents: 6201
diff changeset
49 Double km;
3955
26685b846a29 Let importer handle gappy single bed height values.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3662
diff changeset
50
26685b846a29 Let importer handle gappy single bed height values.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3662
diff changeset
51 try {
6203
a3fb76cf79b6 backout backout as it is now safely in a branch
Tom Gottfried <tom.gottfried@intevation.de>
parents: 6201
diff changeset
52 km = new Double(nf.parse(values[0]).doubleValue());
6273
e7526a074c0d Bed height parser: check for duplicate stations
Tom Gottfried <tom.gottfried@intevation.de>
parents: 6203
diff changeset
53
e7526a074c0d Bed height parser: check for duplicate stations
Tom Gottfried <tom.gottfried@intevation.de>
parents: 6203
diff changeset
54 Double key = Double.valueOf(km);
e7526a074c0d Bed height parser: check for duplicate stations
Tom Gottfried <tom.gottfried@intevation.de>
parents: 6203
diff changeset
55
e7526a074c0d Bed height parser: check for duplicate stations
Tom Gottfried <tom.gottfried@intevation.de>
parents: 6203
diff changeset
56 if (kmExists.contains(key)) {
e7526a074c0d Bed height parser: check for duplicate stations
Tom Gottfried <tom.gottfried@intevation.de>
parents: 6203
diff changeset
57 log.warn("duplicate station '" + km + "': -> ignored");
e7526a074c0d Bed height parser: check for duplicate stations
Tom Gottfried <tom.gottfried@intevation.de>
parents: 6203
diff changeset
58 return;
e7526a074c0d Bed height parser: check for duplicate stations
Tom Gottfried <tom.gottfried@intevation.de>
parents: 6203
diff changeset
59 }
e7526a074c0d Bed height parser: check for duplicate stations
Tom Gottfried <tom.gottfried@intevation.de>
parents: 6203
diff changeset
60
e7526a074c0d Bed height parser: check for duplicate stations
Tom Gottfried <tom.gottfried@intevation.de>
parents: 6203
diff changeset
61 kmExists.add(key);
e7526a074c0d Bed height parser: check for duplicate stations
Tom Gottfried <tom.gottfried@intevation.de>
parents: 6203
diff changeset
62 }
e7526a074c0d Bed height parser: check for duplicate stations
Tom Gottfried <tom.gottfried@intevation.de>
parents: 6203
diff changeset
63
3955
26685b846a29 Let importer handle gappy single bed height values.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3662
diff changeset
64 catch (ParseException e) {
26685b846a29 Let importer handle gappy single bed height values.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3662
diff changeset
65 // We expect a lot of ";;;;;;" lines.
26685b846a29 Let importer handle gappy single bed height values.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3662
diff changeset
66 //log.warn("BSP: Error while parsing km of data row.", e);
26685b846a29 Let importer handle gappy single bed height values.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3662
diff changeset
67 return;
26685b846a29 Let importer handle gappy single bed height values.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3662
diff changeset
68 }
26685b846a29 Let importer handle gappy single bed height values.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3662
diff changeset
69
26685b846a29 Let importer handle gappy single bed height values.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3662
diff changeset
70 // Handle gaps like "10,0;;;;;".
26685b846a29 Let importer handle gappy single bed height values.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3662
diff changeset
71 if (values.length == 1) {
6047
1bb4b51ff1e6 BHP: do not import lines without useful data
Tom Gottfried <tom.gottfried@intevation.de>
parents: 5992
diff changeset
72 // Do not import line without useful data
3955
26685b846a29 Let importer handle gappy single bed height values.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3662
diff changeset
73 return;
26685b846a29 Let importer handle gappy single bed height values.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3662
diff changeset
74 }
26685b846a29 Let importer handle gappy single bed height values.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3662
diff changeset
75
26685b846a29 Let importer handle gappy single bed height values.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3662
diff changeset
76 // Because we cannot enforce consistency of values with complete data
26685b846a29 Let importer handle gappy single bed height values.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3662
diff changeset
77 // via null constraints in the database (as there are "gap" values),
26685b846a29 Let importer handle gappy single bed height values.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3662
diff changeset
78 // do this checks manually.
6298
f095b58c95d9 Bedheight single parser: do not reject lines with missing values
Tom Gottfried <tom.gottfried@intevation.de>
parents: 6273
diff changeset
79 // if (values[3].length() == 0 || values[4].length() == 0
f095b58c95d9 Bedheight single parser: do not reject lines with missing values
Tom Gottfried <tom.gottfried@intevation.de>
parents: 6273
diff changeset
80 // || values[5].length() == 0) {
3955
26685b846a29 Let importer handle gappy single bed height values.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3662
diff changeset
81 //log.warn("BSP: Error while parsing data row (manual null constraint violated).");
6298
f095b58c95d9 Bedheight single parser: do not reject lines with missing values
Tom Gottfried <tom.gottfried@intevation.de>
parents: 6273
diff changeset
82 // return;
f095b58c95d9 Bedheight single parser: do not reject lines with missing values
Tom Gottfried <tom.gottfried@intevation.de>
parents: 6273
diff changeset
83 //}
3955
26685b846a29 Let importer handle gappy single bed height values.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3662
diff changeset
84
6298
f095b58c95d9 Bedheight single parser: do not reject lines with missing values
Tom Gottfried <tom.gottfried@intevation.de>
parents: 6273
diff changeset
85 Double height = null;
f095b58c95d9 Bedheight single parser: do not reject lines with missing values
Tom Gottfried <tom.gottfried@intevation.de>
parents: 6273
diff changeset
86 if (values[1].length() > 0) {
f095b58c95d9 Bedheight single parser: do not reject lines with missing values
Tom Gottfried <tom.gottfried@intevation.de>
parents: 6273
diff changeset
87 try {
f095b58c95d9 Bedheight single parser: do not reject lines with missing values
Tom Gottfried <tom.gottfried@intevation.de>
parents: 6273
diff changeset
88 height = new Double(nf.parse(values[1]).doubleValue());
f095b58c95d9 Bedheight single parser: do not reject lines with missing values
Tom Gottfried <tom.gottfried@intevation.de>
parents: 6273
diff changeset
89 }
f095b58c95d9 Bedheight single parser: do not reject lines with missing values
Tom Gottfried <tom.gottfried@intevation.de>
parents: 6273
diff changeset
90 catch (ParseException e) {
f095b58c95d9 Bedheight single parser: do not reject lines with missing values
Tom Gottfried <tom.gottfried@intevation.de>
parents: 6273
diff changeset
91 log.warn("BSP: unparseable height " + values[1]);
f095b58c95d9 Bedheight single parser: do not reject lines with missing values
Tom Gottfried <tom.gottfried@intevation.de>
parents: 6273
diff changeset
92 }
f095b58c95d9 Bedheight single parser: do not reject lines with missing values
Tom Gottfried <tom.gottfried@intevation.de>
parents: 6273
diff changeset
93 }
2808
b57c95094b68 Finished work on parsing meta information and data specific to single bed heights files in MINFO.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2806
diff changeset
94
6298
f095b58c95d9 Bedheight single parser: do not reject lines with missing values
Tom Gottfried <tom.gottfried@intevation.de>
parents: 6273
diff changeset
95 Double uncertainty = null;
f095b58c95d9 Bedheight single parser: do not reject lines with missing values
Tom Gottfried <tom.gottfried@intevation.de>
parents: 6273
diff changeset
96 if (values[2].length() > 0) {
f095b58c95d9 Bedheight single parser: do not reject lines with missing values
Tom Gottfried <tom.gottfried@intevation.de>
parents: 6273
diff changeset
97 try {
f095b58c95d9 Bedheight single parser: do not reject lines with missing values
Tom Gottfried <tom.gottfried@intevation.de>
parents: 6273
diff changeset
98 uncertainty = new Double(nf.parse(values[2]).doubleValue());
f095b58c95d9 Bedheight single parser: do not reject lines with missing values
Tom Gottfried <tom.gottfried@intevation.de>
parents: 6273
diff changeset
99 }
f095b58c95d9 Bedheight single parser: do not reject lines with missing values
Tom Gottfried <tom.gottfried@intevation.de>
parents: 6273
diff changeset
100 catch (ParseException e) {
f095b58c95d9 Bedheight single parser: do not reject lines with missing values
Tom Gottfried <tom.gottfried@intevation.de>
parents: 6273
diff changeset
101 log.warn("BSP: unparseable uncertainty value " + values[2]);
f095b58c95d9 Bedheight single parser: do not reject lines with missing values
Tom Gottfried <tom.gottfried@intevation.de>
parents: 6273
diff changeset
102 }
f095b58c95d9 Bedheight single parser: do not reject lines with missing values
Tom Gottfried <tom.gottfried@intevation.de>
parents: 6273
diff changeset
103 }
f095b58c95d9 Bedheight single parser: do not reject lines with missing values
Tom Gottfried <tom.gottfried@intevation.de>
parents: 6273
diff changeset
104
f095b58c95d9 Bedheight single parser: do not reject lines with missing values
Tom Gottfried <tom.gottfried@intevation.de>
parents: 6273
diff changeset
105 Double dataGap = null;
f095b58c95d9 Bedheight single parser: do not reject lines with missing values
Tom Gottfried <tom.gottfried@intevation.de>
parents: 6273
diff changeset
106 if (values[3].length() > 0) {
f095b58c95d9 Bedheight single parser: do not reject lines with missing values
Tom Gottfried <tom.gottfried@intevation.de>
parents: 6273
diff changeset
107 try {
f095b58c95d9 Bedheight single parser: do not reject lines with missing values
Tom Gottfried <tom.gottfried@intevation.de>
parents: 6273
diff changeset
108 dataGap = new Double(nf.parse(values[3]).doubleValue());
f095b58c95d9 Bedheight single parser: do not reject lines with missing values
Tom Gottfried <tom.gottfried@intevation.de>
parents: 6273
diff changeset
109 }
f095b58c95d9 Bedheight single parser: do not reject lines with missing values
Tom Gottfried <tom.gottfried@intevation.de>
parents: 6273
diff changeset
110 catch (ParseException e) {
f095b58c95d9 Bedheight single parser: do not reject lines with missing values
Tom Gottfried <tom.gottfried@intevation.de>
parents: 6273
diff changeset
111 log.warn("BSP: unparseable data gap " + values[3]);
f095b58c95d9 Bedheight single parser: do not reject lines with missing values
Tom Gottfried <tom.gottfried@intevation.de>
parents: 6273
diff changeset
112 }
f095b58c95d9 Bedheight single parser: do not reject lines with missing values
Tom Gottfried <tom.gottfried@intevation.de>
parents: 6273
diff changeset
113 }
f095b58c95d9 Bedheight single parser: do not reject lines with missing values
Tom Gottfried <tom.gottfried@intevation.de>
parents: 6273
diff changeset
114
f095b58c95d9 Bedheight single parser: do not reject lines with missing values
Tom Gottfried <tom.gottfried@intevation.de>
parents: 6273
diff changeset
115 Double soundingWidth = null;
f095b58c95d9 Bedheight single parser: do not reject lines with missing values
Tom Gottfried <tom.gottfried@intevation.de>
parents: 6273
diff changeset
116 if (values[4].length() > 0) {
f095b58c95d9 Bedheight single parser: do not reject lines with missing values
Tom Gottfried <tom.gottfried@intevation.de>
parents: 6273
diff changeset
117 try {
f095b58c95d9 Bedheight single parser: do not reject lines with missing values
Tom Gottfried <tom.gottfried@intevation.de>
parents: 6273
diff changeset
118 soundingWidth = new Double(nf.parse(values[4]).doubleValue());
f095b58c95d9 Bedheight single parser: do not reject lines with missing values
Tom Gottfried <tom.gottfried@intevation.de>
parents: 6273
diff changeset
119 }
f095b58c95d9 Bedheight single parser: do not reject lines with missing values
Tom Gottfried <tom.gottfried@intevation.de>
parents: 6273
diff changeset
120 catch (ParseException e) {
f095b58c95d9 Bedheight single parser: do not reject lines with missing values
Tom Gottfried <tom.gottfried@intevation.de>
parents: 6273
diff changeset
121 log.warn("BSP: unparseable sounding width " + values[4]);
f095b58c95d9 Bedheight single parser: do not reject lines with missing values
Tom Gottfried <tom.gottfried@intevation.de>
parents: 6273
diff changeset
122 }
f095b58c95d9 Bedheight single parser: do not reject lines with missing values
Tom Gottfried <tom.gottfried@intevation.de>
parents: 6273
diff changeset
123 }
f095b58c95d9 Bedheight single parser: do not reject lines with missing values
Tom Gottfried <tom.gottfried@intevation.de>
parents: 6273
diff changeset
124
f095b58c95d9 Bedheight single parser: do not reject lines with missing values
Tom Gottfried <tom.gottfried@intevation.de>
parents: 6273
diff changeset
125 Double width = null;
f095b58c95d9 Bedheight single parser: do not reject lines with missing values
Tom Gottfried <tom.gottfried@intevation.de>
parents: 6273
diff changeset
126 if (values[5].length() > 0) {
f095b58c95d9 Bedheight single parser: do not reject lines with missing values
Tom Gottfried <tom.gottfried@intevation.de>
parents: 6273
diff changeset
127 try {
f095b58c95d9 Bedheight single parser: do not reject lines with missing values
Tom Gottfried <tom.gottfried@intevation.de>
parents: 6273
diff changeset
128 width = new Double(nf.parse(values[5]).doubleValue());
f095b58c95d9 Bedheight single parser: do not reject lines with missing values
Tom Gottfried <tom.gottfried@intevation.de>
parents: 6273
diff changeset
129 }
f095b58c95d9 Bedheight single parser: do not reject lines with missing values
Tom Gottfried <tom.gottfried@intevation.de>
parents: 6273
diff changeset
130 catch (ParseException e) {
f095b58c95d9 Bedheight single parser: do not reject lines with missing values
Tom Gottfried <tom.gottfried@intevation.de>
parents: 6273
diff changeset
131 log.warn("BSP: unparseable width " + values[5]);
f095b58c95d9 Bedheight single parser: do not reject lines with missing values
Tom Gottfried <tom.gottfried@intevation.de>
parents: 6273
diff changeset
132 }
f095b58c95d9 Bedheight single parser: do not reject lines with missing values
Tom Gottfried <tom.gottfried@intevation.de>
parents: 6273
diff changeset
133 }
f095b58c95d9 Bedheight single parser: do not reject lines with missing values
Tom Gottfried <tom.gottfried@intevation.de>
parents: 6273
diff changeset
134
f095b58c95d9 Bedheight single parser: do not reject lines with missing values
Tom Gottfried <tom.gottfried@intevation.de>
parents: 6273
diff changeset
135 // try {
f095b58c95d9 Bedheight single parser: do not reject lines with missing values
Tom Gottfried <tom.gottfried@intevation.de>
parents: 6273
diff changeset
136 ImportBedHeightSingleValue value = new ImportBedHeightSingleValue(
f095b58c95d9 Bedheight single parser: do not reject lines with missing values
Tom Gottfried <tom.gottfried@intevation.de>
parents: 6273
diff changeset
137 (ImportBedHeightSingle) obj,
f095b58c95d9 Bedheight single parser: do not reject lines with missing values
Tom Gottfried <tom.gottfried@intevation.de>
parents: 6273
diff changeset
138 km,
f095b58c95d9 Bedheight single parser: do not reject lines with missing values
Tom Gottfried <tom.gottfried@intevation.de>
parents: 6273
diff changeset
139 height,//new Double(nf.parse(values[1]).doubleValue()),
f095b58c95d9 Bedheight single parser: do not reject lines with missing values
Tom Gottfried <tom.gottfried@intevation.de>
parents: 6273
diff changeset
140 uncertainty,
f095b58c95d9 Bedheight single parser: do not reject lines with missing values
Tom Gottfried <tom.gottfried@intevation.de>
parents: 6273
diff changeset
141 dataGap,
f095b58c95d9 Bedheight single parser: do not reject lines with missing values
Tom Gottfried <tom.gottfried@intevation.de>
parents: 6273
diff changeset
142 soundingWidth,
f095b58c95d9 Bedheight single parser: do not reject lines with missing values
Tom Gottfried <tom.gottfried@intevation.de>
parents: 6273
diff changeset
143 // parseBigDecimal(values[4], line),
f095b58c95d9 Bedheight single parser: do not reject lines with missing values
Tom Gottfried <tom.gottfried@intevation.de>
parents: 6273
diff changeset
144 width
f095b58c95d9 Bedheight single parser: do not reject lines with missing values
Tom Gottfried <tom.gottfried@intevation.de>
parents: 6273
diff changeset
145 );
f095b58c95d9 Bedheight single parser: do not reject lines with missing values
Tom Gottfried <tom.gottfried@intevation.de>
parents: 6273
diff changeset
146
f095b58c95d9 Bedheight single parser: do not reject lines with missing values
Tom Gottfried <tom.gottfried@intevation.de>
parents: 6273
diff changeset
147 obj.addValue(value);
f095b58c95d9 Bedheight single parser: do not reject lines with missing values
Tom Gottfried <tom.gottfried@intevation.de>
parents: 6273
diff changeset
148 // }
f095b58c95d9 Bedheight single parser: do not reject lines with missing values
Tom Gottfried <tom.gottfried@intevation.de>
parents: 6273
diff changeset
149 // catch (ParseException e) {
f095b58c95d9 Bedheight single parser: do not reject lines with missing values
Tom Gottfried <tom.gottfried@intevation.de>
parents: 6273
diff changeset
150 // log.warn("BSP: unparseable value in data row.", e);
f095b58c95d9 Bedheight single parser: do not reject lines with missing values
Tom Gottfried <tom.gottfried@intevation.de>
parents: 6273
diff changeset
151 //}
2808
b57c95094b68 Finished work on parsing meta information and data specific to single bed heights files in MINFO.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2806
diff changeset
152 }
5992
4c3ccf2b0304 Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5844
diff changeset
153
6298
f095b58c95d9 Bedheight single parser: do not reject lines with missing values
Tom Gottfried <tom.gottfried@intevation.de>
parents: 6273
diff changeset
154 // private BigDecimal parseBigDecimal(String value, String line) {
f095b58c95d9 Bedheight single parser: do not reject lines with missing values
Tom Gottfried <tom.gottfried@intevation.de>
parents: 6273
diff changeset
155 // BigDecimal result = null;
f095b58c95d9 Bedheight single parser: do not reject lines with missing values
Tom Gottfried <tom.gottfried@intevation.de>
parents: 6273
diff changeset
156 // try {
f095b58c95d9 Bedheight single parser: do not reject lines with missing values
Tom Gottfried <tom.gottfried@intevation.de>
parents: 6273
diff changeset
157 // Double dValue = Double.valueOf(value.replace(",", "."));
f095b58c95d9 Bedheight single parser: do not reject lines with missing values
Tom Gottfried <tom.gottfried@intevation.de>
parents: 6273
diff changeset
158 // result = new BigDecimal(dValue.doubleValue());
f095b58c95d9 Bedheight single parser: do not reject lines with missing values
Tom Gottfried <tom.gottfried@intevation.de>
parents: 6273
diff changeset
159 // }
f095b58c95d9 Bedheight single parser: do not reject lines with missing values
Tom Gottfried <tom.gottfried@intevation.de>
parents: 6273
diff changeset
160 // catch (NumberFormatException nfe) {
f095b58c95d9 Bedheight single parser: do not reject lines with missing values
Tom Gottfried <tom.gottfried@intevation.de>
parents: 6273
diff changeset
161 // log.warn(
f095b58c95d9 Bedheight single parser: do not reject lines with missing values
Tom Gottfried <tom.gottfried@intevation.de>
parents: 6273
diff changeset
162 // "Could not parse " +
f095b58c95d9 Bedheight single parser: do not reject lines with missing values
Tom Gottfried <tom.gottfried@intevation.de>
parents: 6273
diff changeset
163 // value +
f095b58c95d9 Bedheight single parser: do not reject lines with missing values
Tom Gottfried <tom.gottfried@intevation.de>
parents: 6273
diff changeset
164 // " in bed heigt single row: "
f095b58c95d9 Bedheight single parser: do not reject lines with missing values
Tom Gottfried <tom.gottfried@intevation.de>
parents: 6273
diff changeset
165 // + line);
f095b58c95d9 Bedheight single parser: do not reject lines with missing values
Tom Gottfried <tom.gottfried@intevation.de>
parents: 6273
diff changeset
166 // }
f095b58c95d9 Bedheight single parser: do not reject lines with missing values
Tom Gottfried <tom.gottfried@intevation.de>
parents: 6273
diff changeset
167 // return result;
f095b58c95d9 Bedheight single parser: do not reject lines with missing values
Tom Gottfried <tom.gottfried@intevation.de>
parents: 6273
diff changeset
168 // }
2806
33f40b23edd8 Initial checkin for parsing MINFO bed heights.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
169 }
33f40b23edd8 Initial checkin for parsing MINFO bed heights.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
170 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org