[Dive4elements-commits] [PATCH 2 of 2] Merged

Wald Commits scm-commit at wald.intevation.org
Wed Jan 23 13:20:46 CET 2013


# HG changeset patch
# User Sascha L. Teichmann <teichmann at intevation.de>
# Date 1358943639 -3600
# Node ID 8cd2f20b1d8c635d210a1230b46d6ae4362de5bc
# Parent  61ebb6fb2ac4fd04694bdd55d13307d060785754
# Parent  ac9a3d9576b4cf608a38bf29b9a9664272fc37ba
Merged

diff -r 61ebb6fb2ac4 -r 8cd2f20b1d8c flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/sq/Measurement.java
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/sq/Measurement.java	Wed Jan 23 12:52:49 2013 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/sq/Measurement.java	Wed Jan 23 13:20:39 2013 +0100
@@ -1,5 +1,6 @@
 package de.intevation.flys.artifacts.model.sq;
 
+import java.util.Arrays;
 import java.util.List;
 import java.util.Map;
 
@@ -181,6 +182,8 @@
         sieveArray.adjust(
             eightValue/sieveArray.totalLoad(),
             newFourValue/sieveArray.totalLoad());
+        log.debug("Adjusted loads: " + Arrays.toString(sieveArray.getLoads()));
+        log.debug("Adjusted norm loads:" + Arrays.toString(sieveArray.getNormLoads()));
     }
 
     protected SieveArray calculateSieveArray() {
diff -r 61ebb6fb2ac4 -r 8cd2f20b1d8c flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/sq/MeasurementFactory.java
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/sq/MeasurementFactory.java	Wed Jan 23 12:52:49 2013 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/sq/MeasurementFactory.java	Wed Jan 23 13:20:39 2013 +0100
@@ -101,7 +101,7 @@
                 "COALESCE(gs.RSIEB15, 0) + COALESCE(gs.RSIEB16, 0) +" +
                 "COALESCE(gs.RSIEB17, 0) + COALESCE(gs.RSIEB18, 0) +" +
                 "COALESCE(gs.RSIEB19, 0) + COALESCE(gs.RSIEB20, 0) +" +
-                "COALESCE(gs.RSIEB21, 0) + COALESCE(gs.REST, 0)) > 0 " +
+                "COALESCE(gs.RSIEB21, 0) + COALESCE(gs.REST, 0)) >= 0 " +
         "ORDER BY " +
             "m.DATUM, g.UFERABST, g.GLOTRECHTEID, gp.LFDNR";
 
@@ -308,7 +308,6 @@
         List<Measurement> accumulated = new ArrayList<Measurement>();
 
         for (Measurement m: measuments) {
-
             Integer currentLR = (Integer)m.getData("GLOTRECHTEID");
 
             boolean newDS = lastLR == null
@@ -372,6 +371,9 @@
 
     protected static Measurement processSameDate(List<Measurement> measurements) {
         int N = measurements.size();
+        if (N > 0) {
+            log.debug("process same date for Q: " + measurements.get(0).Q());
+        }
         if (N == 1) {
             Measurement current = measurements.get(0);
             double left = current.get("UFERABLINKS");
@@ -401,6 +403,7 @@
                     double distNext = next.get("UFERABST");
                     current.set("EFFWIDTH", 0.5*(distNext - distPrev));
                 }
+                log.debug("effective width: " + current.get("EFFWIDTH"));
             }
         }
 
@@ -411,6 +414,9 @@
 
         for (Measurement m: measurements) {
             SieveArray sa   = m.getSieveArray();
+            if (sa.totalLoad() < SieveArray.EPSILON) {
+                continue;
+            }
             double sandF    = sa.sandNormFraction();
             double coarseF  = sa.coarseNormFraction();
             double gravelF  = sa.gravelNormFraction();
@@ -421,6 +427,11 @@
             sumCoarseF += scale*coarseF;
             sumGravelF += scale*gravelF;
             sumNorm    += scale;
+            log.debug("fractions - s: " +
+                sandF + " c: " +
+                coarseF + " g: " + 
+                gravelF);
+            log.debug("scale: " + scale + " = " + effWidth + " * " + gt);
         }
 
         Map<String, Object> data =
@@ -433,7 +444,7 @@
         m.set("BL_S", sumNorm*sumSandF);
         m.set("BL_G", sumNorm*sumGravelF);
         m.set("BL_C", sumNorm*sumCoarseF);
-
+        log.debug("BL_S: " + m.get("BL_S") + " BL_G: " + m.get("BL_G") + " BL_C: " + m.get("BL_C"));
         return m;
     }
 
@@ -482,6 +493,7 @@
             new HashMap<String, Object>(measuments.get(0).getData());
 
         data.put("GTRIEB", sumGTrieb/N);
+
         return new Measurement(data, accumulatedSieves);
     }
 }
diff -r 61ebb6fb2ac4 -r 8cd2f20b1d8c flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/sq/SieveArray.java
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/sq/SieveArray.java	Wed Jan 23 12:52:49 2013 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/sq/SieveArray.java	Wed Jan 23 13:20:39 2013 +0100
@@ -1,7 +1,14 @@
 package de.intevation.flys.artifacts.model.sq;
 
+import java.util.Arrays;
+
+import org.apache.log4j.Logger;
+
 public class SieveArray
 {
+    private static final Logger log =
+        Logger.getLogger(SieveArray.class);
+
     public static final double EPSILON = 1e-8;
 
     public static final double [] SIEVE_DIAMETERS = {
@@ -49,6 +56,7 @@
         for (int i = 0; i < normLoads.length; ++i) {
             normLoads[i] = total*loads[i];
         }
+        log.debug("calculated norm loads: " + Arrays.toString(normLoads));
     }
 
     public void adjust(double eight, double four) {


More information about the Dive4elements-commits mailing list