diff artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepth/FlowDepthCalculator.java @ 8940:82998242ba84

Preparing for additional outputs of SINFO-Tkh
author gernotbelger
date Tue, 06 Mar 2018 18:51:18 +0100
parents d9dbf0b74bc2
children 5d5d482da3e9
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepth/FlowDepthCalculator.java	Tue Mar 06 17:14:56 2018 +0100
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepth/FlowDepthCalculator.java	Tue Mar 06 18:51:18 2018 +0100
@@ -18,7 +18,6 @@
 import org.dive4elements.river.artifacts.model.WKms;
 import org.dive4elements.river.artifacts.sinfo.common.RiverInfoProvider;
 import org.dive4elements.river.artifacts.sinfo.tkhcalculation.DischargeValuesFinder;
-import org.dive4elements.river.artifacts.sinfo.tkhcalculation.SoilKind;
 import org.dive4elements.river.artifacts.sinfo.tkhcalculation.Tkh;
 import org.dive4elements.river.artifacts.sinfo.tkhcalculation.TkhCalculator;
 import org.dive4elements.river.artifacts.sinfo.tkhstate.BedHeightsFinder;
@@ -80,18 +79,13 @@
 
             final Tkh tkh = calculateTkh(station, wst);
 
-            final double meanBedHeight = tkh.getMeanBedHeight();
-
-            final double flowDepth = wst - meanBedHeight;
-            final double flowDepthTkh = calculateFlowDepthTkh(tkh, wst, meanBedHeight);
-
             // REMARK: access the location once only during calculation
             final String location = this.riverInfoProvider.getLocation(station);
 
             // REMARK: access the gauge once only during calculation
             final String gaugeLabel = this.riverInfoProvider.findGauge(station);
 
-            this.rows.add(new FlowDepthRow(flowDepth, flowDepthTkh, tkh, this.wstLabel, gaugeLabel, this.bedHeightLabel, location));
+            this.rows.add(new FlowDepthRow(tkh, this.wstLabel, gaugeLabel, this.bedHeightLabel, location));
         }
         catch (final FunctionEvaluationException e) {
             /* should only happen if out of range */
@@ -104,26 +98,10 @@
         if (this.tkhCalculator == null) {
             final double discharge = this.dischargeProvider.getDischarge(station);
             final double meanBedHeight = this.bedHeight.getMeanBedHeight(station);
-            return new Tkh(station, wst, meanBedHeight, discharge);
+            final double flowDepth = wst - meanBedHeight;
+            return new Tkh(station, wst, meanBedHeight, flowDepth, discharge);
         }
 
         return this.tkhCalculator.getTkh(station, wst);
     }
-
-    private double calculateFlowDepthTkh(final Tkh tkh, final double wst, final double meanBedHeight) {
-        final double tkhValue = tkh.getTkh();
-        final SoilKind tkhKind = tkh.getKind();
-
-        if (Double.isNaN(tkhValue) || tkhKind == null)
-            return Double.NaN;
-
-        switch (tkhKind) {
-        case starr:
-            return wst - (meanBedHeight + tkhValue / 100);
-
-        case mobil:
-        default:
-            return wst - (meanBedHeight + tkhValue / 200);
-        }
-    }
 }
\ No newline at end of file

http://dive4elements.wald.intevation.org