changeset 2066:2b6a0de47379

Improved the WaterlevelExporter: added range check for W/Q at gauge. flys-artifacts/trunk@3561 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Mon, 02 Jan 2012 10:59:42 +0000
parents 2f5628f0de0e
children 40624968c7f4
files flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/exports/WaterlevelExporter.java
diffstat 2 files changed, 26 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Mon Jan 02 09:46:39 2012 +0000
+++ b/flys-artifacts/ChangeLog	Mon Jan 02 10:59:42 2012 +0000
@@ -1,3 +1,9 @@
+2012-01-02  Ingo Weinzierl <ingo@intevation.de>
+
+	* src/main/java/de/intevation/flys/exports/WaterlevelExporter.java: Check
+	  if the location of a CSV row is in range of the reference gauge. Write
+	  "outside reference gauge" into CSV in such cases.
+
 2012-01-02  Ingo Weinzierl <ingo@intevation.de>
 
 	PART II of flys/issue125 (W-INFO: Wasserspiegellagenberechnung / tabellarische Berechnungsausgabe)
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/WaterlevelExporter.java	Mon Jan 02 09:46:39 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/WaterlevelExporter.java	Mon Jan 02 10:59:42 2012 +0000
@@ -20,6 +20,8 @@
 import de.intevation.artifacts.CallContext;
 import de.intevation.artifacts.CallMeta;
 
+import de.intevation.flys.model.Gauge;
+
 import de.intevation.flys.artifacts.FLYSArtifact;
 import de.intevation.flys.artifacts.WINFOArtifact;
 import de.intevation.flys.artifacts.model.CalculationResult;
@@ -86,6 +88,9 @@
     public static final String CSV_META_W =
         "export.waterlevel.csv.meta.w";
 
+    public static final String CSV_NOT_IN_GAUGE_RANGE =
+        "export.waterlevel.csv.not.in.gauge.range";
+
 
     public static final Pattern NUMBERS_PATTERN =
         Pattern.compile("\\D*(\\d++.\\d*)\\D*");
@@ -96,6 +101,8 @@
     public static final String DEFAULT_CSV_Q_DESC_HEADER   = "Bezeichnung";
     public static final String DEFAULT_CSV_LOCATION_HEADER = "Lage";
     public static final String DEFAULT_CSV_GAUGE_HEADER    = "Bezugspegel";
+    public static final String DEFAULT_CSV_NOT_IN_GAUGE_RANGE =
+        "außerhalb des gewählten Bezugspegels";
 
 
     /** The storage that contains all WQKms objects for the different facets.*/
@@ -348,9 +355,16 @@
         int      size   = wqkms.size();
         double[] result = new double[3];
 
-        FLYSArtifact flys  = (FLYSArtifact) master;
-        String       gauge = FLYSUtils.getGaugename(flys);
-        String       desc  = "";
+        FLYSArtifact flys       = (FLYSArtifact) master;
+        Gauge        gauge      = FLYSUtils.getGauge(flys);
+        String       gaugeName  = gauge.getName();
+        String       desc       = "";
+        String       notinrange = msg(
+            CSV_NOT_IN_GAUGE_RANGE,
+            DEFAULT_CSV_NOT_IN_GAUGE_RANGE);
+
+        double a = gauge.getRange().getA().doubleValue();
+        double b = gauge.getRange().getB().doubleValue();
 
         if (flys instanceof WINFOArtifact) {
             desc = getColumnTitle((WINFOArtifact)flys, wqkms);
@@ -366,7 +380,9 @@
                     qf.format(result[1]),
                     desc,
                     FLYSUtils.getLocationDescription(flys, result[2]),
-                    gauge
+                    result[2] >= a && result[2] <= b
+                        ? gaugeName
+                        : notinrange
                 });
             }
             else {

http://dive4elements.wald.intevation.org