Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/exports/DischargeCurveGenerator.java @ 6463:378b0d780e36
add tolerance to getCurrentGaugeDatum .
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Thu, 27 Jun 2013 10:39:56 +0200 |
parents | f11165468f0a |
children | abb7a2d4c632 |
comparison
equal
deleted
inserted
replaced
6462:055443cfc1ad | 6463:378b0d780e36 |
---|---|
69 | 69 |
70 | 70 |
71 /** | 71 /** |
72 * Returns the PNP (Datum) of gauge, if at gauge, 0 otherwise. | 72 * Returns the PNP (Datum) of gauge, if at gauge, 0 otherwise. |
73 */ | 73 */ |
74 public static double getCurrentGaugeDatum(double km, D4EArtifact artifact) { | 74 public static double getCurrentGaugeDatum(double km, D4EArtifact artifact, double tolerance) { |
75 // Code borrowed from FixATWriter. | 75 // Code borrowed from FixATWriter. |
76 Gauge gauge = RiverUtils.getGauge(artifact); | 76 Gauge gauge = RiverUtils.getGauge(artifact); |
77 double subtractPNP = 0d; | 77 double subtractPNP = 0d; |
78 if (Math.abs(km - gauge.getStation().doubleValue()) < 1e-4) { | 78 if (Math.abs(km - gauge.getStation().doubleValue()) < tolerance) { |
79 subtractPNP = gauge.getDatum().doubleValue(); | 79 subtractPNP = gauge.getDatum().doubleValue(); |
80 } | 80 } |
81 return subtractPNP; | 81 return subtractPNP; |
82 } | 82 } |
83 | 83 |
84 | 84 |
85 public double getCurrentGaugeDatum() { | 85 public double getCurrentGaugeDatum() { |
86 return getCurrentGaugeDatum(getRange()[0], (D4EArtifact) getMaster()); | 86 return getCurrentGaugeDatum(getRange()[0], |
87 (D4EArtifact) getMaster(), 1e-4); | |
87 } | 88 } |
88 | 89 |
89 | 90 |
90 public DischargeCurveGenerator() { | 91 public DischargeCurveGenerator() { |
91 super(); | 92 super(); |