diff artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepthminmax/FlowDepthMinMaxCalculation.java @ 9382:8ae7137b67d7

Fixed: avoiding NaN exception in BigDecimal rounding
author mschaefer
date Tue, 07 Aug 2018 14:06:49 +0200
parents a0a2e68a1e11
children 853f2dafc16e
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepthminmax/FlowDepthMinMaxCalculation.java	Tue Aug 07 12:43:53 2018 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepthminmax/FlowDepthMinMaxCalculation.java	Tue Aug 07 14:06:49 2018 +0200
@@ -35,7 +35,6 @@
 import org.dive4elements.river.artifacts.states.WaterlevelData;
 import org.dive4elements.river.artifacts.states.WaterlevelFetcher;
 import org.dive4elements.river.model.River;
-import org.dive4elements.river.utils.Formatter;
 
 /**
  * @author Gernot Belger
@@ -135,8 +134,8 @@
                 final double maxBedHeightValue = bedHeight.getMaxBedHeight(station);
                 final double meanBedHeight = bedHeight.getMeanBedHeight(station);
 
-                final double minFlowDepth = Math.max(Formatter.roundFlowDepth(wst).subtract(Formatter.roundFlowDepth(maxBedHeightValue)).doubleValue(), 0.0);
-                final double maxFlowDepth = Math.max(Formatter.roundFlowDepth(wst).subtract(Formatter.roundFlowDepth(minBedHeightValue)).doubleValue(), 0.0);
+                final double minFlowDepth = FlowDepthUtils.calcFlowDepth(wst, maxBedHeightValue);
+                final double maxFlowDepth = FlowDepthUtils.calcFlowDepth(wst, minBedHeightValue);
 
                 // REMARK: access the location once only during calculation
                 final String location = riverInfoProvider.getLocation(station);

http://dive4elements.wald.intevation.org