Mercurial > dive4elements > river
comparison 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 |
comparison
equal
deleted
inserted
replaced
9381:a9e6b0a75bde | 9382:8ae7137b67d7 |
---|---|
33 import org.dive4elements.river.artifacts.sinfo.util.RiverInfo; | 33 import org.dive4elements.river.artifacts.sinfo.util.RiverInfo; |
34 import org.dive4elements.river.artifacts.sinfo.util.WstInfo; | 34 import org.dive4elements.river.artifacts.sinfo.util.WstInfo; |
35 import org.dive4elements.river.artifacts.states.WaterlevelData; | 35 import org.dive4elements.river.artifacts.states.WaterlevelData; |
36 import org.dive4elements.river.artifacts.states.WaterlevelFetcher; | 36 import org.dive4elements.river.artifacts.states.WaterlevelFetcher; |
37 import org.dive4elements.river.model.River; | 37 import org.dive4elements.river.model.River; |
38 import org.dive4elements.river.utils.Formatter; | |
39 | 38 |
40 /** | 39 /** |
41 * @author Gernot Belger | 40 * @author Gernot Belger |
42 */ | 41 */ |
43 final class FlowDepthMinMaxCalculation { | 42 final class FlowDepthMinMaxCalculation { |
133 | 132 |
134 final double minBedHeightValue = bedHeight.getMinBedHeight(station); | 133 final double minBedHeightValue = bedHeight.getMinBedHeight(station); |
135 final double maxBedHeightValue = bedHeight.getMaxBedHeight(station); | 134 final double maxBedHeightValue = bedHeight.getMaxBedHeight(station); |
136 final double meanBedHeight = bedHeight.getMeanBedHeight(station); | 135 final double meanBedHeight = bedHeight.getMeanBedHeight(station); |
137 | 136 |
138 final double minFlowDepth = Math.max(Formatter.roundFlowDepth(wst).subtract(Formatter.roundFlowDepth(maxBedHeightValue)).doubleValue(), 0.0); | 137 final double minFlowDepth = FlowDepthUtils.calcFlowDepth(wst, maxBedHeightValue); |
139 final double maxFlowDepth = Math.max(Formatter.roundFlowDepth(wst).subtract(Formatter.roundFlowDepth(minBedHeightValue)).doubleValue(), 0.0); | 138 final double maxFlowDepth = FlowDepthUtils.calcFlowDepth(wst, minBedHeightValue); |
140 | 139 |
141 // REMARK: access the location once only during calculation | 140 // REMARK: access the location once only during calculation |
142 final String location = riverInfoProvider.getLocation(station); | 141 final String location = riverInfoProvider.getLocation(station); |
143 | 142 |
144 // REMARK: access the gauge once only during calculation | 143 // REMARK: access the gauge once only during calculation |