changeset 3397:6d1740533810

FixA: Added discharge column to DeltaW(t) CSV export. flys-artifacts/trunk@5030 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Wed, 18 Jul 2012 09:03:19 +0000
parents 3bffbf670b49
children 7f9fe694f8d1
files flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/exports/fixings/DeltaWtExporter.java flys-artifacts/src/main/java/de/intevation/flys/utils/Formatter.java flys-artifacts/src/main/resources/messages.properties flys-artifacts/src/main/resources/messages_de.properties flys-artifacts/src/main/resources/messages_de_DE.properties flys-artifacts/src/main/resources/messages_en.properties
diffstat 7 files changed, 66 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Wed Jul 18 08:19:03 2012 +0000
+++ b/flys-artifacts/ChangeLog	Wed Jul 18 09:03:19 2012 +0000
@@ -1,3 +1,14 @@
+2012-07-18	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/flys/exports/fixings/DeltaWtExporter.java:
+	  Added discharge column.
+
+	* src/main/resources/messages.properties,
+	  src/main/resources/messages_de_DE.properties,
+	  src/main/resources/messages_en.properties,
+	  src/main/resources/messages_de.properties:
+	  Added missing strings.
+
 2012-07-18	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
 
 	* src/main/java/de/intevation/flys/artifacts/model/sq/MeasurementFactory.java:
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/fixings/DeltaWtExporter.java	Wed Jul 18 08:19:03 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/fixings/DeltaWtExporter.java	Wed Jul 18 09:03:19 2012 +0000
@@ -25,7 +25,6 @@
 import java.text.NumberFormat;
 
 import java.util.ArrayList;
-import java.util.Date;
 import java.util.List;
 import java.util.Locale;
 
@@ -44,6 +43,9 @@
     public static final String CSV_DELTA_W_HEADER =
         "export.fixings.deltawt.csv.header.deltaw";
 
+    public static final String CSV_Q_HEADER =
+        "export.fixings.deltawt.csv.header.q";
+
     public static final String CSV_T_HEADER =
         "export.fixings.deltawt.csv.header.t";
 
@@ -54,6 +56,8 @@
 
     public static final String DEFAULT_CSV_DELTA_W_HEADER = "\u0394 W [cm]";
 
+    public static final String DEFAULT_CSV_Q_HEADER = "Abfluss [m\u00b3/s]";
+
     public static final String DEFAULT_CSV_T_HEADER = "Datum";
 
     public static final String DEFAULT_CSV_T_DESC_HEADER = "Beschreibung";
@@ -96,6 +100,7 @@
 
         NumberFormat kmF = getKMFormatter();
         NumberFormat dwF = getDeltaWFormatter();
+        NumberFormat qF  = getQFormatter();
 
         CallMeta meta = context.getMeta();
         Locale locale = Resources.getLocale(meta);
@@ -107,16 +112,15 @@
 
                String kmS = kmF.format(kmEntry.getKm());
                for (QWD qwd: kmEntry.getValue()) {
-                    double deltaW = qwd.getDeltaW();
-                    Date   date   = qwd.getDate();
-                    String desc   = qwd.getDescription();
-
-                    String deltaWS = dwF.format(deltaW);
-                    String dateS   = dF.format(date);
+                    String desc    = qwd.getDescription();
+                    String deltaWS = dwF.format(qwd.getDeltaW());
+                    String qS      = qF.format(qwd.getQ());
+                    String dateS   = dF.format(qwd.getDate());
 
                     writer.writeNext(new String[] {
                         kmS,
                         deltaWS,
+                        qS,
                         dateS,
                         desc != null ? desc : "" });
                }
@@ -137,16 +141,15 @@
                     QWD [] qwds = period.getQWDs();
                     if (qwds != null) {
                         for (QWD qwd: qwds) {
-                            double deltaW = qwd.getDeltaW();
-                            Date   date   = qwd.getDate();
-                            String desc   = qwd.getDescription();
-
-                            String deltaWS = dwF.format(deltaW);
-                            String dateS   = dF.format(date);
+                            String desc    = qwd.getDescription();
+                            String deltaWS = dwF.format(qwd.getDeltaW());
+                            String qS      = qF.format(qwd.getQ());
+                            String dateS   = dF.format(qwd.getDate());
 
                             writer.writeNext(new String[] {
                                 kmS,
                                 deltaWS,
+                                qS,
                                 dateS,
                                 desc != null ? desc : "" });
                         }
@@ -166,12 +169,17 @@
         return Formatter.getFixDeltaWDeltaW(context);
     }
 
