changeset 6828:708416bb560c

(issue1347) Add new variables to SQ Relation output.
author Andre Heinecke <aheinecke@intevation.de>
date Wed, 14 Aug 2013 15:23:36 +0200
parents 2972a219743d
children 45c7d54c0bc5
files artifacts/src/main/java/org/dive4elements/river/artifacts/model/sq/SQRelationJRDataSource.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, 71 insertions(+), 29 deletions(-) [+]
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/sq/SQRelationJRDataSource.java	Wed Aug 14 15:20:01 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/sq/SQRelationJRDataSource.java	Wed Aug 14 15:23:36 2013 +0200
@@ -86,12 +86,24 @@
             value = data.get(index)[3];
         }
         else if ("total".equals(fieldName)) {
-            value = data.get(index)[4];
+            value = data.get(index)[7];
         }
         else if ("out".equals(fieldName)) {
+            value = data.get(index)[8];
+        }
+        else if ("sd".equals(fieldName)) {
+            value = data.get(index)[4];
+        }
+        else if ("qmax".equals(fieldName)) {
             value = data.get(index)[5];
         }
-        else if ("variance".equals(fieldName)) {
+        else if ("cferg".equals(fieldName)) {
+            value = data.get(index)[10];
+        }
+        else if ("cduan".equals(fieldName)) {
+            value = data.get(index)[9];
+        }
+        else if ("r2".equals(fieldName)) {
             value = data.get(index)[6];
         }
         return value;
--- a/artifacts/src/main/java/org/dive4elements/river/exports/sq/SQRelationExporter.java	Wed Aug 14 15:20:01 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/sq/SQRelationExporter.java	Wed Aug 14 15:23:36 2013 +0200
@@ -16,6 +16,7 @@
 import java.util.Date;
 import java.util.Locale;
 import java.text.DateFormat;
+import java.text.NumberFormat;
 
 import org.w3c.dom.Document;
 
@@ -99,8 +100,11 @@
     public static final String CSV_C_FERGUSON =
         "export.sqrelation.csv.header.c.ferguson";
 
-    public static final String CSV_VARIANCE =
-        "export.sqrelation.csv.header.variance";
+    public static final String CSV_QMAX =
+        "export.sqrelation.csv.header.qmax";
+
+    public static final String CSV_SD =
+        "export.sqrelation.csv.header.sd";
 
     public static final String PDF_TITLE=
         "export.sqrelation.pdf.title";
@@ -136,9 +140,13 @@
             msg(CSV_PARAMETER,  CSV_PARAMETER),
             msg(CSV_COEFF_A   , CSV_COEFF_A),
             msg(CSV_COEFF_B   , CSV_COEFF_B),
+            msg(CSV_SD, CSV_SD),
+            msg(CSV_QMAX, CSV_QMAX),
+            msg(CSV_COEFF_R, CSV_COEFF_R),
             msg(CSV_N_TOTAL   , CSV_N_TOTAL),
             msg(CSV_N_OUTLIERS, CSV_N_OUTLIERS),
-            msg(CSV_VARIANCE  , CSV_VARIANCE)
+            msg(CSV_C_DUAN, CSV_C_DUAN),
+            msg(CSV_C_FERGUSON, CSV_C_FERGUSON)
         });
     }
 
@@ -160,6 +168,12 @@
                     ).format(result.getKm());
         List<String[]> retval = new ArrayList<String[]>();
 
+        NumberFormat sqAFormatter = Formatter.getSQRelationA(context);
+        NumberFormat sqBFormatter = Formatter.getSQRelationB(context);
+        NumberFormat fThreeFormatter = Formatter.getFormatter(context, 3, 3);
+        NumberFormat fTwoFormatter = Formatter.getFormatter(context, 2, 2);
+        NumberFormat fZeroFormatter = Formatter.getFormatter(context, 0, 0);
+
         for (int i = 0; i < SQResult.NUMBER_FRACTIONS; ++i) {
             SQFractionResult fraction = result.getFraction(i);
 
@@ -171,10 +185,17 @@
                 continue;
             }
 
