[Dive4elements-commits] [PATCH 1 of 2] SedimentLoadCalculation: Partly fix 1250 (calculate more than one total if possible)

Wald Commits scm-commit at wald.intevation.org
Fri Apr 12 16:45:51 CEST 2013


# HG changeset patch
# User Felix Wolfsteller <felix.wolfsteller at intevation.de>
# Date 1365778312 -7200
# Node ID 756df79274e141563431e86f841cb7707f9ff981
# Parent  88cbe798cbab44c21b66887bd99a28967bfdfcb3
SedimentLoadCalculation: Partly fix 1250 (calculate more than one total if possible).

diff -r 88cbe798cbab -r 756df79274e1 flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/minfo/SedimentLoadCalculation.java
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/minfo/SedimentLoadCalculation.java	Fri Apr 12 16:13:23 2013 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/minfo/SedimentLoadCalculation.java	Fri Apr 12 16:51:52 2013 +0200
@@ -256,22 +256,29 @@
 
     private SedimentLoad calculateTotalLoad(SedimentLoad load, int year) {
         logger.debug("calculateTotalLoad");
+        boolean problemThisYear = false;
         if (!load.hasCoarse()) {
-            addProblem(year, "missing.fraction.coarse");
+            addProblem("missing.fraction.coarse", Double.toString(year));
+            problemThisYear = true;
         }
         if (!load.hasFineMiddle()) {
-            addProblem(year, "missing.fraction.fine_middle");
+            addProblem("missing.fraction.fine_middle", Double.toString(year));
+            problemThisYear = true;
         }
         if (!load.hasSand()) {
-            addProblem(year, "missing.fraction.sand");
+            addProblem("missing.fraction.sand", Double.toString(year));
+            problemThisYear = true;
         }
         if (!load.hasSuspSand()) {
-            addProblem(year, "missing.fraction.susp_sand");
+            addProblem("missing.fraction.susp_sand", Double.toString(year));
+            problemThisYear = true;
         }
         if (!load.hasSuspSediment()) {
-            addProblem(year, "missing.fraction.susp_sediment");
+            addProblem("missing.fraction.susp_sediment", Double.toString(year));
+            problemThisYear = true;
         }
-        if (hasProblems()) {
+        if (problemThisYear) {
+            logger.warn("Some problem, not calculating total load.");
             return load;
         }
         for(double km : load.getKms()) {


More information about the Dive4elements-commits mailing list