changeset 8541:c0334399625b

(issue1753) Add measurements to CSV export
author Andre Heinecke <andre.heinecke@intevation.de>
date Fri, 13 Feb 2015 12:35:18 +0100
parents 422a78fbb4df
children 7b210881d6db
files artifacts/src/main/java/org/dive4elements/river/exports/sq/SQRelationExporter.java artifacts/src/main/resources/messages.properties artifacts/src/main/resources/messages_de.properties artifacts/src/main/resources/messages_de_DE.properties artifacts/src/main/resources/messages_en.properties
diffstat 5 files changed, 72 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- 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;
     }
--- 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
--- 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
--- 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
--- 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

http://dive4elements.wald.intevation.org