comparison artifacts/src/main/java/org/dive4elements/river/exports/DischargeCurveGenerator.java @ 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 6791411ed1fc
children a77dca301419
comparison
equal deleted inserted replaced
6737:1960d55bafb1 6739:be8a5e1911ed
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, double tolerance) { 74 public static double getCurrentGaugeDatum(double km, D4EArtifact artifact, double tolerance) {
75 // Code borrowed from FixATWriter. 75 // Look if there is a gauge at chosen km:
76 Gauge gauge = RiverUtils.getGauge(artifact); 76 // Get gauge which is defined for km
77 Gauge gauge =
78 RiverUtils.getRiver(artifact).determineGauge(km-0.1d, km+0.1d);
77 double subtractPNP = 0d; 79 double subtractPNP = 0d;
80 // Compare to km.
78 if (Math.abs(km - gauge.getStation().doubleValue()) < tolerance) { 81 if (Math.abs(km - gauge.getStation().doubleValue()) < tolerance) {
79 subtractPNP = gauge.getDatum().doubleValue(); 82 subtractPNP = gauge.getDatum().doubleValue();
80 } 83 }
81 return subtractPNP; 84 return subtractPNP;
82 } 85 }

http://dive4elements.wald.intevation.org