[Dive4elements-commits] [PATCH] Be more tolerant when try to find out if a location is at a gauge position

Wald Commits scm-commit at wald.intevation.org
Fri May 10 19:29:15 CEST 2013


# HG changeset patch
# User Sascha L. Teichmann <teichmann at intevation.de>
# Date 1368206950 -7200
# Node ID 2ec6fae23bbafc7c190ccee2b3bfa895873c180f
# Parent  45bcc127e7dfea7b1aa04885ac9dc69c9b34743c
Be more tolerant when try to find out if a location is at a gauge position.

diff -r 45bcc127e7df -r 2ec6fae23bba artifacts/src/main/java/org/dive4elements/river/exports/ComputedDischargeCurveExporter.java
--- a/artifacts/src/main/java/org/dive4elements/river/exports/ComputedDischargeCurveExporter.java	Fri May 10 19:07:00 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/ComputedDischargeCurveExporter.java	Fri May 10 19:29:10 2013 +0200
@@ -135,11 +135,13 @@
         double[] km = access.getLocations();
         String header =
             msg(CSV_W_HEADER, DEFAULT_CSV_W_HEADER, new Object[] { unit });
+
         if (km != null) {
             List<Gauge>gauges = GaugesFactory.getGauges(access.getRiver());
-            for (Gauge g : gauges) {
-                if (g.getStation().doubleValue() == km[0]) {
+            for (Gauge g: gauges) {
+                if (Math.abs(g.getStation().doubleValue() - km[0]) < 0.0001d) {
                     header = "W [cm]";
+                    break;
                 }
             }
         }


More information about the Dive4elements-commits mailing list