[PATCH 11 of 45] (issue1753) Add measurements to CSV export

Wald Commits scm-commit at wald.intevation.org
Tue Mar 10 17:05:39 CET 2015


# HG changeset patch
# User Andre Heinecke <andre.heinecke at intevation.de>
# Date 1423827318 -3600
# Node ID c0334399625b66b046bd6c7a77cce882d67ddd7e
# Parent  422a78fbb4df6cb1eb60248b21eec49895ba7489
(issue1753) Add measurements to CSV export

diff -r 422a78fbb4df -r c0334399625b artifacts/src/main/java/org/dive4elements/river/exports/sq/SQRelationExporter.java
--- a/artifacts/src/main/java/org/dive4elements/river/exports/sq/SQRelationExporter.java	Fri Feb 13 12:34:38 2015 +0100
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/sq/SQRelationExporter.java	Fri Feb 13 12:35:18 2015 +0100
@@ -30,6 +30,7 @@
 import org.dive4elements.river.artifacts.model.CalculationResult;
 import org.dive4elements.river.artifacts.model.sq.SQFractionResult;
 import org.dive4elements.river.artifacts.model.sq.SQResult;
+import org.dive4elements.river.artifacts.model.sq.SQ;
 import org.dive4elements.river.artifacts.model.sq.SQRelationJRDataSource;
 import org.dive4elements.river.artifacts.model.Parameters;
 import org.dive4elements.river.artifacts.model.DateRange;
@@ -102,6 +103,15 @@
     public static final String INFO_PARAM_F =
         "export.sqrelation.csv.info.param.f";
 
+    public static final String INFO_Q =
+        "export.sqrelation.csv.info.q";
+
+    public static final String INFO_S_KG =
+        "export.sqrelation.csv.info.s_kg";
+
+    public static final String INFO_DATE =
+        "export.sqrelation.csv.info.date";
+
     public static final String CSV_PARAMETER =
         "export.sqrelation.csv.header.parameter";
 
@@ -147,6 +157,15 @@
     public static final String CSV_SD =
         "export.sqrelation.csv.header.sd";
 
+    public static final String CSV_S_KG =
+        "export.sqrelation.csv.header.s_kg";
+
+    public static final String CSV_Q =
+        "export.sqrelation.csv.header.q";
+
+    public static final String CSV_DATE =
+        "export.sqrelation.csv.header.date";
+
     public static final String PDF_TITLE=
         "export.sqrelation.pdf.title";
 
@@ -184,7 +203,10 @@
             msg(CSV_N_TOTAL),
             msg(CSV_N_OUTLIERS),
             msg(CSV_C_DUAN),
-            msg(CSV_C_FERGUSON)
+            msg(CSV_C_FERGUSON),
+            msg(CSV_S_KG),
+            msg(CSV_Q),
+            msg(CSV_DATE)
         });
     }
 
@@ -207,7 +229,10 @@
                 msg(INFO_PARAM_C),
                 msg(INFO_PARAM_D),
                 msg(INFO_PARAM_E),
-                msg(INFO_PARAM_F)
+                msg(INFO_PARAM_F),
+                msg(INFO_S_KG),
+                msg(INFO_Q),
+                msg(INFO_DATE)
             });
 
         writeCSVHeader(writer);
@@ -229,6 +254,8 @@
         NumberFormat fThreeFormatter = Formatter.getFormatter(context, 3, 3);
         NumberFormat fTwoFormatter = Formatter.getFormatter(context, 2, 2);
         NumberFormat fZeroFormatter = Formatter.getFormatter(context, 0, 0);
