Mercurial > dive4elements > river
comparison backend/src/main/java/org/dive4elements/river/importer/sinfo/parsers/TkhColumnParser.java @ 9655:1f57381b3bb5
Importer (s/u-info) extensions: uniform formatting of from-to series names,
warning instead of cancelling in case of missing tkh column values,
detecting, logging and skipping columns with wrong unit
author | mschaefer |
---|---|
date | Mon, 23 Mar 2020 15:16:35 +0100 |
parents | bf8a9df86f32 |
children |
comparison
equal
deleted
inserted
replaced
9654:8a2a777a8372 | 9655:1f57381b3bb5 |
---|---|
59 return log; | 59 return log; |
60 } | 60 } |
61 | 61 |
62 @Override | 62 @Override |
63 protected void logStartInfo() { | 63 protected void logStartInfo() { |
64 getLog().info(String.format("Start parsing column %d '%s':;'%s'", this.colIndex, this.colName, this.rootRelativePath)); | 64 getLog().info(String.format("Start parsing column %d '%s':;'%s'", this.colIndex + 1, this.colName, this.rootRelativePath)); |
65 } | 65 } |
66 | 66 |
67 @Override | 67 @Override |
68 protected boolean handleMetaOther() { | 68 protected boolean handleMetaOther() { |
69 this.headerParsingState = ParsingState.IGNORE; | 69 this.headerParsingState = ParsingState.IGNORE; |
75 return new TkhColumnSeriesImport(filename, this.parent, this.colName, this.rootRelativePath); | 75 return new TkhColumnSeriesImport(filename, this.parent, this.colName, this.rootRelativePath); |
76 } | 76 } |
77 | 77 |
78 @Override | 78 @Override |
79 protected TkhKmLineImport createKmLineImport(final Double km, final String[] values) { | 79 protected TkhKmLineImport createKmLineImport(final Double km, final String[] values) { |
80 final Number value = parseDoubleCheckNull(values, this.colIndex); | |
81 if ((value == null) || Double.isNaN(value.doubleValue())) { | |
82 logLineWarning("Column %d: " + INVALID_VALUE_ERROR_FORMAT, this.colIndex + 1, "TKH"); | |
83 return null; | |
84 } | |
80 // convert from cm to m | 85 // convert from cm to m |
81 final double tkheight = parseDoubleWithNull(values[this.colIndex]).doubleValue() / 100.0; | 86 final double tkh = value.doubleValue() / 100.0; |
82 return new TkhKmLineImport(km, tkheight); | 87 return new TkhKmLineImport(km, tkh); |
83 } | 88 } |
84 } | 89 } |