[PATCH] Avoid encoding problem with NaN in bed difference export

Wald Commits scm-commit at wald.intevation.org
Mon Oct 20 18:15:47 CEST 2014


# HG changeset patch
# User "Tom Gottfried <tom at intevation.de>"
# Date 1413821744 -7200
# Node ID d1c9eea8aec554143f32362d8fb7f3853a557d32
# Parent  9ab8b1146ac4ad84ced624bce6529ef5f2db59ae
Avoid encoding problem with NaN in bed difference export.

diff -r 9ab8b1146ac4 -r d1c9eea8aec5 artifacts/src/main/java/org/dive4elements/river/exports/minfo/BedDifferenceExporter.java
--- a/artifacts/src/main/java/org/dive4elements/river/exports/minfo/BedDifferenceExporter.java	Mon Oct 20 16:13:26 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/minfo/BedDifferenceExporter.java	Mon Oct 20 18:15:44 2014 +0200
@@ -102,14 +102,26 @@
                 double[][] gap1 = yResult.getDataGap1Data();
                 double[][] gap2 = yResult.getDataGap2Data();
                 for (int j = 0; j < kms[0].length; j++) {
+                    String sound1 = !Double.isNaN(sounding1[1][j])
+                        ? mf.format(sounding1[1][j])
+                        : "";
+                    String sound2 = !Double.isNaN(sounding2[1][j])
+                        ? mf.format(sounding2[1][j])
+                        : "";
+                    String g1 = !Double.isNaN(gap1[1][j])
+                        ? mf.format(gap1[1][j])
+                        : "";
+                    String g2 = !Double.isNaN(gap2[1][j])
+                        ? mf.format(gap2[1][j])
+                        : "";
                     writer.writeNext(new String[] {
                         kmf.format(kms[0][j]),
                         desc,
                         mf.format(kms[1][j]),
-                        mf.format(sounding1[1][j]),
-                        mf.format(sounding2[1][j]),
-                        mf.format(gap1[1][j]),
-                        mf.format(gap2[1][j])
+                        sound1,
+                        sound2,
+                        g1,
+                        g2
                         });
                 }
             }


More information about the Dive4Elements-commits mailing list