[PATCH] Do not transform Q values from cm to m

Wald Commits scm-commit at wald.intevation.org
Tue Oct 21 12:14:42 CEST 2014


# HG changeset patch
# User "Tom Gottfried <tom at intevation.de>"
# Date 1413886479 -7200
# Node ID e65aad00b3a1c8c8e5d7e0b9fdfb08e7e708415b
# Parent  853151285fb155c5cd6135f4109feab49645858b
Do not transform Q values from cm to m.

diff -r 853151285fb1 -r e65aad00b3a1 artifacts/src/main/java/org/dive4elements/river/artifacts/model/HistoricalDischargeWQFacet.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/HistoricalDischargeWQFacet.java	Mon Oct 20 18:26:15 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/HistoricalDischargeWQFacet.java	Tue Oct 21 12:14:39 2014 +0200
@@ -11,14 +11,21 @@
 import org.dive4elements.artifactdatabase.state.Facet;
 import org.dive4elements.artifacts.Artifact;
 import org.dive4elements.artifacts.CallContext;
+import org.dive4elements.river.artifacts.model.FacetTypes;
 import org.dive4elements.river.artifacts.states.DefaultState.ComputeType;
 
+import org.apache.log4j.Logger;
+
 import static org.dive4elements.river.exports.injector.InjectorConstants.PNP;
 
 /**
  * @author <a href="mailto:ingo.weinzierl at intevation.de">Ingo Weinzierl</a>
  */
-public class HistoricalDischargeWQFacet extends DataFacet {
+public class HistoricalDischargeWQFacet
+extends DataFacet
+implements FacetTypes {
+    private static final Logger log = Logger
+        .getLogger(HistoricalDischargeWQFacet.class);
 
     private double value;
 
@@ -44,8 +51,15 @@
     @Override
     public Object getData(Artifact artifact, CallContext context) {
         double v = this.value;
-        if (context.getContextValue(PNP) instanceof Number) {
-            v = value/100 + ((Number)context.getContextValue(PNP)).doubleValue();
+        if (HISTORICAL_DISCHARGE_WQ_W.equals(name)) {
+            if (context.getContextValue(PNP) instanceof Number) {
+                v = value/100 +
+                    ((Number)context.getContextValue(PNP)).doubleValue();
+            }
+            else {
+                log.error("Missing datum. Cannot calculate W value.");
+                return null;
+            }
         }
         return v;
     }


More information about the Dive4Elements-commits mailing list