changeset 6739:be8a5e1911ed

issue1418: Fetch correct (not necessarily first) gauge when determining if at gauge.
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Thu, 01 Aug 2013 10:15:00 +0200
parents 1960d55bafb1
children 68c7b5811c4f
files artifacts/src/main/java/org/dive4elements/river/exports/DischargeCurveGenerator.java
diffstat 1 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- 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();
         }

http://dive4elements.wald.intevation.org