comparison artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/salix/SalixLineCalculation.java @ 9504:76c0665888a3

No rounding during calculation (Meilenstein-2 2.4.2 and 2.9), delta-w-cm as double (for historical scenario)
author mschaefer
date Fri, 28 Sep 2018 10:13:09 +0200
parents 853f2dafc16e
children 429b62373633
comparison
equal deleted inserted replaced
9503:83e6acdf8fc6 9504:76c0665888a3
16 import java.util.TreeMap; 16 import java.util.TreeMap;
17 17
18 import org.apache.commons.lang.math.DoubleRange; 18 import org.apache.commons.lang.math.DoubleRange;
19 import org.dive4elements.artifacts.CallContext; 19 import org.dive4elements.artifacts.CallContext;
20 import org.dive4elements.river.artifacts.access.RangeAccess; 20 import org.dive4elements.river.artifacts.access.RangeAccess;
21 import org.dive4elements.river.artifacts.common.AbstractResultType;
22 import org.dive4elements.river.artifacts.common.GeneralResultType; 21 import org.dive4elements.river.artifacts.common.GeneralResultType;
23 import org.dive4elements.river.artifacts.model.Calculation; 22 import org.dive4elements.river.artifacts.model.Calculation;
24 import org.dive4elements.river.artifacts.model.CalculationResult; 23 import org.dive4elements.river.artifacts.model.CalculationResult;
25 import org.dive4elements.river.artifacts.model.river.RiverInfoProvider; 24 import org.dive4elements.river.artifacts.model.river.RiverInfoProvider;
26 import org.dive4elements.river.artifacts.resources.Resources; 25 import org.dive4elements.river.artifacts.resources.Resources;
31 import org.dive4elements.river.artifacts.sinfo.util.RiverInfo; 30 import org.dive4elements.river.artifacts.sinfo.util.RiverInfo;
32 import org.dive4elements.river.artifacts.uinfo.UINFOArtifact; 31 import org.dive4elements.river.artifacts.uinfo.UINFOArtifact;
33 import org.dive4elements.river.artifacts.uinfo.salix.SalixLineAccess.ScenarioType; 32 import org.dive4elements.river.artifacts.uinfo.salix.SalixLineAccess.ScenarioType;
34 import org.dive4elements.river.model.BedHeight; 33 import org.dive4elements.river.model.BedHeight;
35 import org.dive4elements.river.model.River; 34 import org.dive4elements.river.model.River;
36 import org.dive4elements.river.utils.Formatter;
37 35
38 /** 36 /**
39 * Calculation of a iota (former salix) longitudinal section, optionally with a delta scenario 37 * Calculation of a iota (former salix) longitudinal section, optionally with a delta scenario
40 * 38 *
41 * @author Domenico Nardi Tironi 39 * @author Domenico Nardi Tironi
192 if (Double.isNaN(currentMSH)) 190 if (Double.isNaN(currentMSH))
193 return Double.NaN; 191 return Double.NaN;
194 final double historicalMSH = historicalFinder.getMeanBedHeight(station); 192 final double historicalMSH = historicalFinder.getMeanBedHeight(station);
195 if (Double.isNaN(historicalMSH)) 193 if (Double.isNaN(historicalMSH))
196 return Double.NaN; 194 return Double.NaN;
197 return Formatter.roundFlowDepth(historicalMSH).subtract(Formatter.roundFlowDepth(currentMSH)).doubleValue(); 195 return (historicalMSH - currentMSH);
198 } 196 }
199 197
200 /** 198 /**
201 * Builds the list of delta-w labels for the scenario type 199 * Builds the list of delta-w labels for the scenario type
202 */ 200 */
266 } 264 }
267 return deltas; 265 return deltas;
268 } 266 }
269 return ""; 267 return "";
270 } 268 }
271
272 // FIXME: check if needed
273 /**
274 * Fetches a iota or waterlevel height of a station from a salix calculation result
275 */
276 public double fetchStationHeight(final double station, final AbstractResultType resultType, final SalixLineCalculationResult result) {
277
278 final Calculation problems = new Calculation();
279
280 final SalixLineCalculator calculator = new SalixLineCalculator(null);
281 return calculator.fetchStationHeight(problems, station, resultType, result);
282 }
283 } 269 }

http://dive4elements.wald.intevation.org