Mercurial > dive4elements > river
changeset 6463:378b0d780e36
add tolerance to getCurrentGaugeDatum .
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Thu, 27 Jun 2013 10:39:56 +0200 |
parents | 055443cfc1ad |
children | 2e850d56ae87 |
files | artifacts/src/main/java/org/dive4elements/river/exports/DischargeCurveGenerator.java |
diffstat | 1 files changed, 4 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- 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); }