# HG changeset patch # User Ingo Weinzierl # Date 1334645499 0 # Node ID c3f8cf0cdf698bdb4be5fd743d17466de53a4166 # Parent a948366d8ac5af2e41bb1e8094fef0abc34f2226 Prepared the importer to parse flow velocity files and added a config option to skip that process. flys-backend/trunk@4243 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r a948366d8ac5 -r c3f8cf0cdf69 flys-backend/ChangeLog --- a/flys-backend/ChangeLog Tue Apr 17 06:36:39 2012 +0000 +++ b/flys-backend/ChangeLog Tue Apr 17 06:51:39 2012 +0000 @@ -1,3 +1,13 @@ +2012-04-17 Ingo Weinzierl + + * src/main/java/de/intevation/flys/importer/ImportRiver.java: Prepared for + parsing flow velocity files. + + * src/main/java/de/intevation/flys/importer/Config.java: Added a config + option to skip parsing flow velocity files: + + -Dflys.backend.importer.skip.flow.velocity=true + 2012-04-17 Ingo Weinzierl * src/main/java/de/intevation/flys/model/FlowVelocityModel.java, diff -r a948366d8ac5 -r c3f8cf0cdf69 flys-backend/src/main/java/de/intevation/flys/importer/Config.java --- a/flys-backend/src/main/java/de/intevation/flys/importer/Config.java Tue Apr 17 06:36:39 2012 +0000 +++ b/flys-backend/src/main/java/de/intevation/flys/importer/Config.java Tue Apr 17 06:51:39 2012 +0000 @@ -53,6 +53,9 @@ public static final String SKIP_MORPHOLOGICAL_WIDTH = "flys.backend.importer.skip.morphological.width"; + public static final String SKIP_FLOW_VELOCITY = + "flys.backend.importer.skip.flow.velocity"; + public static final Config INSTANCE = new Config(); @@ -126,5 +129,9 @@ public boolean skipMorphologicalWidth() { return Boolean.getBoolean(SKIP_MORPHOLOGICAL_WIDTH); } + + public boolean skipFlowVelocity() { + return Boolean.getBoolean(SKIP_FLOW_VELOCITY); + } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : diff -r a948366d8ac5 -r c3f8cf0cdf69 flys-backend/src/main/java/de/intevation/flys/importer/ImportRiver.java --- a/flys-backend/src/main/java/de/intevation/flys/importer/ImportRiver.java Tue Apr 17 06:36:39 2012 +0000 +++ b/flys-backend/src/main/java/de/intevation/flys/importer/ImportRiver.java Tue Apr 17 06:51:39 2012 +0000 @@ -73,6 +73,12 @@ public static final String MORPHOLOGICAL_WIDTH_DIR = "morphologische_Breite"; + public static final String FLOW_VELOCITY_DIR = "Geschwindigkeit_Schubspannung"; + + public static final String FLOW_VELOCITY_MODEL = "Modellrechnungen"; + + public static final String FLOW_VELOCITY_MEASUREMENTS = "v-Messungen"; + protected String name; @@ -190,6 +196,7 @@ parseBedHeight(); parseSedimentDensity(); parseMorphologicalWidth(); + parseFlowVelocity(); } public void parseFloodProtection() throws IOException { @@ -321,6 +328,44 @@ } + protected void parseFlowVelocity() throws IOException { + log.debug("Parse flow velocity"); + + if (Config.INSTANCE.skipFlowVelocity()) { + log.info("skip parsing flow velocity"); + return; + } + + File minfoDir = getMinfoDir(); + File flowDir = new File(minfoDir, FLOW_VELOCITY_DIR); + File modelDir = new File(flowDir, FLOW_VELOCITY_MODEL); + File measureDir = new File(flowDir, FLOW_VELOCITY_MEASUREMENTS); + + File[] modelFiles = modelDir.listFiles(); + File[] measureFiles = measureDir.listFiles(); + + if (modelFiles == null) { + log.warn("Cannot parse directory '" + modelDir + "'"); + } + else { + // TODO + for (File model: modelFiles) { + log.debug("Parse file '" + model + "'"); + } + } + + if (measureFiles == null) { + log.warn("Cannot parse directory '" + measureDir + "'"); + } + else { + // TODO + for (File measurement: measureFiles) { + log.debug("Parse file '" + measurement + "'"); + } + } + } + + protected void parseBedHeightSingles(File dir) throws IOException { log.debug("Parse bed height singles"); @@ -688,6 +733,7 @@ storeBedHeight(); storeSedimentDensity(); storeMorphologicalWidth(); + storeFlowVelocity(); } public void storeWstUnit() { @@ -894,6 +940,14 @@ } } + public void storeFlowVelocity() { + if (!Config.INSTANCE.skipFlowVelocity()) { + log.info("store flow velocity"); + + // TODO + } + } + public void storeAnnotations() { if (!Config.INSTANCE.skipAnnotations()) { River river = getPeer();