Mercurial > dive4elements > river
comparison backend/src/main/java/org/dive4elements/river/importer/sinfo/parsers/FlowDepthColumnParser.java @ 9656:31549fdfaf4f
Importer (s/u-info) extensions: flow-depth: uniform formatting of from-to series names,
warning instead of cancelling in case of missing column values,
detecting, logging and skipping columns with wrong unit,
better counting of inserted/updated values for each column
author | mschaefer |
---|---|
date | Mon, 23 Mar 2020 15:21:39 +0100 |
parents | 50416a0df385 |
children |
comparison
equal
deleted
inserted
replaced
9655:1f57381b3bb5 | 9656:31549fdfaf4f |
---|---|
42 | 42 |
43 | 43 |
44 /***** CONSTRUCTORS *****/ | 44 /***** CONSTRUCTORS *****/ |
45 | 45 |
46 public FlowDepthColumnParser(final File importPath, final File rootRelativePath, final ImportRiver river, final FlowDepthSeriesImport parent, | 46 public FlowDepthColumnParser(final File importPath, final File rootRelativePath, final ImportRiver river, final FlowDepthSeriesImport parent, |
47 final int colIndex, | 47 final int colIndex, final String colName) { |
48 final String colName) { | |
49 super(importPath, rootRelativePath, river); | 48 super(importPath, rootRelativePath, river); |
50 this.parent = parent; | 49 this.parent = parent; |
51 this.colIndex = colIndex; | 50 this.colIndex = colIndex; |
52 this.colName = colName; | 51 this.colName = colName; |
53 } | 52 } |
60 return log; | 59 return log; |
61 } | 60 } |
62 | 61 |
63 @Override | 62 @Override |
64 protected void logStartInfo() { | 63 protected void logStartInfo() { |
65 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)); |
66 } | 65 } |
67 | 66 |
68 @Override | 67 @Override |
69 protected boolean handleMetaOther() { | 68 protected boolean handleMetaOther() { |
70 this.headerParsingState = ParsingState.IGNORE; | 69 this.headerParsingState = ParsingState.IGNORE; |
76 return new FlowDepthColumnSeriesImport(filename, this.parent, this.colName, this.rootRelativePath); | 75 return new FlowDepthColumnSeriesImport(filename, this.parent, this.colName, this.rootRelativePath); |
77 } | 76 } |
78 | 77 |
79 @Override | 78 @Override |
80 protected FlowDepthKmLineImport createKmLineImport(final Double km, final String[] values) { | 79 protected FlowDepthKmLineImport createKmLineImport(final Double km, final String[] values) { |
81 final double tkheight = parseDoubleWithNull(values[this.colIndex]).doubleValue(); | 80 final Number value = parseDoubleCheckNull(values, this.colIndex); |
82 return new FlowDepthKmLineImport(km, tkheight); | 81 if ((value == null) || Double.isNaN(value.doubleValue())) { |
82 logLineWarning("Column %d: " + INVALID_VALUE_ERROR_FORMAT, this.colIndex + 1, "depth"); | |
83 return null; | |
84 } | |
85 return new FlowDepthKmLineImport(km, value.doubleValue()); | |
83 } | 86 } |
84 } | 87 } |