[PATCH 2 of 4] Small changes with debug log
Wald Commits
scm-commit at wald.intevation.org
Mon Apr 23 15:25:26 CEST 2018
# HG changeset patch
# User mschaefer
# Date 1524489567 -7200
# Node ID 9b9f5f4ddb80e2161156ff9c467001cdff422d07
# Parent 6e5ff436febe65672d53ac7cd3c1bfb038983d12
Small changes with debug log
diff -r 6e5ff436febe -r 9b9f5f4ddb80 artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/tkhcalculation/BedQualityD50KmValueFinder.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/tkhcalculation/BedQualityD50KmValueFinder.java Mon Apr 23 15:18:48 2018 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/tkhcalculation/BedQualityD50KmValueFinder.java Mon Apr 23 15:19:27 2018 +0200
@@ -56,11 +56,16 @@
* If PostgreSQL would support a median aggregate function like Oracle does, the aggregation could be placed into this
* query.
*/
- private static final String SQL_BED_D50_SUBLAYER_MEASUREMENT = "SELECT t.km, t.datum, p.tiefevon, p.tiefebis, a.d50"
- + " FROM sohltest t INNER JOIN station s ON t.stationid = s.stationid" + " INNER JOIN gewaesser g ON s.gewaesserid = g.gewaesserid"
- + " INNER JOIN sohlprobe p ON t.sohltestid = p.sohltestid" + " INNER JOIN siebanalyse a ON p.sohlprobeid = a.sohlprobeid"
- + " WHERE (g.name = :name) AND (s.km BETWEEN :fromkm - 0.0001 AND :tokm + 0.0001)" + " AND (p.tiefevon > 0.0) AND (p.tiefebis <= 0.5)"
- + " AND (t.datum BETWEEN :fromdate AND :todate)" + " ORDER BY t.km ASC, a.d50 ASC";
+ private static final String SQL_BED_D50_SUBLAYER_MEASUREMENT = //
+ "SELECT t.km, t.datum, p.tiefevon, p.tiefebis, a.d50" //
+ + " FROM sohltest t INNER JOIN station s ON t.stationid = s.stationid" //
+ + " INNER JOIN gewaesser g ON s.gewaesserid = g.gewaesserid" //
+ + " INNER JOIN sohlprobe p ON t.sohltestid = p.sohltestid" //
+ + " INNER JOIN siebanalyse a ON p.sohlprobeid = a.sohlprobeid" //
+ + " WHERE (g.name = :name) AND (s.km BETWEEN :fromkm - 0.0001 AND :tokm + 0.0001)" //
+ + " AND (p.tiefevon > 0.0) AND (p.tiefebis <= 0.5)" //
+ + " AND (t.datum BETWEEN :fromdate AND :todate)" //
+ + " ORDER BY t.km ASC, a.d50 ASC";
private Calculation problems;
@@ -116,16 +121,22 @@
final TDoubleArrayList values = new TDoubleArrayList();
final TDoubleArrayList kmd50s = new TDoubleArrayList();
+ // Median aggregate d50 values for each km
for (int i = 0; i <= rows.size() - 1; i++) {
kmd50s.add((double) rows.get(i)[4]);
if (((i == rows.size() - 1) || !Utils.epsilonEquals((double) rows.get(i)[0], (double) rows.get(i + 1)[0], 0.0001))) {
final int k = kmd50s.size() / 2;
values.add(((k + k < kmd50s.size()) ? kmd50s.get(k) : (kmd50s.get(k - 1) + kmd50s.get(k)) / 2) / 1000);
kms.add((double) rows.get(i)[0]);
- log.debug(String.format("loadValues km %.3f d50(mm) %.1f count %d", kms.get(kms.size() - 1), values.get(values.size() - 1), kmd50s.size()));
+ log.debug(String.format("loadValues km %.3f d50(mm) %.1f count %d", kms.get(kms.size() - 1), values.get(values.size() - 1) * 1000,
+ kmd50s.size()));
kmd50s.clear();
}
}
+ if (kms.size() >= 1)
+ log.debug(String.format("loadValues: %d kms found from %.3f to %.3f", kms.size(), kms.get(0), kms.get(kms.size() - 1)));
+ else
+ log.debug("loadValues: no kms found");
if (kms.size() < 2 || values.size() < 2) {
problems.addProblem("bedqualityd50kmvaluefinder.empty", soundingYear);
diff -r 6e5ff436febe -r 9b9f5f4ddb80 artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/tkhcalculation/FlowVelocityModelKmValueFinder.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/tkhcalculation/FlowVelocityModelKmValueFinder.java Mon Apr 23 15:18:48 2018 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/tkhcalculation/FlowVelocityModelKmValueFinder.java Mon Apr 23 15:19:27 2018 +0200
@@ -318,13 +318,14 @@
if (this.leftIndexFound == this.rightIndexFound) {
// Exact km match
final double qfound = getLeftValues().findQ(q);
- log.debug(String.format("findKmQValues km %.3f q %.0f = %.0f (%d)", km, q, qfound, this.leftIndexFound));
+ log.debug(String.format("findKmQValues km %.3f q %.0f = %.0f (%d) v = %.3f, tau = %.3f", km, q, qfound, this.leftIndexFound,
+ this.getFindVmainFound(), this.getFindTauFound()));
return !Double.isNaN(qfound);
}
final double[] qfound = { getLeftValues().findQ(q), getRightValues().findQ(q) };
- log.debug(String.format("findKmQValues km %.3f q %.0f = %.0f (%d, %.3f) - %.0f (%d, %.3f)", km, q, qfound[0], this.leftIndexFound,
- getLeftValues().getKm(), qfound[1], this.rightIndexFound, getRightValues().getKm()));
+ log.debug(String.format("findKmQValues km %.3f q %.0f = %.0f (%d, %.3f) - %.0f (%d, %.3f) v = %.3f, tau = %.3f", km, q, qfound[0], this.leftIndexFound,
+ getLeftValues().getKm(), qfound[1], this.rightIndexFound, getRightValues().getKm(), this.getFindVmainFound(), this.getFindTauFound()));
return !Double.isNaN(qfound[0]) && !Double.isNaN(qfound[1]);
}
More information about the Dive4Elements-commits
mailing list