+        DateFormat df = DateFormat.getDateInstance(DateFormat.SHORT,
+                Resources.getLocale(context.getMeta()));
 
         for (int i = 0; i < SQResult.NUMBER_FRACTIONS; ++i) {
             SQFractionResult fraction = result.getFraction(i);
@@ -256,19 +283,25 @@
             o  = String.valueOf(fraction.totalNumOutliers());
             t  = String.valueOf(fraction.numMeasurements());
 
-            retval.add(new String[] {
-                km,
-                name,
-                a,
-                b,
-                sd, // 4
-                max_q, // 5
-                r2, // 6
-                t, // 7
-                o, // 8
-                c_duan, // 9
-                c_ferguson // 10
-            });
+            for (SQ sq: fraction.getMeasurements()) {
+                retval.add(new String[] {
+                    km,
+                    name,
+                    a,
+                    b,
+                    sd, // 4
+                    max_q, // 5
+                    r2, // 6
+                    t, // 7
+                    o, // 8
+                    c_duan, // 9
+                    c_ferguson, // 10
+                    sqAFormatter.format(sq.getS()),
+                    fZeroFormatter.format(sq.getQ()),
+                    df.format(sq.getDate())
+                });
+            }
+
         }
         return retval;
     }
diff -r 422a78fbb4df -r c0334399625b artifacts/src/main/resources/messages.properties
--- a/artifacts/src/main/resources/messages.properties	Fri Feb 13 12:34:38 2015 +0100
+++ b/artifacts/src/main/resources/messages.properties	Fri Feb 13 12:35:18 2015 +0100
@@ -458,6 +458,9 @@
 export.sqrelation.csv.info.param.d = Parameter D: transport of fine and medium gravel (2-16 mm)
 export.sqrelation.csv.info.param.e = Parameter E: transport of coarse gravel (> Mittelkies)(16-125 mm)
 export.sqrelation.csv.info.param.f = Parameter F: transport of bed load (0.063-125 mm)
+export.sqrelation.csv.info.q = Discharge in [m\u00b3/s] as measured on measurement date
+export.sqrelation.csv.info.s_kg = Transport in [kg/s] as measured on measurement date
+export.sqrelation.csv.info.date = The date this measurment was made
 export.sqrelation.csv.header.parameter = Parameter
 export.sqrelation.csv.header.station = Station
 export.sqrelation.csv.header.km = River-Km
@@ -473,6 +476,9 @@
 export.sqrelation.csv.header.c.ferguson = C (Ferguson)
 export.sqrelation.csv.header.sd = Standard error
 export.sqrelation.csv.header.qmax = Q max, measured [m\u00b3/s]
+export.sqrelation.csv.header.s_kg = S, measured [kg/s]
+export.sqrelation.csv.header.q = Q, measured [m\u00b3/s]
+export.sqrelation.csv.header.date = Measurement date
 export.sqrelation.pdf.file = /jasper/sqrelation_en.jasper
 export.sqrelation.pdf.mode = Load Discharge Relation
 export.minfo.bedquality.km = km
diff -r 422a78fbb4df -r c0334399625b artifacts/src/main/resources/messages_de.properties
--- a/artifacts/src/main/resources/messages_de.properties	Fri Feb 13 12:34:38 2015 +0100
+++ b/artifacts/src/main/resources/messages_de.properties	Fri Feb 13 12:35:18 2015 +0100
@@ -460,6 +460,9 @@
 export.sqrelation.csv.info.param.d = Parameter D: Sedimenttransport von Fein- und Mittelkies (2-16 mm)
 export.sqrelation.csv.info.param.e = Parameter E: Sedimenttransport von Grobkornanteil (> Mittelkies)(16-125 mm)
 export.sqrelation.csv.info.param.f = Parameter F: Sedimenttransport von Geschiebtransportgesamt (0.063-125 mm)
+export.sqrelation.csv.info.q = Am Messdatum gemessener Abfluss in [m\u00b3/s]
+export.sqrelation.csv.info.s_kg = Am Messdatum gemessener Transport in [kg/s]
+export.sqrelation.csv.info.date = Datum dieser Messung
 export.sqrelation.csv.header.parameter = Parameter
 export.sqrelation.csv.header.station = Station
 export.sqrelation.csv.header.km = Fluss-Km
@@ -475,6 +478,9 @@
 export.sqrelation.csv.header.c.ferguson = C (Ferguson)
 export.sqrelation.csv.header.sd = Standardfehler
 export.sqrelation.csv.header.qmax = Q max, gemessen [m\u00b3/s]
