[PATCH] (issue1755) Add non empty measurement facets again

Wald Commits scm-commit at wald.intevation.org
Fri Apr 10 11:24:13 CEST 2015


# HG changeset patch
# User Andre Heinecke <andre.heinecke at intevation.de>
# Date 1428657423 -7200
# Node ID b743ed33c65db6627fc8d47a361e3ba511e5f141
# Parent  b44c76b6800c6437bb313d683ece9e93db6e1dd6
(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.

diff -r b44c76b6800c -r b743ed33c65d artifacts/src/main/java/org/dive4elements/river/artifacts/states/minfo/BedQualityState.java
--- 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
                 }
             }
         }


More information about the Dive4Elements-commits mailing list