Mercurial > dive4elements > river
comparison backend/src/main/java/org/dive4elements/river/importer/ImportRiver.java @ 7918:5813c206ff64
Removed bed height epoch in importer.
author | Raimund Renkert <rrenkert@intevation.de> |
---|---|
date | Fri, 06 Jun 2014 16:47:48 +0200 |
parents | 8036688f24e1 |
children | c915e99d9e52 |
comparison
equal
deleted
inserted
replaced
7917:9ec6def1a7dd | 7918:5813c206ff64 |
---|---|
12 | 12 |
13 import org.dive4elements.artifacts.common.utils.FileTools; | 13 import org.dive4elements.artifacts.common.utils.FileTools; |
14 | 14 |
15 import org.dive4elements.river.importer.parsers.AnnotationClassifier; | 15 import org.dive4elements.river.importer.parsers.AnnotationClassifier; |
16 import org.dive4elements.river.importer.parsers.AnnotationsParser; | 16 import org.dive4elements.river.importer.parsers.AnnotationsParser; |
17 import org.dive4elements.river.importer.parsers.BedHeightEpochParser; | |
18 import org.dive4elements.river.importer.parsers.BedHeightSingleParser; | 17 import org.dive4elements.river.importer.parsers.BedHeightSingleParser; |
19 import org.dive4elements.river.importer.parsers.CrossSectionParser; | 18 import org.dive4elements.river.importer.parsers.CrossSectionParser; |
20 import org.dive4elements.river.importer.parsers.DA50Parser; | 19 import org.dive4elements.river.importer.parsers.DA50Parser; |
21 import org.dive4elements.river.importer.parsers.DA66Parser; | 20 import org.dive4elements.river.importer.parsers.DA66Parser; |
22 import org.dive4elements.river.importer.parsers.FlowVelocityMeasurementParser; | 21 import org.dive4elements.river.importer.parsers.FlowVelocityMeasurementParser; |
90 public static final String MINFO_DIR = "Morphologie"; | 89 public static final String MINFO_DIR = "Morphologie"; |
91 | 90 |
92 public static final String BED_HEIGHT_DIR = "Sohlhoehen"; | 91 public static final String BED_HEIGHT_DIR = "Sohlhoehen"; |
93 | 92 |
94 public static final String BED_HEIGHT_SINGLE_DIR = "Einzeljahre"; | 93 public static final String BED_HEIGHT_SINGLE_DIR = "Einzeljahre"; |
95 | |
96 public static final String BED_HEIGHT_EPOCH_DIR = "Epochen"; | |
97 | 94 |
98 public static final String SEDIMENT_DENSITY_DIR = "Sedimentdichte"; | 95 public static final String SEDIMENT_DENSITY_DIR = "Sedimentdichte"; |
99 | 96 |
100 public static final String POROSITY_DIR = "Porositaet"; | 97 public static final String POROSITY_DIR = "Porositaet"; |
101 | 98 |
448 | 445 |
449 public void parseBedHeight() throws IOException { | 446 public void parseBedHeight() throws IOException { |
450 File minfoDir = getMinfoDir(); | 447 File minfoDir = getMinfoDir(); |
451 File bedHeightDir = new File(minfoDir, BED_HEIGHT_DIR); | 448 File bedHeightDir = new File(minfoDir, BED_HEIGHT_DIR); |
452 File singlesDir = new File(bedHeightDir, BED_HEIGHT_SINGLE_DIR); | 449 File singlesDir = new File(bedHeightDir, BED_HEIGHT_SINGLE_DIR); |
453 File epochDir = new File(bedHeightDir, BED_HEIGHT_EPOCH_DIR); | |
454 | 450 |
455 if (Config.INSTANCE.skipBedHeightSingle()) { | 451 if (Config.INSTANCE.skipBedHeightSingle()) { |
456 log.info("skip parsing bed height single."); | 452 log.info("skip parsing bed height single."); |
457 } | 453 } |
458 else { | 454 else { |
459 log.info("Parse bed height single."); | 455 log.info("Parse bed height single."); |
460 parseBedHeightSingles(singlesDir); | 456 parseBedHeightSingles(singlesDir); |
461 } | |
462 | |
463 if (Config.INSTANCE.skipBedHeightEpoch()) { | |
464 log.info("skip parsing bed height epochs."); | |
465 } | |
466 else { | |
467 log.info("Parse bed height epochs."); | |
468 parseBedHeightEpochs(epochDir); | |
469 } | 457 } |
470 } | 458 } |
471 | 459 |
472 | 460 |
473 protected void parseSedimentDensity() throws IOException { | 461 protected void parseSedimentDensity() throws IOException { |
812 parser.parse(file); | 800 parser.parse(file); |
813 } | 801 } |
814 | 802 |
815 bedHeightSingles = parser.getBedHeights(); | 803 bedHeightSingles = parser.getBedHeights(); |
816 } | 804 } |
817 | |
818 | |
819 protected void parseBedHeightEpochs(File dir) throws IOException { | |
820 log.debug("Parse bed height epochs"); | |
821 | |
822 File[] files = dir.listFiles(); | |
823 | |
824 if (files == null) { | |
825 log.warn("Cannot read directory '" + dir + "'"); | |
826 return; | |
827 } | |
828 | |
829 BedHeightEpochParser parser = new BedHeightEpochParser(); | |
830 | |
831 for (File file: files) { | |
832 parser.parse(file); | |
833 } | |
834 | |
835 bedHeightEpochs = parser.getBedHeights(); | |
836 } | |
837 | |
838 | 805 |
839 public void parseFloodWater() throws IOException { | 806 public void parseFloodWater() throws IOException { |
840 if (Config.INSTANCE.skipFloodWater()) { | 807 if (Config.INSTANCE.skipFloodWater()) { |
841 log.info("skip parsing flod water"); | 808 log.info("skip parsing flod water"); |
842 return; | 809 return; |
1442 public void storeBedHeight() { | 1409 public void storeBedHeight() { |
1443 if (!Config.INSTANCE.skipBedHeightSingle()) { | 1410 if (!Config.INSTANCE.skipBedHeightSingle()) { |
1444 log.info("store bed heights single"); | 1411 log.info("store bed heights single"); |
1445 storeBedHeightSingle(); | 1412 storeBedHeightSingle(); |
1446 } | 1413 } |
1447 | |
1448 if (!Config.INSTANCE.skipBedHeightEpoch()) { | |
1449 log.info("store bed height epoch."); | |
1450 storeBedHeightEpoch(); | |
1451 } | |
1452 } | 1414 } |
1453 | 1415 |
1454 | 1416 |
1455 private void storeBedHeightSingle() { | 1417 private void storeBedHeightSingle() { |
1456 River river = getPeer(); | 1418 River river = getPeer(); |
1469 else { | 1431 else { |
1470 log.info("No single bed heights to store."); | 1432 log.info("No single bed heights to store."); |
1471 } | 1433 } |
1472 } | 1434 } |
1473 | 1435 |
1474 | |
1475 private void storeBedHeightEpoch() { | |
1476 River river = getPeer(); | |
1477 | |
1478 if (bedHeightEpochs != null) { | |
1479 for (ImportBedHeight tmp: bedHeightEpochs) { | |
1480 ImportBedHeightEpoch epoch = (ImportBedHeightEpoch) tmp; | |
1481 | |
1482 String desc = epoch.getDescription(); | |
1483 | |
1484 log.debug("name: " + desc); | |
1485 | |
1486 epoch.storeDependencies(river); | |
1487 } | |
1488 } | |
1489 else { | |
1490 log.info("No epoch bed heights to store."); | |
1491 } | |
1492 } | |
1493 | 1436 |
1494 public void storeSedimentDensity() { | 1437 public void storeSedimentDensity() { |
1495 if (!Config.INSTANCE.skipSedimentDensity()) { | 1438 if (!Config.INSTANCE.skipSedimentDensity()) { |
1496 log.info("store sediment density"); | 1439 log.info("store sediment density"); |
1497 | 1440 |