changeset 7937:a310b1f85ce0

issue1633: Add info lines in SQ-relation CSV export.
author Tom Gottfried <tom@intevation.de>
date Tue, 17 Jun 2014 17:57:25 +0200
parents 5ef60ed15c25
children 2fc967e24f03
files artifacts/src/main/java/org/dive4elements/river/exports/AbstractExporter.java 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 6 files changed, 135 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/exports/AbstractExporter.java	Tue Jun 17 17:50:59 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/AbstractExporter.java	Tue Jun 17 17:57:25 2014 +0200
@@ -62,6 +62,8 @@
     /** The default separator for the CSV export. */
     public static final char DEFAULT_CSV_SEPARATOR = ';';
 
+    public static final String START_META_CHAR = "#";
+
     /** XPath that points to the desired export facet. */
     public static final String XPATH_FACET = "/art:action/@art:type";
 
@@ -103,6 +105,25 @@
 
 
     /**
+     * Write lines of informative content to CSV file.
+     * Usually this will be done above the column headers from within
+     * the implementation of writeCSVData in concret subclasses.
+     *
+     * @param writer The CSVWriter
+     * @param infolines Array of Strings with informative content.
+     * Each will be written to a separate line prefixed with START_META_CHAR.
+     */
+    protected void  writeCSVInfo(CSVWriter writer, String[] infolines) {
+        String[] metaline = new String[1];
+
+        for (String infoline: infolines) {
+            metaline[0] = START_META_CHAR + " " + infoline;
+            writer.writeNext(metaline);
+        }
+
+    }
+
+    /**
      * Concrete subclasses need to use this method to write their special data
      * objects into the PDF document.
      */
--- a/artifacts/src/main/java/org/dive4elements/river/exports/sq/SQRelationExporter.java	Tue Jun 17 17:50:59 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/sq/SQRelationExporter.java	Tue Jun 17 17:57:25 2014 +0200
@@ -57,6 +57,47 @@
     private static final Logger logger =
         Logger.getLogger(SQRelationExporter.class);
 
+    public static final String INFO_COEFF_A =
+        "export.sqrelation.csv.info.coeff.a";
+
+    public static final String INFO_COEFF_B =
+        "export.sqrelation.csv.info.coeff.b";
+
+    public static final String INFO_QMAX =
+        "export.sqrelation.csv.info.qmax";
+
+    public static final String INFO_R2 =
+        "export.sqrelation.csv.info.r2";
+
+    public static final String INFO_NTOT =
+        "export.sqrelation.csv.info.ntot";
+
+    public static final String INFO_NOUTL =
+        "export.sqrelation.csv.info.noutl";
+
+    public static final String INFO_CFERGUSON =
+        "export.sqrelation.csv.info.cferguson";
+
+    public static final String INFO_CDUAN =
+        "export.sqrelation.csv.info.cduan";
+
+    public static final String INFO_PARAM_A =
+        "export.sqrelation.csv.info.param.a";
+
+    public static final String INFO_PARAM_B =
+        "export.sqrelation.csv.info.param.b";
+
+    public static final String INFO_PARAM_C =
+        "export.sqrelation.csv.info.param.c";
+
+    public static final String INFO_PARAM_D =
+        "export.sqrelation.csv.info.param.d";
+
+    public static final String INFO_PARAM_E =
+        "export.sqrelation.csv.info.param.e";
+
+    public static final String INFO_PARAM_F =
+        "export.sqrelation.csv.info.param.f";
 
     public static final String CSV_PARAMETER =
         "export.sqrelation.csv.header.parameter";
