comparison artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flood_duration/FloodDurationCalculator.java @ 9614:d889ffe2fb05

Nachtrag Pos. 20: rename type/part to group/type, group added in Infrastructure class
author mschaefer
date Wed, 09 Oct 2019 19:17:06 +0200
parents f8308db94634
children 26e113e8224f
comparison
equal deleted inserted replaced
9612:f8308db94634 9614:d889ffe2fb05
284 */ 284 */
285 private ResultRow createRow(final Double station, final WQKms[] wqkmsArray, final List<Double> gaugeDurations, final int kmIndex) { 285 private ResultRow createRow(final Double station, final WQKms[] wqkmsArray, final List<Double> gaugeDurations, final int kmIndex) {
286 286
287 final ResultRow row = ResultRow.create(); 287 final ResultRow row = ResultRow.create();
288 row.putValue(GeneralResultType.station, station); 288 row.putValue(GeneralResultType.station, station);
289 row.putValue(SInfoResultType.infrastructuretype, null); // is replaced later for an infrastructure type 289 row.putValue(SInfoResultType.infrastructuregroup, null); // is replaced later for an infrastructure type
290 row.putValue(SInfoResultType.infrastructurepart, null); // is replaced later for an infrastructure part 290 row.putValue(SInfoResultType.infrastructuretype, null); // is replaced later for an infrastructure part
291 row.putValue(SInfoResultType.floodDuration, Double.NaN); // is replaced later for an infrastructure 291 row.putValue(SInfoResultType.floodDuration, Double.NaN); // is replaced later for an infrastructure
292 292
293 final String gaugeLabel = this.riverInfoProvider2.findGauge(station); 293 final String gaugeLabel = this.riverInfoProvider2.findGauge(station);
294 row.putValue(GeneralResultType.gaugeLabel, gaugeLabel); 294 row.putValue(GeneralResultType.gaugeLabel, gaugeLabel);
295 295
308 return row; 308 return row;
309 } 309 }
310 310
311 /** 311 /**
312 * Calculate the result row fields for one infrastructure 312 * Calculate the result row fields for one infrastructure
313 *
314 * @param map
315 */ 313 */
316 private void calculateInfrastructure(final ResultRow row, final Gauge gauge, final InfrastructureValue infrastructure, final WstValueTable wst, 314 private void calculateInfrastructure(final ResultRow row, final Gauge gauge, final InfrastructureValue infrastructure, final WstValueTable wst,
317 final Map<Gauge, GaugeDurationValuesFinder> durFinders, final Set<Infrastructure> infrastructures) { 315 final Map<Gauge, GaugeDurationValuesFinder> durFinders, final Set<Infrastructure> infrastructures) {
318 316
319 // Interpolate the infrastructure height in the wst table to get the corresponding Q 317 // Interpolate the infrastructure height in the wst table to get the corresponding Q
323 final double q = (qs.length >= 1) ? qs[0] : Double.NaN; 321 final double q = (qs.length >= 1) ? qs[0] : Double.NaN;
324 // Set the result row 322 // Set the result row
325 row.putValue(SInfoResultType.riverside, infrastructure.getAttributeKey()); 323 row.putValue(SInfoResultType.riverside, infrastructure.getAttributeKey());
326 row.putValue(SInfoResultType.floodDischarge, q); 324 row.putValue(SInfoResultType.floodDischarge, q);
327 row.putValue(SInfoResultType.infrastructureHeight, infrastructure.getHeight()); 325 row.putValue(SInfoResultType.infrastructureHeight, infrastructure.getHeight());
326 row.putValue(SInfoResultType.infrastructuregroup, infrastructure.getInfrastructure().getGroup().getName());
328 row.putValue(SInfoResultType.infrastructuretype, infrastructure.getInfrastructure().getType().getName()); 327 row.putValue(SInfoResultType.infrastructuretype, infrastructure.getInfrastructure().getType().getName());
329 328
330 int dochNichtRandom = (int) (q / 20 + 1);
331 if (dochNichtRandom > 10)
332 dochNichtRandom = 4;
333
334 row.putValue(SInfoResultType.infrastructurepart, "TEST_" + dochNichtRandom);
335 // Determine the relative column position of the Q of the infrastructure height 329 // Determine the relative column position of the Q of the infrastructure height
336 final QPosition qPos = wst.getQPosition(infrastructure.getStation().doubleValue(), q); 330 final QPosition qPos = wst.getQPosition(infrastructure.getStation().doubleValue(), q);
337 if (qPos == null) 331 if (qPos == null)
338 return; 332 return;
339 // Get the Q for the found column position for the station of the gauge 333 // Get the Q for the found column position for the station of the gauge
341 // Interpolate the Q-D-table of the gauge 335 // Interpolate the Q-D-table of the gauge
342 final double dur = underflowDaysToOverflowDays(durFinders.get(gauge).getDuration(qGauge)); 336 final double dur = underflowDaysToOverflowDays(durFinders.get(gauge).getDuration(qGauge));
343 // Set D in the result row 337 // Set D in the result row
344 row.putValue(SInfoResultType.floodDuration, dur); 338 row.putValue(SInfoResultType.floodDuration, dur);
345 339
346 final FloodDurationCalculationResult.Infrastructure typePart = new FloodDurationCalculationResult.Infrastructure(row); 340 final FloodDurationCalculationResult.Infrastructure groupType = new FloodDurationCalculationResult.Infrastructure(row);
347 infrastructures.add(typePart); 341 infrastructures.add(groupType);
348 } 342 }
349 343
350 /** 344 /**
351 * Translates underflow duration into overflow duration 345 * Translates underflow duration into overflow duration
352 */ 346 */

http://dive4elements.wald.intevation.org