[PATCH 1 of 3] S-Info flood duration: fixed error report output name, changed duration from int to double, added formatter
Wald Commits
scm-commit at wald.intevation.org
Wed Aug 1 13:21:50 CEST 2018
# HG changeset patch
# User mschaefer
# Date 1533122325 -7200
# Node ID 5ce50640688c4c16eccd7c3c73003e206dfa7360
# Parent 202fd59b4f21431a1c2972704d8df8c6c1cb9e61
S-Info flood duration: fixed error report output name, changed duration from int to double, added formatter
diff -r 202fd59b4f21 -r 5ce50640688c artifacts/doc/conf/artifacts/sinfo.xml
--- a/artifacts/doc/conf/artifacts/sinfo.xml Tue Jul 31 18:17:10 2018 +0200
+++ b/artifacts/doc/conf/artifacts/sinfo.xml Wed Aug 01 13:18:45 2018 +0200
@@ -395,9 +395,9 @@
</facets>
</outputmode>
- <outputmode name="sinfo_flood_duration_report" description="output.sinfo_flood_duration_report" mime-type="text/xml" type="report">
+ <outputmode name="sinfo_floodduration_report" description="output.sinfo_floodduration_report" mime-type="text/xml" type="report">
<facets>
- <facet name="report" description="facet.sinfo_flood_duration_report" />
+ <facet name="report" description="facet.sinfo_floodduration_report" />
</facets>
</outputmode>
</outputmodes>
diff -r 202fd59b4f21 -r 5ce50640688c artifacts/src/main/java/org/dive4elements/river/artifacts/common/AbstractExportContext.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/common/AbstractExportContext.java Tue Jul 31 18:17:10 2018 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/common/AbstractExportContext.java Wed Aug 01 13:18:45 2018 +0200
@@ -23,6 +23,7 @@
private NumberFormat qFormat = null;
private NumberFormat flowDepthFormat = null;
+ private NumberFormat floodDurationFormat = null;
private NumberFormat salixScenFormat = null;
private NumberFormat kmFormat = null;
@@ -70,6 +71,13 @@
return this.flowDepthFormat;
}
+ public final NumberFormat getFloodDurationFormatter() {
+
+ if (this.floodDurationFormat == null)
+ this.floodDurationFormat = Formatter.getIntegerFormatter(this.context);
+ return this.floodDurationFormat;
+ }
+
public final NumberFormat getSalixScenFormatter() {
if (this.salixScenFormat == null)
this.salixScenFormat = Formatter.getSalixLine(this.context);
diff -r 202fd59b4f21 -r 5ce50640688c artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flood_duration/DurationWaterlevel.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flood_duration/DurationWaterlevel.java Tue Jul 31 18:17:10 2018 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flood_duration/DurationWaterlevel.java Wed Aug 01 13:18:45 2018 +0200
@@ -23,9 +23,9 @@
private final double w;
private final double q;
private final String bezeichnung;
- private final int floodDurDaysPerYear;
+ private final double floodDurDaysPerYear;
- public DurationWaterlevel(final double w, final int floodDurDaysPerYear, final double q, final String bezeichnung) {
+ public DurationWaterlevel(final double w, final double floodDurDaysPerYear, final double q, final String bezeichnung) {
this.w = w;
this.q = q;
this.bezeichnung = bezeichnung;
@@ -40,12 +40,12 @@
return this.q;
}
- public int getFloodDurDaysPerYear() {
+ public double getFloodDurDaysPerYear() {
return this.floodDurDaysPerYear;
}
- public String getFloodDurDaysPerYearFormatted() {
- return String.valueOf(this.floodDurDaysPerYear);
+ public String getFloodDurDaysPerYearFormatted(final NumberFormat durFormatter) {
+ return durFormatter.format(this.floodDurDaysPerYear);
}
public String getBezeichnung() {
diff -r 202fd59b4f21 -r 5ce50640688c artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flood_duration/FloodDurationCalculationResult.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flood_duration/FloodDurationCalculationResult.java Tue Jul 31 18:17:10 2018 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flood_duration/FloodDurationCalculationResult.java Wed Aug 01 13:18:45 2018 +0200
@@ -125,6 +125,7 @@
if (waterlevelList != null) {
final NumberFormat wFormatter = exportContextCSV.getFlowDepthFormatter();
final NumberFormat qFormatter = exportContextCSV.getQFormatter();
+ final NumberFormat durFormatter = exportContextCSV.getFloodDurationFormatter();
for (int i = 0; i < waterlevelList.size(); i++) {
@@ -133,7 +134,7 @@
final DurationWaterlevel item = waterlevelList.get(i);
lines.add(item.getWFormatted(wFormatter));
- lines.add(item.getFloodDurDaysPerYearFormatted());
+ lines.add(item.getFloodDurDaysPerYearFormatted(durFormatter));
lines.add(item.getQFormatted(qFormatter));
lines.add(item.getBezeichnung());
}
diff -r 202fd59b4f21 -r 5ce50640688c artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flood_duration/FloodDurationCalculator.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flood_duration/FloodDurationCalculator.java Tue Jul 31 18:17:10 2018 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flood_duration/FloodDurationCalculator.java Wed Aug 01 13:18:45 2018 +0200
@@ -177,7 +177,7 @@
final String label = wqd.getBezeichnung().startsWith("W=") ? "Q(" + wqd.getBezeichnung() + ")" : wqd.getBezeichnung();
final StickyAxisAnnotation annotation = new StickyAxisAnnotation(label, (float) wqd.getDischarge(), SimpleAxis.Y_AXIS,
FloodDurationCurveGenerator.YAXIS.Q.idx);
- annotation.setHitPoint(wqd.getFloodDurDaysPerYear());
+ annotation.setHitPoint((float) wqd.getFloodDurDaysPerYear());
annotations.add(annotation);
}
return annotations;
@@ -207,7 +207,7 @@
final String label = !wqd.getBezeichnung().startsWith("W=") ? "W(" + wqd.getBezeichnung() + ")" : wqd.getBezeichnung();
final StickyAxisAnnotation annotation = new StickyAxisAnnotation(label, (float) wqd.getWaterlevel(), SimpleAxis.Y_AXIS,
FloodDurationCurveGenerator.YAXIS.W.idx);
- annotation.setHitPoint(wqd.getFloodDurDaysPerYear());
+ annotation.setHitPoint((float) wqd.getFloodDurDaysPerYear());
annotations.add(annotation);
}
return annotations;
@@ -424,11 +424,7 @@
final List<DurationWaterlevel> wsts = new ArrayList<>(wqkmsArray.length);
for (int i = 0; i <= wqkmsArray.length - 1; i++) {
- assert (wqkmsArray[i].getKm(kmIndex) == station.doubleValue());
-
- final int overflowDays = (int) Math.round(gaugeDurations.get(i));
-
- final DurationWaterlevel dw = new DurationWaterlevel(wqkmsArray[i].getW(kmIndex), overflowDays, wqkmsArray[i].getQ(kmIndex),
+ final DurationWaterlevel dw = new DurationWaterlevel(wqkmsArray[i].getW(kmIndex), gaugeDurations.get(i), wqkmsArray[i].getQ(kmIndex),
wqkmsArray[i].getName());
wsts.add(dw);
}
diff -r 202fd59b4f21 -r 5ce50640688c gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants.java
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants.java Tue Jul 31 18:17:10 2018 +0200
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants.java Wed Aug 01 13:18:45 2018 +0200
@@ -1543,6 +1543,8 @@
String sinfo_collision_export();
+ String sinfo_collision_report();
+
String sinfo_flood_height();
String sinfo_columnlabel_soundings();
diff -r 202fd59b4f21 -r 5ce50640688c gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants.properties
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants.properties Tue Jul 31 18:17:10 2018 +0200
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants.properties Wed Aug 01 13:18:45 2018 +0200
@@ -817,6 +817,7 @@
sinfo_predefined_collision = Grundber\u00fchrungen
sinfo_collision = Grundber\u00fchrungen
+sinfo_collision_report = Grundber\u00fchrungen Bericht
sinfo_flood_duration = \u00dcberflutungsdauer Infrastrukturen BWaStr
sinfo_flood_height = H\u00f6he Infrastrukturen BWaStr
diff -r 202fd59b4f21 -r 5ce50640688c gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants_de.properties
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants_de.properties Tue Jul 31 18:17:10 2018 +0200
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants_de.properties Wed Aug 01 13:18:45 2018 +0200
@@ -817,6 +817,7 @@
sinfo_predefined_collision = Grundber\u00fchrungen
sinfo_collision = Grundber\u00fchrungen
+sinfo_collision_report = Grundber\u00fchrungen Bericht
sinfo_flood_duration = \u00dcberflutungsdauer Infrastrukturen BWaStr
sinfo_flood_height = H\u00f6he Infrastrukturen BWaStr
More information about the Dive4Elements-commits
mailing list