[PATCH] S-Info flood durations with automatic km step width

Wald Commits scm-commit at wald.intevation.org
Fri Jul 6 17:56:36 CEST 2018


# HG changeset patch
# User mschaefer
# Date 1530892578 -7200
# Node ID b515ed950d39bab690393c1bcc21dd41ba02c313
# Parent  d47f6641f597eb686685a98d4928ac8ab8351b7f
S-Info flood durations with automatic km step width

diff -r d47f6641f597 -r b515ed950d39 artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flood_duration/FloodDurationCalculation.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flood_duration/FloodDurationCalculation.java	Fri Jul 06 15:29:12 2018 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flood_duration/FloodDurationCalculation.java	Fri Jul 06 17:56:18 2018 +0200
@@ -22,7 +22,6 @@
 import org.dive4elements.river.artifacts.sinfo.util.CalculationUtils;
 import org.dive4elements.river.artifacts.sinfo.util.RiverInfo;
 import org.dive4elements.river.model.River;
-import org.dive4elements.river.model.sinfo.Infrastructure;
 
 /**
  * Calculation of the flood durations of the infrastructures of the km range of a river
@@ -49,16 +48,15 @@
 
         final RiverInfoProvider infoProvider = RiverInfoProvider.forRange(this.context, river, calcRange);
         final String calcModeLabel = Resources.getMsg(this.context.getMeta(), sinfo.getCalculationMode().name());
-        final Infrastructure infrasSeries = Infrastructure.getSeries(river);
-        final String infrasType = (infrasSeries != null) ? infrasSeries.getType().getName() : "?";
-        final String label = infrasType + ", " + Resources.getMsg(this.context.getMeta(), access.getRiverside().getKey());
+        final String label = Resources.getMsg(this.context.getMeta(), access.getRiverside().getKey());
 
         final Calculation problems = new Calculation();
 
         // Calculate the selected main values, if any
         /* misuse winfo-artifact to calculate waterlevels in the same way */
         final WINFOArtifact winfo = new WinfoArtifactWrapper(sinfo);
-        // TODO Aktivieren wenn Step-Eingabe im Workflow weg: winfo.addStringData("ld_step", "100");
+        winfo.addStringData("ld_mode", "distance");
+        winfo.addStringData("ld_step", "100");
 
         final FloodDurationCalculationResults results = new FloodDurationCalculationResults(calcModeLabel, user, riverInfo, calcRange);
 
diff -r d47f6641f597 -r b515ed950d39 artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flood_duration/FloodDurationCalculationResult.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flood_duration/FloodDurationCalculationResult.java	Fri Jul 06 15:29:12 2018 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flood_duration/FloodDurationCalculationResult.java	Fri Jul 06 17:56:18 2018 +0200
@@ -76,8 +76,7 @@
         if (this.mainvalueLabels.length >= 1) {
             // "##METADATEN WASSERSPIEGELLAGE"
             exportContextCSV.writeCSVMetaEntry(SInfoI18NStrings.CSV_META_HEADER_WATERLEVEL);
-            for (int i = 1; i <= getWaterlevelCount(); // this.mainvalueLabels.length;
-                    i++) {
+            for (int i = 1; i <= getWaterlevelCount(); i++) {
                 // "# Bezeichnung der Wasserspiegellage: "
                 final String label = this.getMainValueLabel(i - 1);
                 exportContextCSV.writeCSVMetaEntry(SInfoI18NStrings.CSV_META_HEADER_WATERLEVEL_NAME, String.format("%d: %s", i, label));
diff -r d47f6641f597 -r b515ed950d39 artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flood_duration/FloodDurationCalculator.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flood_duration/FloodDurationCalculator.java	Fri Jul 06 15:29:12 2018 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flood_duration/FloodDurationCalculator.java	Fri Jul 06 17:56:18 2018 +0200
@@ -80,7 +80,7 @@
         // Merge all stations (range/step, borders of gauge ranges, infrastructures)
         final Map<Double, InfrastructureValue> allStations = new HashMap<>();
         final Map<Double, InfrastructureValue> secondBank = new HashMap<>(); // any second infrastructure in case of both-banks-option
-        // addRangeStations(allStations, winfo); //@Schäfer: bitte überprüfen, wie diese Funktion ersetzt werden muss
+        addRangeStations(allStations, winfo);
         addGaugeLimits(allStations, durFinders.keySet(), calcRange.getMinimumDouble(), calcRange.getMaximumDouble());
         addInfrastructures(allStations, secondBank, infras);
         final double[] stationsSorted = sortStations(allStations.keySet());


More information about the Dive4Elements-commits mailing list