comparison backend/src/main/java/org/dive4elements/river/importer/parsers/BedHeightParser.java @ 8560:6fcf4717605f

Meta-data on sounding width associated to bed heights is redundant to real data associated to values.
author "Tom Gottfried <tom@intevation.de>"
date Mon, 16 Feb 2015 11:48:05 +0100
parents 6d8d7425a6b5
children 2b3c8ea6cbee
comparison
equal deleted inserted replaced
8559:6d8d7425a6b5 8560:6fcf4717605f
72 Pattern.compile("^H.hensystem:\\s(\\w++) (.* )??\\[(.*)\\].*"); 72 Pattern.compile("^H.hensystem:\\s(\\w++) (.* )??\\[(.*)\\].*");
73 73
74 public static final Pattern META_OLD_ELEVATION_SYSTEM = 74 public static final Pattern META_OLD_ELEVATION_SYSTEM =
75 Pattern.compile("^urspr.ngliches H.hensystem:\\s(\\w++) (.* )??\\[(.*)\\].*"); 75 Pattern.compile("^urspr.ngliches H.hensystem:\\s(\\w++) (.* )??\\[(.*)\\].*");
76 76
77 public static final Pattern META_SOUNDING_WIDTH =
78 Pattern.compile("^ausgewertete Peilbreite: (\\d*).*");
79
80 public static final Pattern META_RANGE = 77 public static final Pattern META_RANGE =
81 Pattern.compile("^Strecke:\\D*(\\d++.?\\d*) ?- ?(\\d++.?\\d*).*"); 78 Pattern.compile("^Strecke:\\D*(\\d++.?\\d*) ?- ?(\\d++.?\\d*).*");
82 79
83 public static final Pattern META_EVALUATION_BY = 80 public static final Pattern META_EVALUATION_BY =
84 Pattern.compile("^Auswerter: (.*).*"); 81 Pattern.compile("^Auswerter: (.*).*");
169 return; 166 return;
170 } 167 }
171 else if (handleMetaTimeInterval(obj, meta)) { 168 else if (handleMetaTimeInterval(obj, meta)) {
172 return; 169 return;
173 } 170 }
174 else if (handleMetaSoundingWidth(obj, meta)) {
175 return;
176 }
177 else if (handleMetaComment(obj, meta)) { 171 else if (handleMetaComment(obj, meta)) {
178 return; 172 return;
179 } 173 }
180 else if (handleMetaEvaluationBy(obj, meta)) { 174 else if (handleMetaEvaluationBy(obj, meta)) {
181 return; 175 return;
239 } 233 }
240 catch (NumberFormatException e) { 234 catch (NumberFormatException e) {
241 log.warn("BHP: could not parse timeinterval", e); 235 log.warn("BHP: could not parse timeinterval", e);
242 } 236 }
243 237
244 return true;
245 }
246
247 return false;
248 }
249
250
251 protected boolean handleMetaSoundingWidth(ImportBedHeight obj, String line) {
252 Matcher m = META_SOUNDING_WIDTH.matcher(line);
253
254 if (m.matches()) {
255 String tmp = m.group(1);
256
257 try {
258 obj.setSoundingWidth(Integer.valueOf(tmp));
259 return true;
260 }
261 catch (NumberFormatException e) {
262 log.warn("BHP: Could not parse sounding width in line '" + line +
263 "'. -> Set default value '0'");
264 }
265 obj.setSoundingWidth(0);
266 return true; 238 return true;
267 } 239 }
268 240
269 return false; 241 return false;
270 } 242 }

http://dive4elements.wald.intevation.org