-            String a, b, sd, o, t;
-            a  = Formatter.getSQRelationA(context).format(parameters.getValue(0, "a"));
-            b  = Formatter.getSQRelationB(context).format(parameters.getValue(0, "b"));
-            sd = Formatter.getVariance(context).format(Math.sqrt(parameters.getValue(0, "std_dev")));
+            String a, b, sd, o, t, max_q, c_ferguson, c_duan, r2;
+            a  = sqAFormatter.format(parameters.getValue(0, "a"));
+            b  = sqBFormatter.format(parameters.getValue(0, "b"));
+
+            /* The std_dev parameter contains the standard error actually */
+            sd = fThreeFormatter.format(parameters.getValue(0, "std_dev"));
+            max_q = fZeroFormatter.format(parameters.getValue(0, "max_q"));
+            c_ferguson = fTwoFormatter.format(parameters.getValue(0, "c_ferguson"));
+            c_duan = fTwoFormatter.format(parameters.getValue(0, "c_duan"));
+            r2 = fTwoFormatter.format(parameters.getValue(0, "r2"));
+
 
             o  = String.valueOf(fraction.totalNumOutliers());
             t  = String.valueOf(fraction.numMeasurements() + o);
@@ -184,9 +205,13 @@
                 name,
                 a,
                 b,
-                t,
-                o,
-                sd
+                sd, // 4
+                max_q, // 5
+                r2, // 6
+                t, // 7
+                o, // 8
+                c_duan, // 9
+                c_ferguson // 10
             });
         }
         return retval;
