[PATCH] Added computation of uinfo salix line vegetation zone height (not yet connected to the cross section facet)

Wald Commits scm-commit at wald.intevation.org
Mon Aug 20 18:50:48 CEST 2018


# HG changeset patch
# User mschaefer
# Date 1534783833 -7200
# Node ID 515643b2c49a30501ab16af5207825cba12e0599
# Parent  173f188569c6403eb41f5e7810d5c112ee182866
Added computation of uinfo salix line vegetation zone height (not yet connected to the cross section facet)

diff -r 173f188569c6 -r 515643b2c49a artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/salix/SalixLineCalculationResult.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/salix/SalixLineCalculationResult.java	Mon Aug 20 18:20:15 2018 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/salix/SalixLineCalculationResult.java	Mon Aug 20 18:50:33 2018 +0200
@@ -22,6 +22,7 @@
 import org.dive4elements.river.artifacts.common.IExportContext;
 import org.dive4elements.river.artifacts.common.MetaAndTableJRDataSource;
 import org.dive4elements.river.artifacts.common.ResultRow;
+import org.dive4elements.river.artifacts.model.Calculation;
 import org.dive4elements.river.artifacts.sinfo.util.RiverInfo;
 import org.dive4elements.river.artifacts.uinfo.common.UInfoResultType;
 import org.dive4elements.river.artifacts.uinfo.salix.SalixLineCrossSectionIndexData.SalixWaterlevel;
@@ -223,4 +224,15 @@
             throw new UnsupportedOperationException();
         }
     }
+
+    /**
+     * Computes the height of a vegetation zone type for a station and a salix calculation result
+     */
+    public double computeVegetationZoneHeight(final double station, final int vegetationZoneType, final SalixLineCalculationResult result) {
+
+        final Calculation problems = new Calculation();
+
+        final SalixLineCalculator calculator = new SalixLineCalculator(null);
+        return calculator.computeVegetationZoneHeight(problems, station, vegetationZoneType, result);
+    }
 }
\ No newline at end of file
diff -r 173f188569c6 -r 515643b2c49a artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/salix/SalixLineCalculator.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/salix/SalixLineCalculator.java	Mon Aug 20 18:20:15 2018 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/salix/SalixLineCalculator.java	Mon Aug 20 18:50:33 2018 +0200
@@ -32,6 +32,7 @@
 import org.dive4elements.river.artifacts.uinfo.UINFOArtifact;
 import org.dive4elements.river.artifacts.uinfo.common.UInfoResultType;
 import org.dive4elements.river.artifacts.uinfo.salix.SalixLineAccess.ScenarioType;
+import org.dive4elements.river.artifacts.uinfo.vegetationzones.VegetationZoneServerClientXChange;
 import org.dive4elements.river.model.Gauge;
 import org.dive4elements.river.model.MainValue;
 import org.dive4elements.river.model.MainValueType.MainValueTypeKey;
@@ -249,4 +250,28 @@
         }
         return null;
     }
-}
\ No newline at end of file
+
+    /**
+     * Computes the height of a vegetation zone limit for a station and a previously computed salix line result
+     */
+    public double computeVegetationZoneHeight(final Calculation problems, final double station, final int vegetationZoneType,
+            final SalixLineCalculationResult result) {
+
+        // Search the station in the previously calculated result rows
+        final ResultRow stationRow = searchStation(station, result.getRows());
+        if (stationRow == null)
+            return Double.NaN;
+        // Compute height from overflow duration days
+        final List<VegetationZoneServerClientXChange> vzs = VegetationZoneServerClientXChange.getStandardList(null, null); // TODO river, context
+        if ((vegetationZoneType >= 1) && (vegetationZoneType <= vzs.size())) {
+            final int uefd = vzs.get(vegetationZoneType - 1).getMin_day_overflow();
+            // Üfd = -70,559 ∗ ln((DGM - MW) + 0,5) + 80,711
+            final double f1 = -70.559;
+            final double f2 = -88.711;
+            final double mw = stationRow.getDoubleValue(UInfoResultType.waterlevelMW);
+            final double dgm = Math.exp((uefd - f2) / f1) + mw - 0.5;
+            return dgm;
+        }
+        return Double.NaN;
+    }
+}
diff -r 173f188569c6 -r 515643b2c49a artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/vegetationzones/VegetationZoneServerClientXChange.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/vegetationzones/VegetationZoneServerClientXChange.java	Mon Aug 20 18:20:15 2018 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/vegetationzones/VegetationZoneServerClientXChange.java	Mon Aug 20 18:50:33 2018 +0200
@@ -16,6 +16,8 @@
 import org.dive4elements.artifacts.CallContext;
 import org.dive4elements.river.artifacts.resources.Resources;
 import org.dive4elements.river.model.River;
+import org.dive4elements.river.model.uinfo.VegetationType;
+import org.dive4elements.river.model.uinfo.VegetationZone;
 
 /**
  * @author Domenico Nardi Tironi
@@ -91,11 +93,15 @@
         return this.min_day_overflow;
     }
 
+    public static String getLocalizedVegetationTypeName(final CallContext context, final VegetationType zonetype) {
+        return Resources.getMsg(context.getMeta(), "uinfo_vegetation_type_" + zonetype.getId().toString());
+    }
+
     public static final List<VegetationZoneServerClientXChange> getStandardList(final River river, final CallContext context) {
 
         final List<VegetationZoneServerClientXChange> list = new ArrayList<>();
-        for (final org.dive4elements.river.model.uinfo.VegetationZone vz : org.dive4elements.river.model.uinfo.VegetationZone.getValues(river)) {
-            final String zn = Resources.getMsg(context.getMeta(), "uinfo_vegetation_type_" + vz.getVegetationType().getId().toString());
+        for (final VegetationZone vz : VegetationZone.getValues(river)) {
+            final String zn = getLocalizedVegetationTypeName(context, vz.getVegetationType());
             list.add(new VegetationZoneServerClientXChange(zn, vz.getMin_overflow_days(), vz.getMax_overflow_days(), vz.getColor()));
         }
         return list;
diff -r 173f188569c6 -r 515643b2c49a gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants_de.properties
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants_de.properties	Mon Aug 20 18:20:15 2018 +0200
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants_de.properties	Mon Aug 20 18:50:33 2018 +0200
@@ -850,7 +850,7 @@
 uinfo_salix_km_has_gaps = Der Km-Bereich ist nicht vollst. belegt.
 uinfo_salix_km_anschluss = Der eingegebene Bereich schlie\u00dft nicht an den letzten Wert an.
 uinfo_salix_input_complete = Die gesamte Strecke ist bereits mit Werten belegt.
-uinfo_salix_lines = Iotasn
+uinfo_salix_lines = Iota
 uinfo_salix_line = Iota - L\u00e4ngsschnitt
 
 bundu = Betrieb und Unterhaltung


More information about the Dive4Elements-commits mailing list