comparison artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flood_duration/FloodDurationCalculator.java @ 9308:9055afc19ec6

Fixed capturing invalid heights/discharges in S-Info flood duration calculation
author mschaefer
date Wed, 25 Jul 2018 19:28:54 +0200
parents 0b1a51b0c42e
children 740d65e4aa14
comparison
equal deleted inserted replaced
9307:45bbd2c232f8 9308:9055afc19ec6
447 // Interpolate the infrastructure height in the wst table to get the corresponding Q 447 // Interpolate the infrastructure height in the wst table to get the corresponding Q
448 final Calculation problems = new Calculation(); 448 final Calculation problems = new Calculation();
449 final double[] qs = wst.findQsForW(infrastructure.getStation().doubleValue(), infrastructure.getHeight().doubleValue(), problems); 449 final double[] qs = wst.findQsForW(infrastructure.getStation().doubleValue(), infrastructure.getHeight().doubleValue(), problems);
450 // TODO Fehlerbehandlung (kein Q gefunden) 450 // TODO Fehlerbehandlung (kein Q gefunden)
451 final double q = (qs.length >= 1) ? qs[0] : Double.NaN; 451 final double q = (qs.length >= 1) ? qs[0] : Double.NaN;
452 // Set the result row
453 row.putValue(SInfoResultType.riverside, infrastructure.getAttributeKey());
454 row.putValue(SInfoResultType.floodDischarge, q);
455 row.putValue(SInfoResultType.infrastructureHeight, infrastructure.getHeight());
456 row.putValue(SInfoResultType.infrastructuretype, infrastructure.getInfrastructure().getType().getName());
452 // Determine the relative column position of the Q of the infrastructure height 457 // Determine the relative column position of the Q of the infrastructure height
453 final QPosition qPos = wst.getQPosition(infrastructure.getStation().doubleValue(), q); 458 final QPosition qPos = wst.getQPosition(infrastructure.getStation().doubleValue(), q);
459 if (qPos == null)
460 return;
454 // Get the Q for the found column position for the station of the gauge 461 // Get the Q for the found column position for the station of the gauge
455 final double qGauge = wst.getQ(qPos, gauge.getStation().doubleValue()); 462 final double qGauge = wst.getQ(qPos, gauge.getStation().doubleValue());
456 // Interpolate the Q-D-table of the gauge 463 // Interpolate the Q-D-table of the gauge
457 final double dur = underflowDaysToOverflowDays(durFinders.get(gauge).getDuration(qGauge)); 464 final double dur = underflowDaysToOverflowDays(durFinders.get(gauge).getDuration(qGauge));
458 // Set the result row 465 // Set D in the result row
459 row.putValue(SInfoResultType.riverside, infrastructure.getAttributeKey());
460 row.putValue(SInfoResultType.floodDuration, dur); 466 row.putValue(SInfoResultType.floodDuration, dur);
461 row.putValue(SInfoResultType.floodDischarge, q);
462 row.putValue(SInfoResultType.infrastructureHeight, infrastructure.getHeight());
463 row.putValue(SInfoResultType.infrastructuretype, infrastructure.getInfrastructure().getType().getName());
464 } 467 }
465 468
466 /** 469 /**
467 * Translates underflow duration into overflow duration 470 * Translates underflow duration into overflow duration
468 */ 471 */

http://dive4elements.wald.intevation.org