comparison backend/src/main/java/org/dive4elements/river/importer/parsers/WstParser.java @ 6819:1d60614c1059 double-precision

WstParser: warn only once if no unit comment is found
author Tom Gottfried <tom.gottfried@intevation.de>
date Tue, 13 Aug 2013 09:51:15 +0200
parents 4ff177f48952
children 0850a4983fcd
comparison
equal deleted inserted replaced
6818:4ad2b530dbba 6819:1d60614c1059
139 BigDecimal kmHist1 = null; 139 BigDecimal kmHist1 = null;
140 BigDecimal kmHist2 = null; 140 BigDecimal kmHist2 = null;
141 141
142 boolean columnHeaderChecked = false; 142 boolean columnHeaderChecked = false;
143 143
144 /* Default string for altitude reference 144 /* Default string for altitude reference
145 * if none is found in WST-file*/ 145 * if none is found in WST-file.
146 * Use in case no unit comment is found in file */
146 String einheit = "m ü. unbekannte Referenz"; 147 String einheit = "m ü. unbekannte Referenz";
148 boolean unitFound = false;
147 149
148 HashSet<BigDecimal> kms = new HashSet<BigDecimal>(); 150 HashSet<BigDecimal> kms = new HashSet<BigDecimal>();
149 151
150 while ((input = in.readLine()) != null) { 152 while ((input = in.readLine()) != null) {
151 String line = input; 153 String line = input;
260 // FLYS is broken figuring out the unit 262 // FLYS is broken figuring out the unit
261 String [] units = m.group(1).split("\\s{2,}"); 263 String [] units = m.group(1).split("\\s{2,}");
262 m = UNIT.matcher(units[0]); 264 m = UNIT.matcher(units[0]);
263 einheit = m.matches() ? m.group(1) : units[0]; 265 einheit = m.matches() ? m.group(1) : units[0];
264 log.debug("unit: " + einheit); 266 log.debug("unit: " + einheit);
265 } 267 unitFound = true;
266 else { 268 }
267 log.warn("no unit and height reference found. Using default."); 269
268 }
269 continue; 270 continue;
270 } 271 }
271 272
272 if (firstAbfluesse != null) { 273 if (firstAbfluesse != null) {
273 if (!columnHeaderChecked) { 274 if (!columnHeaderChecked) {
372 } 373 }
373 } 374 }
374 375
375 } // for all lines in WST file 376 } // for all lines in WST file
376 377
378 if (!unitFound) {
379 log.warn("no unit and height reference found. Using default.");
380 }
377 wst.setUnit(new ImportUnit(einheit)); 381 wst.setUnit(new ImportUnit(einheit));
378 382
379 if (kmHist1 != null && kmHist2 != null 383 if (kmHist1 != null && kmHist2 != null
380 && kmHist1.compareTo(kmHist2) < 0) { 384 && kmHist1.compareTo(kmHist2) < 0) {
381 BigDecimal t = minKm; minKm = maxKm; maxKm = t; 385 BigDecimal t = minKm; minKm = maxKm; maxKm = t;

http://dive4elements.wald.intevation.org