diff flys-backend/src/main/java/de/intevation/flys/importer/ImportRiver.java @ 2826:c3f8cf0cdf69

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
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Tue, 17 Apr 2012 06:51:39 +0000
parents 0a536eb5d668
children 85b25e74594f
line wrap: on
line diff
--- 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();

http://dive4elements.wald.intevation.org