[PATCH] Instead of adding datum to Q-values, correctly transform W-values to meter above datum

Wald Commits scm-commit at wald.intevation.org
Wed Oct 1 15:43:09 CEST 2014


# HG changeset patch
# User Tom Gottfried <tom at intevation.de>
# Date 1412170975 -7200
# Node ID c494f9a614907aca2501ee2cb596660f2e8c9f9e
# Parent  75ccacd37bec6cbd38306eb36052f2458ae614bc
Instead of adding datum to Q-values, correctly transform W-values to meter above datum.

diff -r 75ccacd37bec -r c494f9a61490 artifacts/src/main/java/org/dive4elements/river/artifacts/GaugeDischargeArtifact.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/GaugeDischargeArtifact.java	Wed Oct 01 15:24:21 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/GaugeDischargeArtifact.java	Wed Oct 01 15:42:55 2014 +0200
@@ -217,12 +217,12 @@
             log.error("No values for this gauge / discharge found.");
             return error(new WQKms[0], "no.gauge.found");
         }
-        for (int i = 0 ; i < values[0].length; i++) {
-            values[0][i] += gauge.getDatum().doubleValue();
+        for (int i = 0 ; i < values[1].length; i++) {
+            values[1][i] = values[1][i]/100d + gauge.getDatum().doubleValue();
         }
-        double [] kms = new double[values[0].length];
+        double [] kms = new double[values[1].length];
         Arrays.fill(kms, gauge.getStation().doubleValue());
-        res.add(new WQKms(kms, values[0], values[1], name, W.CENTIMETER_AT_GAUGE));
+        res.add(new WQKms(kms, values[0], values[1], name));
 
         return new CalculationResult(
             res.toArray(new WQKms[res.size()]),


More information about the Dive4Elements-commits mailing list