changeset 8439:d1c9eea8aec5

Avoid encoding problem with NaN in bed difference export.
author "Tom Gottfried <tom@intevation.de>"
date Mon, 20 Oct 2014 18:15:44 +0200
parents 9ab8b1146ac4
children 7cb55659646d
files artifacts/src/main/java/org/dive4elements/river/exports/minfo/BedDifferenceExporter.java
diffstat 1 files changed, 16 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- 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
                         });
                 }
             }

http://dive4elements.wald.intevation.org