changeset 3066:4c22194b733a

Some minor bugfixes in fix analysis calculation and some more debug output. flys-artifacts/trunk@4650 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Wed, 13 Jun 2012 11:13:17 +0000
parents ee653971fa84
children d87aadaa4f7e
files flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/Fitting.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/FixAvSectorFacet.java flys-artifacts/src/main/java/de/intevation/flys/exports/fixings/FixWQCurveGenerator.java
diffstat 4 files changed, 34 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Wed Jun 13 10:19:44 2012 +0000
+++ b/flys-artifacts/ChangeLog	Wed Jun 13 11:13:17 2012 +0000
@@ -1,3 +1,14 @@
+2012-06-13  Ingo Weinzierl <ingo@intevation.de>
+
+	* src/main/java/de/intevation/flys/artifacts/model/fixings/FixAvSectorFacet.java:
+	  Added more debug/warn log statements.
+
+	* src/main/java/de/intevation/flys/artifacts/model/fixings/Fitting.java: Do
+	  not add empty objects into the calculation result.
+
+	* src/main/java/de/intevation/flys/exports/fixings/FixWQCurveGenerator.java:
+	  Take care on empty QWD objects.
+
 2012-06-11	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
 
 	* src/main/java/de/intevation/flys/artifacts/model/fixings/Fitting.java,
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/Fitting.java	Wed Jun 13 10:19:44 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/Fitting.java	Wed Jun 13 11:13:17 2012 +0000
@@ -205,7 +205,14 @@
 
         referenced = new QW[xs.size()];
         for (int i = 0; i < referenced.length; ++i) {
-            referenced[i] = qwFactory.create(xs.getQuick(i), ys.getQuick(i));
+            QW qw = qwFactory.create(xs.getQuick(i), ys.getQuick(i));
+
+            if (qw == null) {
+                log.warn("QW creation failed!");
+            }
+            else {
+                referenced[i] = qw;
+            }
         }
 
         chiSqr = lmo.getChiSquare();
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/FixAvSectorFacet.java	Wed Jun 13 10:19:44 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/FixAvSectorFacet.java	Wed Jun 13 11:13:17 2012 +0000
@@ -70,24 +70,35 @@
 
             double km = access.getCurrentKm();
 
+            logger.debug("Current KM = " + km);
+
             KMIndex<AnalysisPeriod []> kmPeriods = result.getAnalysisPeriods();
             KMIndex.Entry<AnalysisPeriod []> kmPeriodsEntry =
                 kmPeriods.search(km);
 
             if (kmPeriodsEntry == null) {
+                logger.warn("No analysis periods found for km '" + km + "'");
                 return null;
             }
 
             AnalysisPeriod[] periods = kmPeriodsEntry.getValue();
 
             if (periods == null) {
+                logger.warn("No analysis periods specified!");
                 return null;
             }
+
             QWD[] qwdData = periods[index].getQSectorAverages();
+
+            if (logger.isDebugEnabled()) {
+                int resSize = qwdData != null ? qwdData.length : -1;
+                logger.debug("Found " + resSize + " result elements.");
+            }
+
             return qwdData;
         }
         else {
-            logger.debug("Not an instance of FixationArtifact.");
+            logger.warn("Artifact is no instance of FLYSArtifact.");
             return null;
         }
     }
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/fixings/FixWQCurveGenerator.java	Wed Jun 13 10:19:44 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/fixings/FixWQCurveGenerator.java	Wed Jun 13 11:13:17 2012 +0000
@@ -97,7 +97,9 @@
         if(qwds != null) {
             // Draw vertical markers
             for(QWD qwd : qwds) {
-                addDomainMarker(new ValueMarker(qwd.getQ()));
+                if (qwd != null) {
+                    addDomainMarker(new ValueMarker(qwd.getQ()));
+                }
             }
         }
     }

http://dive4elements.wald.intevation.org