diff backend/src/main/java/org/dive4elements/river/importer/ImportRiver.java @ 8032:fd3a24336e6a

SCHEMA CHANGE and Importer (only longitudinal section data so far): only grain fractions given now in schema are valid. We are handling sediment loads, not yields.
author "Tom Gottfried <tom@intevation.de>"
date Mon, 14 Jul 2014 15:36:44 +0200
parents 6954ac9b7591
children d86cc6a17b7a
line wrap: on
line diff
--- a/backend/src/main/java/org/dive4elements/river/importer/ImportRiver.java	Fri Jul 11 13:10:05 2014 +0200
+++ b/backend/src/main/java/org/dive4elements/river/importer/ImportRiver.java	Mon Jul 14 15:36:44 2014 +0200
@@ -104,13 +104,15 @@
 
     public static final String FLOW_VELOCITY_MEASUREMENTS = "v-Messungen";
 
-    public static final String SEDIMENT_YIELD_DIR = "Fracht";
+    public static final String SEDIMENT_LOAD_DIR = "Fracht";
 
-    public static final String SEDIMENT_YIELD_SINGLE_DIR = "Einzeljahre";
+    public static final String SEDIMENT_LOAD_LS_DIR = "Laengsschnitte";
 
-    public static final String SEDIMENT_YIELD_EPOCH_DIR = "Epochen";
+    public static final String SEDIMENT_LOAD_SINGLE_DIR = "Einzeljahre";
 
-    public static final String SEDIMENT_YIELD_OFF_EPOCH_DIR = "amtliche Epochen";
+    public static final String SEDIMENT_LOAD_EPOCH_DIR = "Epochen";
+
+    public static final String SEDIMENT_LOAD_OFF_EPOCH_DIR = "amtliche Epochen";
 
     public static final String MINFO_FIXATIONS_DIR = "Fixierungsanalyse";
 
@@ -172,7 +174,7 @@
 
     protected List<ImportFlowVelocityMeasurement> flowVelocityMeasurements;
 
-    protected List<ImportSedimentLoadLS> sedimentYields;
+    protected List<ImportSedimentLoadLS> sedimentLoadLSs;
 
     protected List<ImportMeasurementStation> measurementStations;
 
@@ -288,7 +290,7 @@
         morphologicalWidths       = new ArrayList<ImportMorphWidth>();
         flowVelocityModels        = new ArrayList<ImportFlowVelocityModel>();
         flowVelocityMeasurements  = new ArrayList<ImportFlowVelocityMeasurement>();
-        sedimentYields            = new ArrayList<ImportSedimentLoadLS>();
+        sedimentLoadLSs           = new ArrayList<ImportSedimentLoadLS>();
         measurementStations       = new ArrayList<ImportMeasurementStation>();
         sqRelations               = new ArrayList<ImportSQRelation>();
     }
@@ -381,7 +383,7 @@
         parsePorosity();
         parseMorphologicalWidth();
         parseFlowVelocity();
-        parseSedimentYield();
+        parseSedimentLoadLS();
         parseWaterlevels();
         parseWaterlevelDifferences();
         parseMeasurementStations();
@@ -593,7 +595,7 @@
     }
 
 
-    private void parseSedimentYieldDir(
+    private void parseSedimentLoadLSDir(
         File[] files,
         SedimentLoadLSParser parser
     ) throws IOException {
@@ -609,20 +611,25 @@
        }
     }
 
-    protected void parseSedimentYield() throws IOException {
-        if (Config.INSTANCE.skipSedimentYield()) {
-            log.info("skip parsing sediment yield data");
+    protected void parseSedimentLoadLS() throws IOException {
+        if (Config.INSTANCE.skipSedimentLoadLS()) {
+            log.info("skip parsing sediment load longitudinal section data");
             return;
         }
 
-        log.debug("Parse sediment yield data");
+        log.debug("Parse sediment load longitudinal section data");
 
-        File minfoDir         = getMinfoDir();
-        File sedimentYieldDir = new File(minfoDir, SEDIMENT_YIELD_DIR);
+        File minfoDir          = getMinfoDir();
+        File sedimentLoadDir   = new File(minfoDir, SEDIMENT_LOAD_DIR);
+        File sedimentLoadLSDir = new File(sedimentLoadDir,
+                                          SEDIMENT_LOAD_LS_DIR);
 
-        File singleDir   = new File(sedimentYieldDir, SEDIMENT_YIELD_SINGLE_DIR);
-        File epochDir    = new File(sedimentYieldDir, SEDIMENT_YIELD_EPOCH_DIR);
-        File offEpochDir = new File(sedimentYieldDir, SEDIMENT_YIELD_OFF_EPOCH_DIR);
+        File singleDir   = new File(sedimentLoadLSDir,
+                                    SEDIMENT_LOAD_SINGLE_DIR);
+        File epochDir    = new File(sedimentLoadLSDir,
+                                    SEDIMENT_LOAD_EPOCH_DIR);
+        File offEpochDir = new File(sedimentLoadLSDir,
+                                    SEDIMENT_LOAD_OFF_EPOCH_DIR);
 
         File[] singles   = singleDir.listFiles();
         File[] epochs    = epochDir.listFiles();
@@ -634,24 +641,24 @@
             log.warn("Cannot read directory '" + singleDir + "'");
         }
         else {
-            parseSedimentYieldDir(singles, parser);
+            parseSedimentLoadLSDir(singles, parser);
         }
 
         if (epochs == null || epochs.length == 0) {
             log.warn("Cannot read directory '" + epochDir + "'");
         }
         else {
-            parseSedimentYieldDir(epochs, parser);
+            parseSedimentLoadLSDir(epochs, parser);
         }
 
         if (offEpochs == null || offEpochs.length == 0) {
             log.warn("Cannot read directory '" + offEpochDir + "'");
         }
         else {
-            parseSedimentYieldDir(offEpochs, parser);
+            parseSedimentLoadLSDir(offEpochs, parser);
         }
 
-        sedimentYields = parser.getSedimentYields();
+        sedimentLoadLSs = parser.getSedimentLoadLSs();
     }
 
 
@@ -1255,7 +1262,7 @@
         storePorosity();
         storeMorphologicalWidth();
         storeFlowVelocity();
-        storeSedimentYield();
+        storeSedimentLoadLS();
         storeWaterlevels();
         storeWaterlevelDifferences();
         storeMeasurementStations();
@@ -1495,14 +1502,14 @@
     }
 
 
-    public void storeSedimentYield() {
-        if (!Config.INSTANCE.skipSedimentYield()) {
-            log.info("store sediment yield data");
+    public void storeSedimentLoadLS() {
+        if (!Config.INSTANCE.skipSedimentLoadLS()) {
+            log.info("store sediment load longitudinal section data");
 
             River river = getPeer();
 
-            for (ImportSedimentLoadLS sedimentYield: sedimentYields) {
-                sedimentYield.storeDependencies(river);
+            for (ImportSedimentLoadLS sedimentLoadLS: sedimentLoadLSs) {
+                sedimentLoadLS.storeDependencies(river);
             }
         }
     }

http://dive4elements.wald.intevation.org