comparison 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
comparison
equal deleted inserted replaced
8031:6954ac9b7591 8032:fd3a24336e6a
102 102
103 public static final String FLOW_VELOCITY_MODEL = "Modellrechnungen"; 103 public static final String FLOW_VELOCITY_MODEL = "Modellrechnungen";
104 104
105 public static final String FLOW_VELOCITY_MEASUREMENTS = "v-Messungen"; 105 public static final String FLOW_VELOCITY_MEASUREMENTS = "v-Messungen";
106 106
107 public static final String SEDIMENT_YIELD_DIR = "Fracht"; 107 public static final String SEDIMENT_LOAD_DIR = "Fracht";
108 108
109 public static final String SEDIMENT_YIELD_SINGLE_DIR = "Einzeljahre"; 109 public static final String SEDIMENT_LOAD_LS_DIR = "Laengsschnitte";
110 110
111 public static final String SEDIMENT_YIELD_EPOCH_DIR = "Epochen"; 111 public static final String SEDIMENT_LOAD_SINGLE_DIR = "Einzeljahre";
112 112
113 public static final String SEDIMENT_YIELD_OFF_EPOCH_DIR = "amtliche Epochen"; 113 public static final String SEDIMENT_LOAD_EPOCH_DIR = "Epochen";
114
115 public static final String SEDIMENT_LOAD_OFF_EPOCH_DIR = "amtliche Epochen";
114 116
115 public static final String MINFO_FIXATIONS_DIR = "Fixierungsanalyse"; 117 public static final String MINFO_FIXATIONS_DIR = "Fixierungsanalyse";
116 118
117 public static final String MINFO_WATERLEVELS_DIR = "Wasserspiegellagen"; 119 public static final String MINFO_WATERLEVELS_DIR = "Wasserspiegellagen";
118 120
170 172
171 protected List<ImportFlowVelocityModel> flowVelocityModels; 173 protected List<ImportFlowVelocityModel> flowVelocityModels;
172 174
173 protected List<ImportFlowVelocityMeasurement> flowVelocityMeasurements; 175 protected List<ImportFlowVelocityMeasurement> flowVelocityMeasurements;
174 176
175 protected List<ImportSedimentLoadLS> sedimentYields; 177 protected List<ImportSedimentLoadLS> sedimentLoadLSs;
176 178
177 protected List<ImportMeasurementStation> measurementStations; 179 protected List<ImportMeasurementStation> measurementStations;
178 180
179 protected List<ImportSQRelation> sqRelations; 181 protected List<ImportSQRelation> sqRelations;
180 182
286 sedimentDensities = new ArrayList<ImportSedimentDensity>(); 288 sedimentDensities = new ArrayList<ImportSedimentDensity>();
287 porosities = new ArrayList<ImportPorosity>(); 289 porosities = new ArrayList<ImportPorosity>();
288 morphologicalWidths = new ArrayList<ImportMorphWidth>(); 290 morphologicalWidths = new ArrayList<ImportMorphWidth>();
289 flowVelocityModels = new ArrayList<ImportFlowVelocityModel>(); 291 flowVelocityModels = new ArrayList<ImportFlowVelocityModel>();
290 flowVelocityMeasurements = new ArrayList<ImportFlowVelocityMeasurement>(); 292 flowVelocityMeasurements = new ArrayList<ImportFlowVelocityMeasurement>();
291 sedimentYields = new ArrayList<ImportSedimentLoadLS>(); 293 sedimentLoadLSs = new ArrayList<ImportSedimentLoadLS>();
292 measurementStations = new ArrayList<ImportMeasurementStation>(); 294 measurementStations = new ArrayList<ImportMeasurementStation>();
293 sqRelations = new ArrayList<ImportSQRelation>(); 295 sqRelations = new ArrayList<ImportSQRelation>();
294 } 296 }
295 297
296 public ImportRiver( 298 public ImportRiver(
379 parseBedHeight(); 381 parseBedHeight();
380 parseSedimentDensity(); 382 parseSedimentDensity();
381 parsePorosity(); 383 parsePorosity();
382 parseMorphologicalWidth(); 384 parseMorphologicalWidth();
383 parseFlowVelocity(); 385 parseFlowVelocity();
384 parseSedimentYield(); 386 parseSedimentLoadLS();
385 parseWaterlevels(); 387 parseWaterlevels();
386 parseWaterlevelDifferences(); 388 parseWaterlevelDifferences();
387 parseMeasurementStations(); 389 parseMeasurementStations();
388 parseSQRelation(); 390 parseSQRelation();
389 } 391 }
591 flowVelocityMeasurements = parser.getMeasurements(); 593 flowVelocityMeasurements = parser.getMeasurements();
592 } 594 }
593 } 595 }
594 596
595 597
596 private void parseSedimentYieldDir( 598 private void parseSedimentLoadLSDir(
597 File[] files, 599 File[] files,
598 SedimentLoadLSParser parser 600 SedimentLoadLSParser parser
599 ) throws IOException { 601 ) throws IOException {
600 for (File file: files) { 602 for (File file: files) {
601 if (file.isDirectory()) { 603 if (file.isDirectory()) {
607 parser.parse(file); 609 parser.parse(file);
608 } 610 }
609 } 611 }
610 } 612 }
611 613
612 protected void parseSedimentYield() throws IOException { 614 protected void parseSedimentLoadLS() throws IOException {
613 if (Config.INSTANCE.skipSedimentYield()) { 615 if (Config.INSTANCE.skipSedimentLoadLS()) {
614 log.info("skip parsing sediment yield data"); 616 log.info("skip parsing sediment load longitudinal section data");
615 return; 617 return;
616 } 618 }
617 619
618 log.debug("Parse sediment yield data"); 620 log.debug("Parse sediment load longitudinal section data");
619 621
620 File minfoDir = getMinfoDir(); 622 File minfoDir = getMinfoDir();
621 File sedimentYieldDir = new File(minfoDir, SEDIMENT_YIELD_DIR); 623 File sedimentLoadDir = new File(minfoDir, SEDIMENT_LOAD_DIR);
622 624 File sedimentLoadLSDir = new File(sedimentLoadDir,
623 File singleDir = new File(sedimentYieldDir, SEDIMENT_YIELD_SINGLE_DIR); 625 SEDIMENT_LOAD_LS_DIR);
624 File epochDir = new File(sedimentYieldDir, SEDIMENT_YIELD_EPOCH_DIR); 626
625 File offEpochDir = new File(sedimentYieldDir, SEDIMENT_YIELD_OFF_EPOCH_DIR); 627 File singleDir = new File(sedimentLoadLSDir,
628 SEDIMENT_LOAD_SINGLE_DIR);
629 File epochDir = new File(sedimentLoadLSDir,
630 SEDIMENT_LOAD_EPOCH_DIR);
631 File offEpochDir = new File(sedimentLoadLSDir,
632 SEDIMENT_LOAD_OFF_EPOCH_DIR);
626 633
627 File[] singles = singleDir.listFiles(); 634 File[] singles = singleDir.listFiles();
628 File[] epochs = epochDir.listFiles(); 635 File[] epochs = epochDir.listFiles();
629 File[] offEpochs = offEpochDir.listFiles(); 636 File[] offEpochs = offEpochDir.listFiles();
630 637
632 639
633 if (singles == null || singles.length == 0) { 640 if (singles == null || singles.length == 0) {
634 log.warn("Cannot read directory '" + singleDir + "'"); 641 log.warn("Cannot read directory '" + singleDir + "'");
635 } 642 }
636 else { 643 else {
637 parseSedimentYieldDir(singles, parser); 644 parseSedimentLoadLSDir(singles, parser);
638 } 645 }
639 646
640 if (epochs == null || epochs.length == 0) { 647 if (epochs == null || epochs.length == 0) {
641 log.warn("Cannot read directory '" + epochDir + "'"); 648 log.warn("Cannot read directory '" + epochDir + "'");
642 } 649 }
643 else { 650 else {
644 parseSedimentYieldDir(epochs, parser); 651 parseSedimentLoadLSDir(epochs, parser);
645 } 652 }
646 653
647 if (offEpochs == null || offEpochs.length == 0) { 654 if (offEpochs == null || offEpochs.length == 0) {
648 log.warn("Cannot read directory '" + offEpochDir + "'"); 655 log.warn("Cannot read directory '" + offEpochDir + "'");
649 } 656 }
650 else { 657 else {
651 parseSedimentYieldDir(offEpochs, parser); 658 parseSedimentLoadLSDir(offEpochs, parser);
652 } 659 }
653 660
654 sedimentYields = parser.getSedimentYields(); 661 sedimentLoadLSs = parser.getSedimentLoadLSs();
655 } 662 }
656 663
657 664
658 protected void parseWaterlevels() throws IOException { 665 protected void parseWaterlevels() throws IOException {
659 if (Config.INSTANCE.skipWaterlevels()) { 666 if (Config.INSTANCE.skipWaterlevels()) {
1253 storeBedHeight(); 1260 storeBedHeight();
1254 storeSedimentDensity(); 1261 storeSedimentDensity();
1255 storePorosity(); 1262 storePorosity();
1256 storeMorphologicalWidth(); 1263 storeMorphologicalWidth();
1257 storeFlowVelocity(); 1264 storeFlowVelocity();
1258 storeSedimentYield(); 1265 storeSedimentLoadLS();
1259 storeWaterlevels(); 1266 storeWaterlevels();
1260 storeWaterlevelDifferences(); 1267 storeWaterlevelDifferences();
1261 storeMeasurementStations(); 1268 storeMeasurementStations();
1262 storeSQRelations(); 1269 storeSQRelations();
1263 storeOfficialNumber(); 1270 storeOfficialNumber();
1493 } 1500 }
1494 } 1501 }
1495 } 1502 }
1496 1503
1497 1504
1498 public void storeSedimentYield() { 1505 public void storeSedimentLoadLS() {
1499 if (!Config.INSTANCE.skipSedimentYield()) { 1506 if (!Config.INSTANCE.skipSedimentLoadLS()) {
1500 log.info("store sediment yield data"); 1507 log.info("store sediment load longitudinal section data");
1501 1508
1502 River river = getPeer(); 1509 River river = getPeer();
1503 1510
1504 for (ImportSedimentLoadLS sedimentYield: sedimentYields) { 1511 for (ImportSedimentLoadLS sedimentLoadLS: sedimentLoadLSs) {
1505 sedimentYield.storeDependencies(river); 1512 sedimentLoadLS.storeDependencies(river);
1506 } 1513 }
1507 } 1514 }
1508 } 1515 }
1509 1516
1510 1517

http://dive4elements.wald.intevation.org