[PATCH 2 of 3] Fixed capturing invalid heights/discharges in S-Info flood duration calculation
Wald Commits
scm-commit at wald.intevation.org
Wed Jul 25 19:29:44 CEST 2018
# HG changeset patch
# User mschaefer
# Date 1532539734 -7200
# Node ID 9055afc19ec6aa9177a6e0735f60a927e9f1a098
# Parent 45bbd2c232f828a1ed22ca62f442d71f37a382b6
Fixed capturing invalid heights/discharges in S-Info flood duration calculation
diff -r 45bbd2c232f8 -r 9055afc19ec6 artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flood_duration/FloodDurationCalculator.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flood_duration/FloodDurationCalculator.java Wed Jul 25 19:27:25 2018 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flood_duration/FloodDurationCalculator.java Wed Jul 25 19:28:54 2018 +0200
@@ -449,18 +449,21 @@
final double[] qs = wst.findQsForW(infrastructure.getStation().doubleValue(), infrastructure.getHeight().doubleValue(), problems);
// TODO Fehlerbehandlung (kein Q gefunden)
final double q = (qs.length >= 1) ? qs[0] : Double.NaN;
+ // Set the result row
+ row.putValue(SInfoResultType.riverside, infrastructure.getAttributeKey());
+ row.putValue(SInfoResultType.floodDischarge, q);
+ row.putValue(SInfoResultType.infrastructureHeight, infrastructure.getHeight());
+ row.putValue(SInfoResultType.infrastructuretype, infrastructure.getInfrastructure().getType().getName());
// Determine the relative column position of the Q of the infrastructure height
final QPosition qPos = wst.getQPosition(infrastructure.getStation().doubleValue(), q);
+ if (qPos == null)
+ return;
// Get the Q for the found column position for the station of the gauge
final double qGauge = wst.getQ(qPos, gauge.getStation().doubleValue());
// Interpolate the Q-D-table of the gauge
final double dur = underflowDaysToOverflowDays(durFinders.get(gauge).getDuration(qGauge));
- // Set the result row
- row.putValue(SInfoResultType.riverside, infrastructure.getAttributeKey());
+ // Set D in the result row
row.putValue(SInfoResultType.floodDuration, dur);
- row.putValue(SInfoResultType.floodDischarge, q);
- row.putValue(SInfoResultType.infrastructureHeight, infrastructure.getHeight());
- row.putValue(SInfoResultType.infrastructuretype, infrastructure.getInfrastructure().getType().getName());
}
/**
More information about the Dive4Elements-commits
mailing list