[Dive4elements-commits] [PATCH 04 of 13] add tolerance to getCurrentGaugeDatum

Wald Commits scm-commit at wald.intevation.org
Thu Jun 27 10:40:13 CEST 2013


# HG changeset patch
# User Felix Wolfsteller <felix.wolfsteller at intevation.de>
# Date 1372322396 -7200
# Node ID 378b0d780e3653ec68d503ca7b2a2b67a7d7a5fb
# Parent  055443cfc1ad2e4854f061c0d07fc0dbfab6b800
add tolerance to getCurrentGaugeDatum .

diff -r 055443cfc1ad -r 378b0d780e36 artifacts/src/main/java/org/dive4elements/river/exports/DischargeCurveGenerator.java
--- a/artifacts/src/main/java/org/dive4elements/river/exports/DischargeCurveGenerator.java	Wed Jun 26 23:10:42 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/DischargeCurveGenerator.java	Thu Jun 27 10:39:56 2013 +0200
@@ -71,11 +71,11 @@
     /**
      * Returns the PNP (Datum) of gauge, if at gauge, 0 otherwise.
      */
-    public static double getCurrentGaugeDatum(double km, D4EArtifact artifact) {
+    public static double getCurrentGaugeDatum(double km, D4EArtifact artifact, double tolerance) {
         // Code borrowed from FixATWriter.
         Gauge gauge = RiverUtils.getGauge(artifact);
         double subtractPNP = 0d;
-        if (Math.abs(km - gauge.getStation().doubleValue()) < 1e-4) {
+        if (Math.abs(km - gauge.getStation().doubleValue()) < tolerance) {
             subtractPNP = gauge.getDatum().doubleValue();
         }
         return subtractPNP;
@@ -83,7 +83,8 @@
 
 
     public double getCurrentGaugeDatum() {
-        return getCurrentGaugeDatum(getRange()[0], (D4EArtifact) getMaster());
+        return getCurrentGaugeDatum(getRange()[0],
+            (D4EArtifact) getMaster(), 1e-4);
     }
 
 


More information about the Dive4elements-commits mailing list