changeset 3054:8bd4cf11c25a

Interpolate wkms in computed discharges. flys-artifacts/trunk@4628 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Fri, 08 Jun 2012 04:53:33 +0000
parents bb576facbe50
children 1fbf8462f808
files flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/exports/ComputedDischargeCurveGenerator.java
diffstat 2 files changed, 17 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Thu Jun 07 20:53:49 2012 +0000
+++ b/flys-artifacts/ChangeLog	Fri Jun 08 04:53:33 2012 +0000
@@ -1,3 +1,8 @@
+2012-06-07	Felix Wolfsteller	<felix.wolfsteller@intevation.de>
+
+	* src/main/java/de/intevation/flys/exports/ComputedDischargeCurveGenerator.java:
+	  (doWOut): Interpolate values from WKms.
+
 2012-06-07	Felix Wolfsteller	<felix.wolfsteller@intevation.de>
 
 	* src/main/java/de/intevation/flys/artifacts/states/GaugeDischargeState.java:
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/ComputedDischargeCurveGenerator.java	Thu Jun 07 20:53:49 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/ComputedDischargeCurveGenerator.java	Fri Jun 08 04:53:33 2012 +0000
@@ -14,6 +14,7 @@
 import de.intevation.artifactdatabase.state.ArtifactAndFacet;
 import de.intevation.artifactdatabase.state.Facet;
 
+import de.intevation.flys.artifacts.StaticWKmsArtifact;
 import de.intevation.flys.artifacts.WINFOArtifact;
 
 import de.intevation.flys.artifacts.model.FacetTypes;
@@ -179,6 +180,7 @@
         Document         theme,
         boolean          visible
     ) {
+        logger.debug("ComputedDischargeCurveGenerator: doWQOut");
         double [][] data = (double [][]) wqkms;
 
         XYSeries series = new StyledXYSeries(aaf.getFacetDescription(), theme);
@@ -199,6 +201,7 @@
         Document         theme,
         boolean          visible
     ) {
+        logger.debug("ComputedDischargeCurveGenerator: doWQOut");
         XYSeries series = new StyledXYSeries(aaf.getFacetDescription(), theme);
         StyledSeriesBuilder.addPointsQW(series, wqkms);
 
@@ -220,6 +223,7 @@
         List<StickyAxisAnnotation> xy = new ArrayList<StickyAxisAnnotation>();
         double [][] data = (double [][]) wqkms;
         for (int i = 0; i< data[0].length; i++) {
+            // TODO we need linear interpolation?
             xy.add(new StickyAxisAnnotation(aandf.getFacetDescription(),
                 (float) data[0][i], StickyAxisAnnotation.SimpleAxis.X_AXIS));
             xy.add(new StickyAxisAnnotation(aandf.getFacetDescription(),
@@ -247,7 +251,9 @@
         List<StickyAxisAnnotation> xy = new ArrayList<StickyAxisAnnotation>();
         // Try to find them as WKms as well...
         if (wqkms instanceof double[][]) {
+            logger.debug("its double[][] time, baby");
             double [][] data = (double [][]) wqkms;
+            // TODO Do we need interpolation?
             for (int i = 0; i< data[0].length; i++) {
                 xy.add(new StickyAxisAnnotation(aandf.getFacetDescription(),
                     (float) data[1][i], StickyAxisAnnotation.SimpleAxis.Y_AXIS));
@@ -257,12 +263,14 @@
                 aandf, theme, visible);
         }
         else {
+            logger.debug("its wkms time, baby");
             WKms data = (WKms) wqkms;
-            // assume its WKms
+            // Assume its WKms.
+            double location = getRange()[0];
+            double w = ((StaticWKmsArtifact) aandf.getArtifact())
+                .getWAtKmLin(data, getRange()[0]);
             xy.add(new StickyAxisAnnotation(aandf.getFacetDescription(),
-              (float) data.getW(0), StickyAxisAnnotation.SimpleAxis.Y_AXIS));
-            xy.add(new StickyAxisAnnotation(aandf.getFacetDescription(),
-              (float) 180f, StickyAxisAnnotation.SimpleAxis.Y_AXIS));
+              (float) w, StickyAxisAnnotation.SimpleAxis.Y_AXIS));
 
             doAnnotations(new FLYSAnnotation(facet.getDescription(), xy),
                 aandf, theme, visible);

http://dive4elements.wald.intevation.org