@@ -148,6 +189,23 @@
     protected void writeCSVData(CSVWriter writer) {
         logger.debug("writeCSVData");
 
+        writeCSVInfo(writer, new String[] {
+                msg(INFO_COEFF_A),
+                msg(INFO_COEFF_B),
+                msg(INFO_QMAX),
+                msg(INFO_R2),
+                msg(INFO_NTOT),
+                msg(INFO_NOUTL),
+                msg(INFO_CFERGUSON),
+                msg(INFO_CDUAN),
+                msg(INFO_PARAM_A),
+                msg(INFO_PARAM_B),
+                msg(INFO_PARAM_C),
+                msg(INFO_PARAM_D),
+                msg(INFO_PARAM_E),
+                msg(INFO_PARAM_F)
+            });
+
         writeCSVHeader(writer);
 
         for (SQResult [] results: data) {
--- a/artifacts/src/main/resources/messages.properties	Tue Jun 17 17:50:59 2014 +0200
+++ b/artifacts/src/main/resources/messages.properties	Tue Jun 17 17:57:25 2014 +0200
@@ -424,6 +424,20 @@
 export.sedimentload_ls.csv.header.suspsediment = susp. sediment
 export.sedimentload_ls.csv.header.suspsandbb = susp. sand (BB)
 export.sedimentload_ls.csv.header.total = total
+export.sqrelation.csv.info.coeff.a = a: coefficient of transport curve
+export.sqrelation.csv.info.coeff.b = b: exponent of transport curve
+export.sqrelation.csv.info.qmax = Q max, measured: maximum measured discharge [m\u00b3/s]
+export.sqrelation.csv.info.r2 = r^2: coefficient of determination
+export.sqrelation.csv.info.ntot = n total: number of measurements
+export.sqrelation.csv.info.noutl = n outliers: number of outliers
+export.sqrelation.csv.info.cferguson = CFERGUSON: bias correction (Ferguson, 1986)
+export.sqrelation.csv.info.cduan = CDUAN: bias correction (Duan, 1983)
+export.sqrelation.csv.info.param.a = Parameter A: transport of fine material (< 0.063 mm)
+export.sqrelation.csv.info.param.b = Parameter B: transport of suspended sand (0.063-2 mm)
+export.sqrelation.csv.info.param.c = Parameter C: transport of sand (0.063-2 mm)
+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.header.parameter = Parameter
 export.sqrelation.csv.header.station = Station
 export.sqrelation.csv.header.km = River-Km
--- a/artifacts/src/main/resources/messages_de.properties	Tue Jun 17 17:50:59 2014 +0200
+++ b/artifacts/src/main/resources/messages_de.properties	Tue Jun 17 17:57:25 2014 +0200
@@ -426,6 +426,20 @@
 export.sedimentload_ls.csv.header.suspsandbb = susp.Sand(BB)
 export.sedimentload_ls.csv.header.suspsediment = Schwebst.
 export.sedimentload_ls.csv.header.total = Gesamt
+export.sqrelation.csv.info.coeff.a = a: Transportkurvenkoeffizient
+export.sqrelation.csv.info.coeff.b = b: Transportkurvenexponent
+export.sqrelation.csv.info.qmax = Q max, gemessen: maximal gemessener Abfluss [m\u00b3/s]
+export.sqrelation.csv.info.r2 = r^2: Bestimmtheitsma\u00d
+export.sqrelation.csv.info.ntot = n Gesamt: Anzahl Messwerte
+export.sqrelation.csv.info.noutl = n Ausrei\u00dfer: Anzahl Ausrei\u00dfer
+export.sqrelation.csv.info.cferguson = CFERGUSON: Bias Korrektur nach Ferguson 1986
+export.sqrelation.csv.info.cduan = CDUAN: Bias Korrektur nach Duan 1983
+export.sqrelation.csv.info.param.a = Parameter A: Sedimenttransport von Feinkornanteil (< 0.063 mm)
+export.sqrelation.csv.info.param.b = Parameter B: Sedimenttransport von Sand (Suspensionstransort)(0.063-2 mm)
+export.sqrelation.csv.info.param.c = Parameter C: Sedimenttransport von Sand (Geschiebetransport)          (0.063-2 mm)
+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.header.parameter = Parameter
 export.sqrelation.csv.header.station = Station
 export.sqrelation.csv.header.km = Fluss-Km
--- a/artifacts/src/main/resources/messages_de_DE.properties	Tue Jun 17 17:50:59 2014 +0200
+++ b/artifacts/src/main/resources/messages_de_DE.properties	Tue Jun 17 17:57:25 2014 +0200
@@ -422,6 +422,20 @@
 export.sedimentload_ls.csv.header.suspsandbb = susp.Sand(BB)
 export.sedimentload_ls.csv.header.suspsediment = Schwebst.
 export.sedimentload_ls.csv.header.total = Gesamt
+export.sqrelation.csv.info.coeff.a = a: Transportkurvenkoeffizient
+export.sqrelation.csv.info.coeff.b = b: Transportkurvenexponent
+export.sqrelation.csv.info.qmax = Q max, gemessen: maximal gemessener Abfluss [m\u00b3/s]
+export.sqrelation.csv.info.r2 = r^2: Bestimmtheitsma\u00d
+export.sqrelation.csv.info.ntot = n Gesamt: Anzahl Messwerte
+export.sqrelation.csv.info.noutl = n Ausrei\u00dfer: Anzahl Ausrei\u00dfer
+export.sqrelation.csv.info.cferguson = CFERGUSON: Bias Korrektur nach Ferguson 1986
+export.sqrelation.csv.info.cduan = CDUAN: Bias Korrektur nach Duan 1983
+export.sqrelation.csv.info.param.a = Parameter A: Sedimenttransport von Feinkornanteil (< 0.063 mm)
+export.sqrelation.csv.info.param.b = Parameter B: Sedimenttransport von Sand (Suspensionstransort)(0.063-2 mm)
+export.sqrelation.csv.info.param.c = Parameter C: Sedimenttransport von Sand (Geschiebetransport)          (0.063-2 mm)
+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.header.parameter = Parameter
 export.sqrelation.csv.header.station = Station
 export.sqrelation.csv.header.km = Fluss-Km
--- a/artifacts/src/main/resources/messages_en.properties	Tue Jun 17 17:50:59 2014 +0200
+++ b/artifacts/src/main/resources/messages_en.properties	Tue Jun 17 17:57:25 2014 +0200
@@ -428,6 +428,20 @@
 export.sedimentload_ls.csv.header.suspsand = susp. sand
 export.sedimentload_ls.csv.header.suspsediment = susp. sediment
 export.sedimentload_ls.csv.header.total = total
+export.sqrelation.csv.info.coeff.a = a: coefficient of transport curve
+export.sqrelation.csv.info.coeff.b = b: exponent of transport curve
+export.sqrelation.csv.info.qmax = Q max, measured: maximum measured discharge [m\u00b3/s]
+export.sqrelation.csv.info.r2 = r^2: coefficient of determination
+export.sqrelation.csv.info.ntot = n total: number of measurements
+export.sqrelation.csv.info.noutl = n outliers: number of outliers
+export.sqrelation.csv.info.cferguson = CFERGUSON: bias correction (Ferguson, 1986)
+export.sqrelation.csv.info.cduan = CDUAN: bias correction (Duan, 1983)
+export.sqrelation.csv.info.param.a = Parameter A: transport of fine material (< 0.063 mm)
+export.sqrelation.csv.info.param.b = Parameter B: transport of suspended sand (0.063-2 mm)
+export.sqrelation.csv.info.param.c = Parameter C: transport of sand (0.063-2 mm)
+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.header.parameter = Parameter
 export.sqrelation.csv.header.station = Station
 export.sqrelation.csv.header.km = River-Km

http://dive4elements.wald.intevation.org