[PATCH] issue1418: Fetch correct (not necessarily first) gauge

Wald Commits scm-commit at wald.intevation.org
Thu Aug 1 10:05:13 CEST 2013


# HG changeset patch
# User Felix Wolfsteller <felix.wolfsteller at intevation.de>
# Date 1375344900 -7200
# Node ID be8a5e1911ed10b16638a9c0b0c9f2769b78e013
# Parent  1960d55bafb1abfee2360179e1d4abbdada54d3f
issue1418: Fetch correct (not necessarily first) gauge
when determining if at gauge.

diff -r 1960d55bafb1 -r be8a5e1911ed artifacts/src/main/java/org/dive4elements/river/exports/DischargeCurveGenerator.java
--- a/artifacts/src/main/java/org/dive4elements/river/exports/DischargeCurveGenerator.java	Wed Jul 31 15:41:57 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/DischargeCurveGenerator.java	Thu Aug 01 10:15:00 2013 +0200
@@ -72,9 +72,12 @@
      * Returns the PNP (Datum) of gauge, if at gauge, 0 otherwise.
      */
     public static double getCurrentGaugeDatum(double km, D4EArtifact artifact, double tolerance) {
-        // Code borrowed from FixATWriter.
-        Gauge gauge = RiverUtils.getGauge(artifact);
+        // Look if there is a gauge at chosen km:
+        // Get gauge which is defined for km
+        Gauge gauge =
+            RiverUtils.getRiver(artifact).determineGauge(km-0.1d, km+0.1d);
         double subtractPNP = 0d;
+        // Compare to km.
         if (Math.abs(km - gauge.getStation().doubleValue()) < tolerance) {
             subtractPNP = gauge.getDatum().doubleValue();
         }


More information about the Dive4elements-commits mailing list