[PATCH 03 of 15] Parse and import porosities
Wald Commits
scm-commit at wald.intevation.org
Wed Apr 30 15:30:06 CEST 2014
# HG changeset patch
# User Raimund Renkert <rrenkert at intevation.de>
# Date 1398859979 -7200
# Node ID 8036688f24e1dd58fec80a926eba9e1b1af034dd
# Parent 02711de579ccabd25b7fb7bccc37796d01b3ab1a
Parse and import porosities.
diff -r 02711de579cc -r 8036688f24e1 backend/src/main/java/org/dive4elements/river/backend/FLYSCredentials.java
--- a/backend/src/main/java/org/dive4elements/river/backend/FLYSCredentials.java Wed Apr 30 14:11:29 2014 +0200
+++ b/backend/src/main/java/org/dive4elements/river/backend/FLYSCredentials.java Wed Apr 30 14:12:59 2014 +0200
@@ -64,6 +64,8 @@
import org.dive4elements.river.model.MorphologicalWidth;
import org.dive4elements.river.model.MorphologicalWidthValue;
import org.dive4elements.river.model.NamedMainValue;
+import org.dive4elements.river.model.Porosity;
+import org.dive4elements.river.model.PorosityValue;
import org.dive4elements.river.model.Position;
import org.dive4elements.river.model.Range;
import org.dive4elements.river.model.River;
@@ -192,6 +194,8 @@
River.class,
RiverAxis.class,
RiverAxisKm.class,
+ Porosity.class,
+ PorosityValue.class,
SectieKind.class,
SobekKind.class,
SedimentDensity.class,
diff -r 02711de579cc -r 8036688f24e1 backend/src/main/java/org/dive4elements/river/importer/Config.java
--- a/backend/src/main/java/org/dive4elements/river/importer/Config.java Wed Apr 30 14:11:29 2014 +0200
+++ b/backend/src/main/java/org/dive4elements/river/importer/Config.java Wed Apr 30 14:12:59 2014 +0200
@@ -79,6 +79,9 @@
public static final String SKIP_SEDIMENT_DENSITY =
"flys.backend.importer.skip.sediment.density";
+ public static final String SKIP_POROSITY =
+ "flys.backend.importer.skip.porosity";
+
public static final String SKIP_MORPHOLOGICAL_WIDTH =
"flys.backend.importer.skip.morphological.width";
@@ -219,6 +222,10 @@
return getFlag(SKIP_SEDIMENT_DENSITY);
}
+ public boolean skipPorosity() {
+ return getFlag(SKIP_POROSITY);
+ }
+
public boolean skipMorphologicalWidth() {
return getFlag(SKIP_MORPHOLOGICAL_WIDTH);
}
diff -r 02711de579cc -r 8036688f24e1 backend/src/main/java/org/dive4elements/river/importer/ImportRiver.java
--- a/backend/src/main/java/org/dive4elements/river/importer/ImportRiver.java Wed Apr 30 14:11:29 2014 +0200
+++ b/backend/src/main/java/org/dive4elements/river/importer/ImportRiver.java Wed Apr 30 14:12:59 2014 +0200
@@ -27,6 +27,7 @@
import org.dive4elements.river.importer.parsers.OfficialLinesConfigParser;
import org.dive4elements.river.importer.parsers.PRFParser;
import org.dive4elements.river.importer.parsers.PegelGltParser;
+import org.dive4elements.river.importer.parsers.PorosityParser;
import org.dive4elements.river.importer.parsers.SQRelationParser;
import org.dive4elements.river.importer.parsers.SedimentDensityParser;
import org.dive4elements.river.importer.parsers.SedimentYieldParser;
@@ -96,6 +97,8 @@
public static final String SEDIMENT_DENSITY_DIR = "Sedimentdichte";
+ public static final String POROSITY_DIR = "Porositaet";
+
public static final String MORPHOLOGICAL_WIDTH_DIR = "morphologische_Breite";
public static final String FLOW_VELOCITY_DIR = "Geschwindigkeit_Schubspannung";
@@ -164,6 +167,8 @@
protected List<ImportSedimentDensity> sedimentDensities;
+ protected List<ImportPorosity> porosities;
+
protected List<ImportMorphWidth> morphologicalWidths;
protected List<ImportFlowVelocityModel> flowVelocityModels;
@@ -282,6 +287,7 @@
waterlevelDifferences = new ArrayList<ImportWst>();
floodProtection = new ArrayList<ImportWst>();
sedimentDensities = new ArrayList<ImportSedimentDensity>();
+ porosities = new ArrayList<ImportPorosity>();
morphologicalWidths = new ArrayList<ImportMorphWidth>();
flowVelocityModels = new ArrayList<ImportFlowVelocityModel>();
flowVelocityMeasurements = new ArrayList<ImportFlowVelocityMeasurement>();
@@ -375,6 +381,7 @@
parseFloodProtection();
parseBedHeight();
parseSedimentDensity();
+ parsePorosity();
parseMorphologicalWidth();
parseFlowVelocity();
parseSedimentYield();
@@ -492,6 +499,34 @@
log.info("Parsed " + sedimentDensities.size() + " sediment densities.");
}
+ protected void parsePorosity() throws IOException {
+ if (Config.INSTANCE.skipPorosity()) {
+ log.info("skip parsing porosity.");
+ return;
+ }
+
+ log.debug("Parse porosity");
+
+ File minfoDir = getMinfoDir();
+ File porosity = new File(minfoDir, POROSITY_DIR);
+
+ File[] files = porosity.listFiles();
+
+ if (files == null) {
+ log.warn("Cannot read directory '" + porosity + "'");
+ return;
+ }
+
+ PorosityParser parser = new PorosityParser();
+
+ for (File file: files) {
+ parser.parse(file);
+ }
+
+ porosities = parser.getPorosities();
+
+ log.info("Parsed " + porosities.size() + " porosities.");
+ }
protected void parseMorphologicalWidth() throws IOException {
if (Config.INSTANCE.skipMorphologicalWidth()) {
@@ -1250,6 +1285,7 @@
storeFloodProtection();
storeBedHeight();
storeSedimentDensity();
+ storePorosity();
storeMorphologicalWidth();
storeFlowVelocity();
storeSedimentYield();
@@ -1471,6 +1507,22 @@
}
}
+ public void storePorosity() {
+ if (!Config.INSTANCE.skipPorosity()) {
+ log.info("store porosity");
+
+ River river = getPeer();
+
+ for (ImportPorosity porosity: porosities) {
+ String desc = porosity.getDescription();
+
+ log.debug("name: " + desc);
+
+ porosity.storeDependencies(river);
+ }
+ }
+ }
+
public void storeMorphologicalWidth() {
if (!Config.INSTANCE.skipMorphologicalWidth()) {
log.info("store morphological width");
More information about the Dive4Elements-commits
mailing list