diff artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flood_duration/FloodDurationCurveFacet.java @ 9257:ef7b65576d4b

Added W and Q main values to S-Info flood duration curve chart
author mschaefer
date Fri, 13 Jul 2018 18:38:05 +0200
parents c2a0028bfa9f
children e5367900dd6d
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flood_duration/FloodDurationCurveFacet.java	Fri Jul 13 12:04:21 2018 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flood_duration/FloodDurationCurveFacet.java	Fri Jul 13 18:38:05 2018 +0200
@@ -8,8 +8,8 @@
 
 package org.dive4elements.river.artifacts.sinfo.flood_duration;
 
-import java.util.ArrayList;
-import java.util.List;
+//import java.util.ArrayList;
+//import java.util.List;
 
 import org.apache.log4j.Logger;
 import org.dive4elements.artifactdatabase.state.DefaultFacet;
@@ -18,7 +18,7 @@
 import org.dive4elements.artifacts.CallContext;
 import org.dive4elements.river.artifacts.D4EArtifact;
 import org.dive4elements.river.artifacts.model.CalculationResult;
-import org.dive4elements.river.artifacts.model.WQDay;
+//import org.dive4elements.river.artifacts.model.WQDay;
 import org.dive4elements.river.artifacts.states.DefaultState.ComputeType;
 
 
@@ -29,11 +29,11 @@
 
     private static Logger log = Logger.getLogger(FloodDurationCurveFacet.class);
 
-    /** Blackboard data provider key for durationcurve (wqday) data. */
-    public static String BB_DURATIONCURVE = "durationcurve";
-
-    /** Blackboard data provider key for km of durationcurve. */
-    public static String BB_DURATIONCURVE_KM = "durationcurve.km";
+    // /** Blackboard data provider key for durationcurve (wqday) data. */
+    // public static String BB_DURATIONCURVE = "durationcurve";
+    //
+    // /** Blackboard data provider key for km of durationcurve. */
+    // public static String BB_DURATIONCURVE_KM = "durationcurve.km";
 
     public FloodDurationCurveFacet() {
     }
@@ -61,52 +61,52 @@
         // return getTestData();
     }
 
-    private WQDay getTestData() {
-        final int[] days = new int[366];
-        final double[] ws = new double[366];
-        final double[] qs = new double[366];
-        for (int i = 0; i <= 365; i++) {
-            days[i] = i;
-            final double x = (i - 182.5) / 182.5;
-            ws[i] = 102.0 - (Math.pow(x, 5) + x);
-            qs[i] = 1600.0 - 800 * (Math.pow(x, 9) + x);
-        }
-        return new WQDay(days, ws, qs);
-    }
-
-
-    @Override
-    public List getStaticDataProviderKeys(final Artifact art) {
-        final List list = new ArrayList();
-        list.add(BB_DURATIONCURVE);
-        list.add(BB_DURATIONCURVE_KM);
-        return list;
-    }
+    // private WQDay getTestData() {
+    // final int[] days = new int[366];
+    // final double[] ws = new double[366];
+    // final double[] qs = new double[366];
+    // for (int i = 0; i <= 365; i++) {
+    // days[i] = i;
+    // final double x = (i - 182.5) / 182.5;
+    // ws[i] = 102.0 - (Math.pow(x, 5) + x);
+    // qs[i] = 1600.0 - 800 * (Math.pow(x, 9) + x);
+    // }
+    // return new WQDay(days, ws, qs);
+    // }
 
 
-    /**
-     * Can provide whatever getData returns and additionally the location.
-     * @param key      will respond on BB_DURATIONCURVE +KM
-     * @param param    ignored
-     * @param context  ignored
-     * @return whatever getData delivers or location.
-     */
-    @Override
-    public Object provideBlackboardData(final Artifact artifact,
-            final Object key,
-            final Object param,
-            final CallContext context
-            ) {
-        if (key.equals(BB_DURATIONCURVE)) {
-            return getData(artifact, context);
-        }
-        else if (key.equals(BB_DURATIONCURVE_KM)) {
-            return ((D4EArtifact)artifact).getDataAsString("ld_locations");
-        }
-        else {
-            return null;
-        }
-    }
+    // @Override
+    // public List getStaticDataProviderKeys(final Artifact art) {
+    // final List list = new ArrayList();
+    // list.add(BB_DURATIONCURVE);
+    // list.add(BB_DURATIONCURVE_KM);
+    // return list;
+    // }
+
+
+    // /**
+    // * Can provide whatever getData returns and additionally the location.
+    // * @param key will respond on BB_DURATIONCURVE +KM
+    // * @param param ignored
+    // * @param context ignored
+    // * @return whatever getData delivers or location.
+    // */
+    // @Override
+    // public Object provideBlackboardData(final Artifact artifact,
+    // final Object key,
+    // final Object param,
+    // final CallContext context
+    // ) {
+    // if (key.equals(BB_DURATIONCURVE)) {
+    // return getData(artifact, context);
+    // }
+    // else if (key.equals(BB_DURATIONCURVE_KM)) {
+    // return ((D4EArtifact)artifact).getDataAsString("ld_locations");
+    // }
+    // else {
+    // return null;
+    // }
+    // }
 
 
     /** Create a deep copy. */

http://dive4elements.wald.intevation.org