Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/salix/SalixLineCalculation.java @ 9421:53e26734e4d2
Fixed NaN handling in salix historical scenarion calculation, added problem report
author | mschaefer |
---|---|
date | Fri, 17 Aug 2018 11:13:31 +0200 |
parents | 6e7094368e97 |
children | 853f2dafc16e |
comparison
equal
deleted
inserted
replaced
9420:2c8ba17b807e | 9421:53e26734e4d2 |
---|---|
164 final List<Double> nulls = new ArrayList<>(); | 164 final List<Double> nulls = new ArrayList<>(); |
165 nulls.add(null); | 165 nulls.add(null); |
166 rangeScenarios.put(Double.valueOf(calcRange.getLowerKm() - 0.0001), nulls); | 166 rangeScenarios.put(Double.valueOf(calcRange.getLowerKm() - 0.0001), nulls); |
167 for (final Double station : stations) { | 167 for (final Double station : stations) { |
168 rangeScenarios.put(station, new ArrayList<Double>()); | 168 rangeScenarios.put(station, new ArrayList<Double>()); |
169 rangeScenarios.get(station).add(Double.valueOf(bedHeightDifference(station.doubleValue(), currentFinders, historicalFinder))); | 169 final double delta = bedHeightDifference(station, currentFinders, historicalFinder); |
170 if (Double.isNaN(delta)) { | |
171 rangeScenarios.get(station).add(null); | |
172 if (!this.problems.hasProblems()) { | |
173 final String msg = Resources.getMsg(this.context.getMeta(), "uinfo_salix_calc.warning.missing_bedheights"); | |
174 this.problems.addProblem(station, msg); | |
175 } | |
176 } | |
177 else | |
178 rangeScenarios.get(station).add(Double.valueOf(delta)); | |
170 } | 179 } |
171 rangeScenarios.put(Double.valueOf(partTo + 0.0001), nulls); | 180 rangeScenarios.put(Double.valueOf(partTo + 0.0001), nulls); |
172 } | 181 } |
173 | 182 |
174 /** | 183 /** |
179 for (final BedHeightsFinder bhf : currentFinders) { | 188 for (final BedHeightsFinder bhf : currentFinders) { |
180 currentMSH = bhf.getMeanBedHeight(station); | 189 currentMSH = bhf.getMeanBedHeight(station); |
181 if (!Double.isNaN(currentMSH)) | 190 if (!Double.isNaN(currentMSH)) |
182 break; | 191 break; |
183 } | 192 } |
184 return Formatter.roundFlowDepth(historicalFinder.getMeanBedHeight(station)).subtract(Formatter.roundFlowDepth(currentMSH)).doubleValue(); | 193 if (Double.isNaN(currentMSH)) |
194 return Double.NaN; | |
195 final double historicalMSH = historicalFinder.getMeanBedHeight(station); | |
196 if (Double.isNaN(historicalMSH)) | |
197 return Double.NaN; | |
198 return Formatter.roundFlowDepth(historicalMSH).subtract(Formatter.roundFlowDepth(currentMSH)).doubleValue(); | |
185 } | 199 } |
186 | 200 |
187 /** | 201 /** |
188 * Builds the list of delta-w labels for the scenario type | 202 * Builds the list of delta-w labels for the scenario type |
189 */ | 203 */ |