[PATCH] issue1592: Fix csv headers for w or q calculations

Wald Commits scm-commit at wald.intevation.org
Wed Nov 13 11:32:37 CET 2013


# HG changeset patch
# User Felix Wolfsteller <felix.wolfsteller at intevation.de>
# Date 1384338767 -3600
# Node ID 32563516c485369ebd0bc1d5c0698f9a29f873f7
# Parent  84107f13167cde8864ddbc5981872291cbed6f59
issue1592: Fix csv headers for w or q calculations.

diff -r 84107f13167c -r 32563516c485 artifacts/src/main/java/org/dive4elements/river/exports/HistoricalDischargeCurveExporter.java
--- a/artifacts/src/main/java/org/dive4elements/river/exports/HistoricalDischargeCurveExporter.java	Wed Nov 13 08:10:00 2013 +0100
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/HistoricalDischargeCurveExporter.java	Wed Nov 13 11:32:47 2013 +0100
@@ -32,6 +32,7 @@
 import org.dive4elements.artifacts.CallMeta;
 
 import org.dive4elements.river.artifacts.D4EArtifact;
+import org.dive4elements.river.artifacts.access.HistoricalDischargeAccess;
 import org.dive4elements.river.artifacts.model.CalculationResult;
 import org.dive4elements.river.artifacts.model.HistoricalDischargeData;
 import org.dive4elements.river.artifacts.model.Timerange;
@@ -60,8 +61,11 @@
     public static final String CSV_DISCHARGE_HEADER =
         "export.historical.discharge.csv.header.discharge";
 
-    public static final String CSV_DIFF_HEADER =
-        "export.historical.discharge.csv.header.diff";
+    public static final String CSV_DIFF_HEADER_W =
+        "export.historical.discharge.csv.header.diff.w";
+
+    public static final String CSV_DIFF_HEADER_Q =
+        "export.historical.discharge.csv.header.diff.q";
 
     public static final String CSV_GAUGENAME_HEADER =
         "export.historical.discharge.csv.header.gaugename";
@@ -141,11 +145,14 @@
 
 
     protected void writeCSVHeader(CSVWriter writer) {
+        HistoricalDischargeAccess hda = new HistoricalDischargeAccess((D4EArtifact) master);
         writer.writeNext(new String[] {
             msg(CSV_TIMERANGE_HEADER, CSV_TIMERANGE_HEADER),
             msg(CSV_WATERLEVEL_HEADER, CSV_WATERLEVEL_HEADER),
             msg(CSV_DISCHARGE_HEADER, CSV_DISCHARGE_HEADER),
-            msg(CSV_DIFF_HEADER, CSV_DIFF_HEADER),
+            (hda.getEvaluationMode() == HistoricalDischargeAccess.EvaluationMode.W)
+                ? msg(CSV_DIFF_HEADER_W, CSV_DIFF_HEADER_W)
+                : msg(CSV_DIFF_HEADER_Q, CSV_DIFF_HEADER_Q),
             msg(CSV_GAUGENAME_HEADER, CSV_GAUGENAME_HEADER)
         });
     }
diff -r 84107f13167c -r 32563516c485 artifacts/src/main/resources/messages.properties
--- a/artifacts/src/main/resources/messages.properties	Wed Nov 13 08:10:00 2013 +0100
+++ b/artifacts/src/main/resources/messages.properties	Wed Nov 13 11:32:47 2013 +0100
@@ -368,7 +368,8 @@
 export.historical.discharge.csv.header.timerange = Timerange
 export.historical.discharge.csv.header.waterlevel = Waterlevel [cm]
 export.historical.discharge.csv.header.discharge = Discharge [m\u00b3/s]
-export.historical.discharge.csv.header.diff = \u0394Q to reference[m\u00b3/s]
+export.historical.discharge.csv.header.diff.q = \u0394Q to reference[m\u00b3/s]
+export.historical.discharge.csv.header.diff.w = \u0394W to reference[m\u00b3/s]
 export.historical.discharge.csv.header.gaugename = Gauge
 export.reference_curve.csv.header.km = km
 export.reference_curve.csv.header.w.cm = W (cm at Gauge)
diff -r 84107f13167c -r 32563516c485 artifacts/src/main/resources/messages_de.properties
--- a/artifacts/src/main/resources/messages_de.properties	Wed Nov 13 08:10:00 2013 +0100
+++ b/artifacts/src/main/resources/messages_de.properties	Wed Nov 13 11:32:47 2013 +0100
@@ -367,7 +367,8 @@
 export.historical.discharge.csv.header.timerange = Zeitraum
 export.historical.discharge.csv.header.waterlevel = Wasserstand [cm]
 export.historical.discharge.csv.header.discharge = Abfluss [m\u00b3/s]
-export.historical.discharge.csv.header.diff = \u0394Q zur Bezugskurve[m\u00b3/s]
+export.historical.discharge.csv.header.diff.q = \u0394Q zur Bezugskurve[m\u00b3/s]
+export.historical.discharge.csv.header.diff.w = \u0394W zur Bezugskurve[m\u00b3/s]
 export.historical.discharge.csv.header.gaugename = Pegel
 export.reference_curve.csv.header.km = km
 export.reference_curve.csv.header.w.cm = W (cm am Pegel)
diff -r 84107f13167c -r 32563516c485 artifacts/src/main/resources/messages_de_DE.properties
--- a/artifacts/src/main/resources/messages_de_DE.properties	Wed Nov 13 08:10:00 2013 +0100
+++ b/artifacts/src/main/resources/messages_de_DE.properties	Wed Nov 13 11:32:47 2013 +0100
@@ -365,7 +365,8 @@
 export.historical.discharge.csv.header.timerange = Zeitraum
 export.historical.discharge.csv.header.waterlevel = Wasserstand [cm]
 export.historical.discharge.csv.header.discharge = Abfluss [m\u00b3/s]
-export.historical.discharge.csv.header.diff = \u0394Q zur Bezugskurve[m\u00b3/s]
+export.historical.discharge.csv.header.diff.q = \u0394Q zur Bezugskurve[m\u00b3/s]
+export.historical.discharge.csv.header.diff.w = \u0394W zur Bezugskurve[m\u00b3/s]
 export.historical.discharge.csv.header.gaugename = Pegel
 export.reference_curve.csv.header.km = km
 export.reference_curve.csv.header.w.cm = W (cm am Pegel)
diff -r 84107f13167c -r 32563516c485 artifacts/src/main/resources/messages_en.properties
--- a/artifacts/src/main/resources/messages_en.properties	Wed Nov 13 08:10:00 2013 +0100
+++ b/artifacts/src/main/resources/messages_en.properties	Wed Nov 13 11:32:47 2013 +0100
@@ -371,7 +371,8 @@
 export.historical.discharge.csv.header.timerange = Timerange
 export.historical.discharge.csv.header.waterlevel = Waterlevel [cm]
 export.historical.discharge.csv.header.discharge = Discharge [m\u00b3/s]
-export.historical.discharge.csv.header.diff = \u0394Q to reference[m\u00b3/s]
+export.historical.discharge.csv.header.diff.q = \u0394Q to reference[m\u00b3/s]
+export.historical.discharge.csv.header.diff.w = \u0394W to reference[m\u00b3/s]
 export.historical.discharge.csv.header.gaugename = Gauge
 export.reference_curve.csv.header.km = km
 export.reference_curve.csv.header.w.cm = W (cm at Gauge)


More information about the Dive4elements-commits mailing list