# HG changeset patch # User Raimund Renkert # Date 1329470402 0 # Node ID ba46af45b6e49a6b86c6c0dbb52770f143d4efe5 # Parent ee5eca3871cb33b3232d495c4cfa0018fbf66986 Write the gauge description instead of the Q value to CSV file. flys-artifacts/trunk@4070 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r ee5eca3871cb -r ba46af45b6e4 flys-artifacts/ChangeLog --- a/flys-artifacts/ChangeLog Fri Feb 17 07:49:41 2012 +0000 +++ b/flys-artifacts/ChangeLog Fri Feb 17 09:20:02 2012 +0000 @@ -1,3 +1,20 @@ +2012-02-17 Raimund Renkert + + * src/main/java/de/intevation/flys/exports/WaterlevelExporter.java: + Write the description instead of the Q value to CSV file. + + * src/main/java/de/intevation/flys/exports/DischargeLongitudinalSectionExporter.java: + Added parameter to overriden method. + + * src/main/java/de/intevation/flys/utils/FLYSUtils.java: + Get Qs without range. + + * src/main/resources/messages.properties, + src/main/resources/messages_de_DE.properties, + src/main/resources/messages_en.properties, + src/main/resources/messages_de.properties: + Adjusted i18n string for CSV metadata. + 2012-02-17 Ingo Weinzierl Part II/III flys/issue497 (Diagrammeigenschaften in Zeitseriendiagrammen) diff -r ee5eca3871cb -r ba46af45b6e4 flys-artifacts/src/main/java/de/intevation/flys/exports/DischargeLongitudinalSectionExporter.java --- a/flys-artifacts/src/main/java/de/intevation/flys/exports/DischargeLongitudinalSectionExporter.java Fri Feb 17 07:49:41 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/DischargeLongitudinalSectionExporter.java Fri Feb 17 09:20:02 2012 +0000 @@ -71,7 +71,8 @@ CSVWriter writer, WQKms wqkms, boolean atGauge, - boolean isQ + boolean isQ, + boolean isRange ) { logger.debug("WaterlevelExporter.wQKms2CSV"); diff -r ee5eca3871cb -r ba46af45b6e4 flys-artifacts/src/main/java/de/intevation/flys/exports/WaterlevelExporter.java --- a/flys-artifacts/src/main/java/de/intevation/flys/exports/WaterlevelExporter.java Fri Feb 17 07:49:41 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/WaterlevelExporter.java Fri Feb 17 09:20:02 2012 +0000 @@ -261,16 +261,19 @@ protected void writeCSVData(CSVWriter writer) { logger.info("WaterlevelExporter.writeData"); - WQ_MODE mode = FLYSUtils.getWQMode((FLYSArtifact)master); - boolean atGauge = mode == WQ_MODE.QGAUGE || mode == WQ_MODE.WGAUGE; - boolean isQ = mode == WQ_MODE.QGAUGE || mode == WQ_MODE.QFREE; + WQ_MODE mode = FLYSUtils.getWQMode((FLYSArtifact)master); + boolean atGauge = mode == WQ_MODE.QGAUGE || mode == WQ_MODE.WGAUGE; + boolean isQ = mode == WQ_MODE.QGAUGE || mode == WQ_MODE.QFREE; + FLYSUtils.WQ_INPUT input + = FLYSUtils.getWQInputMode((FLYSArtifact)master); + boolean isRange = input == FLYSUtils.WQ_INPUT.RANGE; writeCSVMeta(writer); writeCSVHeader(writer, atGauge, isQ); for (WQKms[] tmp: data) { for (WQKms wqkms: tmp) { - wQKms2CSV(writer, wqkms, atGauge, isQ); + wQKms2CSV(writer, wqkms, atGauge, isQ, isRange); } } } @@ -338,13 +341,22 @@ FLYSUtils.WQ_MODE wq = FLYSUtils.getWQMode(flys); if (wq == FLYSUtils.WQ_MODE.QFREE || wq == FLYSUtils.WQ_MODE.QGAUGE) { double[] qs = FLYSUtils.getQs(flys); + FLYSUtils.WQ_INPUT input = FLYSUtils.getWQInputMode(flys); - String lower = ""; - String upper = ""; + String data = ""; - if (qs != null && qs.length > 0) { - lower = String.valueOf(qs[0]); - upper = String.valueOf(qs[qs.length-1]); + if ((input == FLYSUtils.WQ_INPUT.ADAPTED || + input == FLYSUtils.WQ_INPUT.RANGE) && + qs != null && qs.length > 0) + { + data = String.valueOf(qs[0]); + data += " - " + String.valueOf(qs[qs.length-1]); + } + else if (input == FLYSUtils.WQ_INPUT.SINGLE && qs != null){ + data = String.valueOf(qs[0]); + for (int i = 1; i < qs.length; i++) { + data += ", " + String.valueOf(qs[i]); + } } else { logger.warn("Could not determine Q range!"); @@ -355,7 +367,7 @@ meta, CSV_META_Q, CSV_META_Q, - new Object[] { lower, upper }) + new Object[] {data}) }); } else { @@ -419,7 +431,8 @@ CSVWriter writer, WQKms wqkms, boolean atGauge, - boolean isQ + boolean isQ, + boolean isRange ) { logger.debug("WaterlevelExporter.wQKms2CSV"); @@ -456,11 +469,15 @@ result = wqkms.get(i, result); if (atGauge) { + String tmp = desc; + if (!isRange) { + tmp = FLYSUtils.getNamedMainValue((WINFOArtifact)flys, wqkms.getRawValue()); + } writer.writeNext(new String[] { kmf.format(result[2]), wf.format(result[0]), qf.format(result[1]), - desc, + tmp, FLYSUtils.getLocationDescription(flys, result[2]), result[2] >= a && result[2] <= b ? gaugeName diff -r ee5eca3871cb -r ba46af45b6e4 flys-artifacts/src/main/java/de/intevation/flys/utils/FLYSUtils.java --- a/flys-artifacts/src/main/java/de/intevation/flys/utils/FLYSUtils.java Fri Feb 17 07:49:41 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/utils/FLYSUtils.java Fri Feb 17 09:20:02 2012 +0000 @@ -345,11 +345,9 @@ * @return the Qs. */ public static double[] getQs(FLYSArtifact flys) { - double[] kmRange = getKmRange(flys); - // XXX this is not nice! if (flys instanceof WINFOArtifact) { - return ((WINFOArtifact) flys).getQs(kmRange); + return ((WINFOArtifact) flys).getQs(); } logger.warn("This method currently supports WINFOArtifact only!"); diff -r ee5eca3871cb -r ba46af45b6e4 flys-artifacts/src/main/resources/messages.properties --- a/flys-artifacts/src/main/resources/messages.properties Fri Feb 17 07:49:41 2012 +0000 +++ b/flys-artifacts/src/main/resources/messages.properties Fri Feb 17 09:20:02 2012 +0000 @@ -119,7 +119,7 @@ export.waterlevel.csv.meta.river = # River: {0} export.waterlevel.csv.meta.range = # Location/Range (km): {0} - {1} export.waterlevel.csv.meta.gauge = # Gauge: {0} -export.waterlevel.csv.meta.q = # Q (m\u00b3/s): {0} - {1} +export.waterlevel.csv.meta.q = # Q (m\u00b3/s): {0} export.waterlevel.csv.meta.w = # W (NN + m): {0} - {1} export.waterlevel.csv.not.in.gauge.range = Outside selected gauge export.computed.discharge.curve.csv.header.w = W [NN + m] diff -r ee5eca3871cb -r ba46af45b6e4 flys-artifacts/src/main/resources/messages_de.properties --- a/flys-artifacts/src/main/resources/messages_de.properties Fri Feb 17 07:49:41 2012 +0000 +++ b/flys-artifacts/src/main/resources/messages_de.properties Fri Feb 17 09:20:02 2012 +0000 @@ -119,7 +119,7 @@ export.waterlevel.csv.meta.river = # Gew\u00e4sser: {0} export.waterlevel.csv.meta.range = # Ort/Bereich (km): {0} - {1} export.waterlevel.csv.meta.gauge = # Bezugspegel: {0} -export.waterlevel.csv.meta.q = # Q (m\u00b3/s): {0} - {1} +export.waterlevel.csv.meta.q = # Q (m\u00b3/s): {0} export.waterlevel.csv.meta.w = # W (NN + m): {0} - {1} export.waterlevel.csv.not.in.gauge.range = au\u00dferhalb gew\u00e4hlter Bezugspegels export.computed.discharge.curve.csv.header.w = W [NN + m] diff -r ee5eca3871cb -r ba46af45b6e4 flys-artifacts/src/main/resources/messages_de_DE.properties --- a/flys-artifacts/src/main/resources/messages_de_DE.properties Fri Feb 17 07:49:41 2012 +0000 +++ b/flys-artifacts/src/main/resources/messages_de_DE.properties Fri Feb 17 09:20:02 2012 +0000 @@ -119,7 +119,7 @@ export.waterlevel.csv.meta.river = # Gew\u00e4sser: {0} export.waterlevel.csv.meta.range = # Ort/Bereich (km): {0} - {1} export.waterlevel.csv.meta.gauge = # Bezugspegel: {0} -export.waterlevel.csv.meta.q = # Q (m\u00b3/s): {0} - {1} +export.waterlevel.csv.meta.q = # Q (m\u00b3/s): {0} export.waterlevel.csv.meta.w = # W (NN + m): {0} - {1} export.waterlevel.csv.not.in.gauge.range = au\u00dferhalb gew\u00e4hlter Bezugspegels export.computed.discharge.curve.csv.header.w = W [NN + m] diff -r ee5eca3871cb -r ba46af45b6e4 flys-artifacts/src/main/resources/messages_en.properties --- a/flys-artifacts/src/main/resources/messages_en.properties Fri Feb 17 07:49:41 2012 +0000 +++ b/flys-artifacts/src/main/resources/messages_en.properties Fri Feb 17 09:20:02 2012 +0000 @@ -115,7 +115,7 @@ export.waterlevel.csv.meta.river = # River: {0} export.waterlevel.csv.meta.range = # Location/Range (km): {0} - {1} export.waterlevel.csv.meta.gauge = # Gauge: {0} -export.waterlevel.csv.meta.q = # Q (m\u00b3/s): {0} - {1} +export.waterlevel.csv.meta.q = # Q (m\u00b3/s): {0} export.waterlevel.csv.meta.w = # W (NN + m): {0} - {1} export.waterlevel.csv.not.in.gauge.range = Outside selected gauge export.computed.discharge.curve.csv.header.w = W [NN + m]