diff artifacts/src/main/java/org/dive4elements/river/exports/ATWriter.java @ 6234:02ea1c3fba8c

Fix export at river km's for issue1275 Rrenkert explained that the intention was to scale the Waterlevels because they should be in centimeters at a gauge and in meters otherwise. This appears very strange to me and should be clarified.
author Andre Heinecke <aheinecke@intevation.de>
date Fri, 07 Jun 2013 17:09:26 +0200
parents 715e010d40de
children 152e1ba8e5bd
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/exports/ATWriter.java	Fri Jun 07 13:06:20 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/ATWriter.java	Fri Jun 07 17:09:26 2013 +0200
@@ -160,7 +160,7 @@
         String gName,
         BigDecimal datum,
         Date date,
-        double scale)
+        boolean wOutUnitIsMeter)
     throws IOException
     {
         PrintWriter out = new PrintWriter(writer);
@@ -186,7 +186,13 @@
         int col = 0;
         for (double w = startW; w <= maxW; w += 0.01) {
             if (col == 0) {
-                out.printf(Locale.US, "%8d", (int)Math.round(w * scale));
+                if (wOutUnitIsMeter) {
+                    // For some crazy reason W's at a gauge should be in the
+                    // unit but W's exported elsewhere should be in Meter
+                    out.printf(Locale.US, "%5.2f", w);
+                } else {
+                    out.printf(Locale.US, "%8d", (int)Math.round(w * 100d));
+                }
             }
 
             if (w < minW) {

http://dive4elements.wald.intevation.org