--- a/artifacts/src/main/resources/messages.properties	Wed Aug 14 15:20:01 2013 +0200
+++ b/artifacts/src/main/resources/messages.properties	Wed Aug 14 15:23:36 2013 +0200
@@ -171,7 +171,7 @@
 chart.computed.discharge.curve.subtitle = {0}-km: {1,number,#.###}
 chart.computed.discharge.curve.yaxis.label = W [{0}]
 chart.computed.discharge.curve.curve.label = Discharge Curve {0} km {1}
-chart.computed.discharge.curve.gauge = Discharge curve at gauge {0} (km {1})
+chart.computed.discharge.curve.gauge = current DC {0} {1} - {2}
 chart.duration.curve.title = Duration Curve
 chart.duration.curve.subtitle = {0}-km: {1,number,#.###}
 chart.duration.curve.xaxis.label = Duration of Non-Exceedence [Days]
@@ -404,9 +404,10 @@
 export.sqrelation.csv.header.coeff.r = r^2
 export.sqrelation.csv.header.n.total = n total
 export.sqrelation.csv.header.n.outliers = n outliers
-export.sqrelation.csv.header.c.duan = C (DUAN)
-export.sqrelation.csv.header.c.ferguson = C (FERGUSON)
-export.sqrelation.csv.header.variance = Standard variance
+export.sqrelation.csv.header.c.duan = C (Duan)
+export.sqrelation.csv.header.c.ferguson = C (Ferguson)
+export.sqrelation.csv.header.sd = Standard error
+export.sqrelation.csv.header.qmax = Q max,measured
 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	Wed Aug 14 15:20:01 2013 +0200
+++ b/artifacts/src/main/resources/messages_de.properties	Wed Aug 14 15:23:36 2013 +0200
@@ -171,7 +171,7 @@
 chart.computed.discharge.curve.subtitle = {0}-km: {1,number,#.###}
 chart.computed.discharge.curve.yaxis.label = W [{0}]
 chart.computed.discharge.curve.curve.label = Abflusskurve {0} km {1}
-chart.computed.discharge.curve.gauge = Abflusskurve an Pegel {0} (km {1})
+chart.computed.discharge.curve.gauge = aktuelle AT {0} {1} - {2}
 chart.duration.curve.title = Dauerlinie
 chart.duration.curve.subtitle = {0}-km: {1,number,#.###}
 chart.duration.curve.xaxis.label = Unterschreitungsdauer [Tage]
@@ -402,11 +402,12 @@
 export.sqrelation.csv.header.coeff.b = b
 export.sqrelation.csv.header.coeff.q = Q
 export.sqrelation.csv.header.coeff.r = r^2
-export.sqrelation.csv.header.n.total = n gesamt
+export.sqrelation.csv.header.n.total = n Gesamt
 export.sqrelation.csv.header.n.outliers = n Ausrei\u00dfer
-export.sqrelation.csv.header.c.duan = C (DUAN)
-export.sqrelation.csv.header.c.ferguson = C (FERGUSON)
-export.sqrelation.csv.header.variance = Standardabweichung
+export.sqrelation.csv.header.c.duan = C (Duan)
+export.sqrelation.csv.header.c.ferguson = C (Ferguson)
+export.sqrelation.csv.header.sd = Standardfehler
+export.sqrelation.csv.header.qmax = Q max,gemessen
 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	Wed Aug 14 15:20:01 2013 +0200
+++ b/artifacts/src/main/resources/messages_de_DE.properties	Wed Aug 14 15:23:36 2013 +0200
@@ -170,7 +170,7 @@
 chart.computed.discharge.curve.subtitle = {0}-km: {1,number,#.###}
 chart.computed.discharge.curve.yaxis.label = W [{0}]
 chart.computed.discharge.curve.curve.label = Abflusskurve {0} km {1}
-chart.computed.discharge.curve.gauge = Abflusskurve an Pegel {0} (km {1})
+chart.computed.discharge.curve.gauge = aktuelle AT {0} {1} - {2}
 chart.duration.curve.title = Dauerlinie
 chart.duration.curve.subtitle = {0}-km: {1,number,#.###}
 chart.duration.curve.xaxis.label = Unterschreitungsdauer [Tage]
@@ -399,11 +399,12 @@
 export.sqrelation.csv.header.coeff.b = b
 export.sqrelation.csv.header.coeff.q = Q
 export.sqrelation.csv.header.coeff.r = r^2
-export.sqrelation.csv.header.n.total = n gesamt
+export.sqrelation.csv.header.n.total = n Gesamt
 export.sqrelation.csv.header.n.outliers = n Ausrei\u00dfer
-export.sqrelation.csv.header.c.duan = C (DUAN)
-export.sqrelation.csv.header.c.ferguson = C (FERGUSON)
-export.sqrelation.csv.header.variance = Standardabweichung
+export.sqrelation.csv.header.c.duan = C (Duan)
+export.sqrelation.csv.header.c.ferguson = C (Ferguson)
+export.sqrelation.csv.header.sd = Standardfehler
+export.sqrelation.csv.header.qmax = Q max,gemessen
 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	Wed Aug 14 15:20:01 2013 +0200
+++ b/artifacts/src/main/resources/messages_en.properties	Wed Aug 14 15:23:36 2013 +0200
@@ -171,6 +171,7 @@
 chart.computed.discharge.curve.subtitle = {0}-km: {1,number,#.###}
 chart.computed.discharge.curve.yaxis.label = W [{0}]
 chart.computed.discharge.curve.curve.label = Discharge Curve {0} km {1}
+chart.computed.discharge.curve.gauge = current DC {0} {1} - {2}
 chart.duration.curve.title = Duration Curve
 chart.duration.curve.subtitle = {0}-km: {1,number,#.###}
 chart.duration.curve.xaxis.label = Duration of Non-Exceedence [Days]
@@ -406,9 +407,10 @@
 export.sqrelation.csv.header.coeff.r = r^2
 export.sqrelation.csv.header.n.total = n total
 export.sqrelation.csv.header.n.outliers = n outliers
-export.sqrelation.csv.header.c.duan = C (DUAN)
-export.sqrelation.csv.header.c.ferguson = C (FERGUSON)
-export.sqrelation.csv.header.variance = Standard variance
+export.sqrelation.csv.header.c.duan = C (Duan)
+export.sqrelation.csv.header.c.ferguson = C (Ferguson)
+export.sqrelation.csv.header.sd = Standard error
+export.sqrelation.csv.header.qmax = Q max,measured
 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