+export.sqrelation.csv.header.s_kg = S, gemessen [kg/s]
+export.sqrelation.csv.header.q = Q, gemessen [m\u00b3/s]
+export.sqrelation.csv.header.date = Messdatum
 export.sqrelation.pdf.file = /jasper/sqrelation.jasper
 export.sqrelation.pdf.mode = Transport-Abfluss Beziehung
 export.minfo.bedquality.km = km
diff -r 422a78fbb4df -r c0334399625b artifacts/src/main/resources/messages_de_DE.properties
--- a/artifacts/src/main/resources/messages_de_DE.properties	Fri Feb 13 12:34:38 2015 +0100
+++ b/artifacts/src/main/resources/messages_de_DE.properties	Fri Feb 13 12:35:18 2015 +0100
@@ -456,6 +456,9 @@
 export.sqrelation.csv.info.param.d = Parameter D: Sedimenttransport von Fein- und Mittelkies (2-16 mm)
 export.sqrelation.csv.info.param.e = Parameter E: Sedimenttransport von Grobkornanteil (> Mittelkies)(16-125 mm)
 export.sqrelation.csv.info.param.f = Parameter F: Sedimenttransport von Geschiebtransportgesamt (0.063-125 mm)
+export.sqrelation.csv.info.q = Am Messdatum gemessener Abfluss in [m\u00b3/s]
+export.sqrelation.csv.info.s_kg = Am Messdatum gemessener Transport in [kg/s]
+export.sqrelation.csv.info.date = Datum dieser Messung
 export.sqrelation.csv.header.parameter = Parameter
 export.sqrelation.csv.header.station = Station
 export.sqrelation.csv.header.km = Fluss-Km
@@ -471,6 +474,9 @@
 export.sqrelation.csv.header.c.ferguson = C (Ferguson)
 export.sqrelation.csv.header.sd = Standardfehler
 export.sqrelation.csv.header.qmax = Q max, gemessen [m\u00b3/s]
+export.sqrelation.csv.header.s_kg = S, gemessen [kg/s]
+export.sqrelation.csv.header.q = Q, gemessen [m\u00b3/s]
+export.sqrelation.csv.header.date = Messdatum
 export.sqrelation.pdf.file = /jasper/sqrelation.jasper
 export.sqrelation.pdf.mode = Transport-Abfluss Beziehung
 export.minfo.bedquality.km = km
diff -r 422a78fbb4df -r c0334399625b artifacts/src/main/resources/messages_en.properties
--- a/artifacts/src/main/resources/messages_en.properties	Fri Feb 13 12:34:38 2015 +0100
+++ b/artifacts/src/main/resources/messages_en.properties	Fri Feb 13 12:35:18 2015 +0100
@@ -460,6 +460,9 @@
 export.sqrelation.csv.info.param.d = Parameter D: transport of fine and medium gravel (2-16 mm)
 export.sqrelation.csv.info.param.e = Parameter E: transport of coarse gravel (> Mittelkies)(16-125 mm)
 export.sqrelation.csv.info.param.f = Parameter F: transport of bed load (0.063-125 mm)
+export.sqrelation.csv.info.q = Discharge in [m\u00b3/s] as measured on measurement date
+export.sqrelation.csv.info.s_kg = Transport in [kg/s] as measured on measurement date
+export.sqrelation.csv.info.date = The date this measurment was made
 export.sqrelation.csv.header.parameter = Parameter
 export.sqrelation.csv.header.station = Station
 export.sqrelation.csv.header.km = River-Km
@@ -475,6 +478,9 @@
 export.sqrelation.csv.header.c.ferguson = C (Ferguson)
 export.sqrelation.csv.header.sd = Standard error
 export.sqrelation.csv.header.qmax = Q max, measured [m\u00b3/s]
+export.sqrelation.csv.header.s_kg = S, measured [kg/s]
+export.sqrelation.csv.header.q = Q, measured [m\u00b3/s]
+export.sqrelation.csv.header.date = Measurement date
 export.sqrelation.pdf.file = /jasper/sqrelation_en.jasper
 export.sqrelation.pdf.mode = Load Discharge Relation
 export.minfo.bedquality.km = km


More information about the Dive4Elements-commits mailing list