comparison artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepthdev/FlowDepthDevelopmentCalculation.java @ 9312:740d65e4aa14

Q [m³/s] one message
author gernotbelger
date Thu, 26 Jul 2018 15:54:20 +0200
parents 5294114b1df4
children 392745cccede
comparison
equal deleted inserted replaced
9311:7c7f73e5e01e 9312:740d65e4aa14
115 } 115 }
116 116
117 FlowDepthUtils.checkYearDifference(Resources.getMsg(this.context.getMeta(), "flowdepthdevelopmentcalculation.yearDifferenceCurrent"), currentWstYear, 117 FlowDepthUtils.checkYearDifference(Resources.getMsg(this.context.getMeta(), "flowdepthdevelopmentcalculation.yearDifferenceCurrent"), currentWstYear,
118 currentSoundingYear, problems); 118 currentSoundingYear, problems);
119 FlowDepthUtils.checkYearDifference(Resources.getMsg(this.context.getMeta(), "flowdepthdevelopmentcalculation.yearDifferenceHistorical"), 119 FlowDepthUtils.checkYearDifference(Resources.getMsg(this.context.getMeta(), "flowdepthdevelopmentcalculation.yearDifferenceHistorical"),
120 historicalWstYear, 120 historicalWstYear, historicalSoundingYear, problems);
121 historicalSoundingYear, problems);
122 121
123 /* re-determine the reference gauge, in the same way as the WaterlevelArtifact would do it */ 122 /* re-determine the reference gauge, in the same way as the WaterlevelArtifact would do it */
124 final RiverInfoProvider currentRiverInfoProvider = infoProvider.forWaterlevel(currentWaterlevel); 123 final RiverInfoProvider currentRiverInfoProvider = infoProvider.forWaterlevel(currentWaterlevel);
125 final RiverInfoProvider histRiverInfoProvider = infoProvider.forWaterlevel(historicalWaterlevel); 124 final RiverInfoProvider histRiverInfoProvider = infoProvider.forWaterlevel(historicalWaterlevel);
126 125
137 final int historcialMeanYear = (historicalWstYear + historicalSoundingYear) / 2; 136 final int historcialMeanYear = (historicalWstYear + historicalSoundingYear) / 2;
138 137
139 final double diffYear = currentMeanYear - historcialMeanYear; 138 final double diffYear = currentMeanYear - historcialMeanYear;
140 139
141 /* real calculation loop */ 140 /* real calculation loop */
142 final Collection< ResultRow> rows = new ArrayList<>(); 141 final Collection<ResultRow> rows = new ArrayList<>();
143 142
144 final Collection<Double> stations = determineCalculationSteps(currentSounding, historicalSounding); 143 final Collection<Double> stations = determineCalculationSteps(currentSounding, historicalSounding);
145 for (final double station : stations) { 144 for (final double station : stations) {
146 if (calcRange.containsDouble(station)) { 145 if (calcRange.containsDouble(station)) {
147 146
166 final double historicalFlowDepth = historicalWst - historicalBedHeight; 165 final double historicalFlowDepth = historicalWst - historicalBedHeight;
167 166
168 // REMARK: access the location once only during calculation 167 // REMARK: access the location once only during calculation
169 final String location = currentRiverInfoProvider.getLocation(station); 168 final String location = currentRiverInfoProvider.getLocation(station);
170 169
171 final ResultRow row = ResultRow.create().// 170 final ResultRow row = ResultRow.create().//
172 putValue(GeneralResultType.station, station). // 171 putValue(GeneralResultType.station, station). //
173 putValue(SInfoResultType.flowdepthDevelopment, flowDepthDevelopment). // 172 putValue(SInfoResultType.flowdepthDevelopment, flowDepthDevelopment). //
174 putValue(SInfoResultType.flowdepthDevelopmentPerYear, flowDepthDevelopmentPerYear). // 173 putValue(SInfoResultType.flowdepthDevelopmentPerYear, flowDepthDevelopmentPerYear). //
175 putValue(SInfoResultType.waterlevelDifference, diffWst). // 174 putValue(SInfoResultType.waterlevelDifference, diffWst). //
176 putValue(SInfoResultType.bedHeightDifference, diffBedHeight). // 175 putValue(SInfoResultType.bedHeightDifference, diffBedHeight). //
177 putValue(SInfoResultType.flowdepthCurrent, currentFlowDepth). // 176 putValue(SInfoResultType.flowdepthCurrent, currentFlowDepth). //
178 putValue(SInfoResultType.flowdepthHistorical, historicalFlowDepth). // 177 putValue(SInfoResultType.flowdepthHistorical, historicalFlowDepth). //
179 putValue(SInfoResultType.location, location); 178 putValue(GeneralResultType.location, location);
180 rows.add(row); 179 rows.add(row);
181 } 180 }
182 } 181 }
183 182
184 final String label = buildLabel(currentWaterlevel, currentSoundingInfo, historicalWaterlevel, historicalSoundingInfo); 183 final String label = buildLabel(currentWaterlevel, currentSoundingInfo, historicalWaterlevel, historicalSoundingInfo);
185 184
186 return new FlowDepthDevelopmentCalculationResult(label, currentWstInfo, historicalWstInfo, currentSoundingInfo, historicalSoundingInfo, 185 return new FlowDepthDevelopmentCalculationResult(label, currentWstInfo, historicalWstInfo, currentSoundingInfo, historicalSoundingInfo, rows);
187 rows);
188 } 186 }
189 187
190 /** 188 /**
191 * Calculation steps are simply the union of all stations of all involved bed-height datasets 189 * Calculation steps are simply the union of all stations of all involved bed-height datasets
192 */ 190 */

http://dive4elements.wald.intevation.org