changeset 8678:b743ed33c65d

(issue1755) Add non empty measurement facets again The add was in the wrong place (inside the loop) which breaks when a non NaN is found and the loop only lopped over the first two (the dimensions of data) values.
author Andre Heinecke <andre.heinecke@intevation.de>
date Fri, 10 Apr 2015 11:17:03 +0200
parents b44c76b6800c
children 6e105764ba14
files artifacts/src/main/java/org/dive4elements/river/artifacts/states/minfo/BedQualityState.java
diffstat 1 files changed, 8 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/states/minfo/BedQualityState.java	Thu Apr 09 19:27:54 2015 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/states/minfo/BedQualityState.java	Fri Apr 10 11:17:03 2015 +0200
@@ -132,16 +132,19 @@
                 double [][] data = (double[][]) d;
                 if (data.length > 0 && data[0].length > 0) {
                     boolean onlyNaN = true;
-                    for (int i = 0; i < data.length; i++) {
+                    for (int i = 0; i < data[1].length; i++) {
                         if (!Double.isNaN(data[1][i])) {
                             onlyNaN = false;
                             break;
                         }
-                        if (!onlyNaN) {
-                            newFacets.add(candidate);
-                        }
-                        // else adding a problem would be nice
                     }
+                    if (!onlyNaN) {
+                        newFacets.add(candidate);
+                    } else {
+                        log.debug("Not adding measurement facet " +
+                                  "because it only contains NaN values");
+                    }
+                    // else adding a problem would be nice
                 }
             }
         }

http://dive4elements.wald.intevation.org