diff artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/salix/SalixLineCalculator.java @ 9443:515643b2c49a

Added computation of uinfo salix line vegetation zone height (not yet connected to the cross section facet)
author mschaefer
date Mon, 20 Aug 2018 18:50:33 +0200
parents e8b1255fc89e
children e44c1a8b0c54
line wrap: on
line diff
--- 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;
+    }
+}

http://dive4elements.wald.intevation.org