[Dive4elements-commits] [PATCH] Fix export at river km's for issue1275
Wald Commits
scm-commit at wald.intevation.org
Fri Jun 7 17:09:30 CEST 2013
# HG changeset patch
# User Andre Heinecke <aheinecke at intevation.de>
# Date 1370617766 -7200
# Node ID 02ea1c3fba8c96439a63e2eb3dd0fcf7d6d3809c
# Parent a8613826bcac26bca327f354da4b7dd10d7fcb09
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.
diff -r a8613826bcac -r 02ea1c3fba8c artifacts/src/main/java/org/dive4elements/river/exports/ATExporter.java
--- a/artifacts/src/main/java/org/dive4elements/river/exports/ATExporter.java Fri Jun 07 13:06:20 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/ATExporter.java Fri Jun 07 17:09:26 2013 +0200
@@ -111,7 +111,7 @@
gauge.getName(),
gauge.getDatum(),
interval.getStartTime(),
- 100d);
+ false);
}
else {
// at km
@@ -123,7 +123,7 @@
null,
null,
null,
- 0d);
+ true);
}
}
diff -r a8613826bcac -r 02ea1c3fba8c artifacts/src/main/java/org/dive4elements/river/exports/ATWriter.java
--- 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) {
More information about the Dive4elements-commits
mailing list