changeset 4840:8cd2f20b1d8c

Merged
author Sascha L. Teichmann <teichmann@intevation.de>
date Wed, 23 Jan 2013 13:20:39 +0100
parents 61ebb6fb2ac4 (current diff) ac9a3d9576b4 (diff)
children ad0990a82ab8
files
diffstat 3 files changed, 26 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- 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() {
--- 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);
     }
 }
--- 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) {

http://dive4elements.wald.intevation.org