+    protected NumberFormat getQFormatter() {
+        return Formatter.getFixDeltaWQ(context);
+    }
+
     protected void writeCSVHeader(CSVWriter writer) {
         log.debug("DeltaWtExporter.writeCSVHeader");
 
         writer.writeNext(new String[] {
             msg(CSV_KM_HEADER,      DEFAULT_CSV_KM_HEADER),
             msg(CSV_DELTA_W_HEADER, DEFAULT_CSV_DELTA_W_HEADER),
+            msg(CSV_Q_HEADER,       DEFAULT_CSV_Q_HEADER),
             msg(CSV_T_HEADER,       DEFAULT_CSV_T_HEADER),
             msg(CSV_T_DESC_HEADER,  DEFAULT_CSV_T_DESC_HEADER)
         });
--- a/flys-artifacts/src/main/java/de/intevation/flys/utils/Formatter.java	Wed Jul 18 08:19:03 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/utils/Formatter.java	Wed Jul 18 09:03:19 2012 +0000
@@ -75,6 +75,8 @@
     public static final int FIX_DELTA_W_KM_MAX_DIGITS = 3;
     public static final int FIX_DELTA_W_DELTA_W_MIN_DIGITS = 3;
     public static final int FIX_DELTA_W_DELTA_W_MAX_DIGITS = 3;
+    public static final int FIX_DELTA_W_DELTA_Q_MIN_DIGITS  = 0;
+    public static final int FIX_DELTA_W_DELTA_Q_MAX_DIGITS  = 2;
 
     /**
      * Creates a localised NumberFormatter with given range of decimal digits.
@@ -368,6 +370,14 @@
             FIX_DELTA_W_DELTA_W_MAX_DIGITS);
     }
 
+    public static NumberFormat getFixDeltaWQ(CallContext context) {
+        return getFormatter(
+            context,
+            FIX_DELTA_W_DELTA_Q_MIN_DIGITS,
+            FIX_DELTA_W_DELTA_Q_MAX_DIGITS);
+    }
+
+
     public static NumberFormat getMeterFormat(CallContext context) {
         return getFormatter(
             context,
--- a/flys-artifacts/src/main/resources/messages.properties	Wed Jul 18 08:19:03 2012 +0000
+++ b/flys-artifacts/src/main/resources/messages.properties	Wed Jul 18 09:03:19 2012 +0000
@@ -342,6 +342,12 @@
 chart.fix.deltawt.xaxis.label=Date
 chart.fix.deltawt.yaxis.label=\u0394 W(t) [cm]
 
+export.fixings.deltawt.csv.header.km=km
+export.fixings.deltawt.csv.header.deltaw=\u0394 W [cm]
+export.fixings.deltawt.csv.header.q=Discharge [m\u00b3/s]
+export.fixings.deltawt.csv.header.t=Date
+export.fixings.deltawt.csv.header.description=Description
+
 fix.missing.river=Missing river
 fix.missing.from=Missing start km
 fix.missing.to=Missing end km
--- a/flys-artifacts/src/main/resources/messages_de.properties	Wed Jul 18 08:19:03 2012 +0000
+++ b/flys-artifacts/src/main/resources/messages_de.properties	Wed Jul 18 09:03:19 2012 +0000
@@ -343,6 +343,12 @@
 chart.fix.deltawt.xaxis.label=Datum
 chart.fix.deltawt.yaxis.label=\u0394 W(t) [cm]
 
+export.fixings.deltawt.csv.header.km=km
+export.fixings.deltawt.csv.header.deltaw=\u0394 W [cm]
+export.fixings.deltawt.csv.header.q=Abfluss [m\u00b3/s]
+export.fixings.deltawt.csv.header.t=Datum
+export.fixings.deltawt.csv.header.description=Beschreibung
+
 fix.missing.river=Kein Gew\u00e4sser gew\u00e4hlt
 fix.missing.from=Kein Startkilometer gew\u00e4hlt
 fix.missing.to=Kein Endkilometer gew\u00e4hlt
--- a/flys-artifacts/src/main/resources/messages_de_DE.properties	Wed Jul 18 08:19:03 2012 +0000
+++ b/flys-artifacts/src/main/resources/messages_de_DE.properties	Wed Jul 18 09:03:19 2012 +0000
@@ -342,6 +342,12 @@
 chart.fix.deltawt.xaxis.label=Datum
 chart.fix.deltawt.yaxis.label=\u0394 W(t) [cm]
 
+export.fixings.deltawt.csv.header.km=km
+export.fixings.deltawt.csv.header.deltaw=\u0394 W [cm]
+export.fixings.deltawt.csv.header.q=Abfluss [m\u00b3/s]
+export.fixings.deltawt.csv.header.t=Datum
+export.fixings.deltawt.csv.header.description=Beschreibung
+
 fix.missing.river=Kein Gew\u00e4sser gew\u00e4hlt
 fix.missing.from=Kein Startkilometer gew\u00e4hlt
 fix.missing.to=Kein Endkilometer gew\u00e4hlt
--- a/flys-artifacts/src/main/resources/messages_en.properties	Wed Jul 18 08:19:03 2012 +0000
+++ b/flys-artifacts/src/main/resources/messages_en.properties	Wed Jul 18 09:03:19 2012 +0000
@@ -342,6 +342,12 @@
 chart.fix.deltawt.xaxis.label=Date
 chart.fix.deltawt.yaxis.label=\u0394 W(t) [cm]
 
+export.fixings.deltawt.csv.header.km=km
+export.fixings.deltawt.csv.header.deltaw=\u0394 W [cm]
+export.fixings.deltawt.csv.header.q=Discharge [m\u00b3/s]
+export.fixings.deltawt.csv.header.t=Date
+export.fixings.deltawt.csv.header.description=Description
+
 fix.missing.river=Missing river
 fix.missing.from=Missing start km
 fix.missing.to=Missing end km

http://dive4elements.wald.intevation.org