# HG changeset patch
# User gernotbelger
# Date 1528287438 -7200
# Node ID 0a19a79663ddbe8bac2665b1b081b5d45f366b81
# Parent f61bc0c63188ba5ce2ce5467d56f7810b1efbeac
TKH calculation now takes the stations of the bed heights for the waterlevel calculation instead of letting the user define a km-step
diff -r f61bc0c63188 -r 0a19a79663dd artifacts/doc/conf/artifacts/sinfo.xml
--- a/artifacts/doc/conf/artifacts/sinfo.xml Wed Jun 06 14:16:28 2018 +0200
+++ b/artifacts/doc/conf/artifacts/sinfo.xml Wed Jun 06 14:17:18 2018 +0200
@@ -309,13 +309,19 @@
-
+
+
+
+
+
+
+
@@ -401,21 +407,12 @@
-
+
-
-
-
-
-
-
-
-
-
-
+
diff -r f61bc0c63188 -r 0a19a79663dd artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/tkhstate/TkhCalculation.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/tkhstate/TkhCalculation.java Wed Jun 06 14:16:28 2018 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/tkhstate/TkhCalculation.java Wed Jun 06 14:17:18 2018 +0200
@@ -63,11 +63,20 @@
final RiverInfo riverInfo = new RiverInfo(river);
final DoubleRange calcRange = access.getRange();
+ final String calcModeLabel = Resources.getMsg(this.context.getMeta(), sinfo.getCalculationMode().name());
+ final String user = CalculationUtils.findArtifactUser(this.context, sinfo);
+
final Calculation problems = new Calculation();
/* find relevant bed-heights */
final List defaultBedHeights = new DefaultBedHeights(river).getBedHeights(problems);
final Collection bedHeights = BedHeightsFinder.createTkhBedHeights(problems, calcRange, defaultBedHeights);
+
+ if (defaultBedHeights.isEmpty()) {
+ final TkhCalculationResults results = new TkhCalculationResults(calcModeLabel, user, riverInfo, calcRange, "");
+ return new CalculationResult(results, problems);
+ }
+
final double[] stations = extractStations(bedHeights);
/* misuse winfo-artifact to calculate waterlevels in the same way */
@@ -78,10 +87,6 @@
final RiverInfoProvider infoProvider = RiverInfoProvider.forRange(this.context, river, calcRange);
- final String user = CalculationUtils.findArtifactUser(this.context, sinfo);
-
- final String calcModeLabel = Resources.getMsg(this.context.getMeta(), sinfo.getCalculationMode().name());
-
final WaterlevelDescriptionBuilder descBuilder = new WaterlevelDescriptionBuilder(winfo, this.context);
final String descriptionHeader = descBuilder.getColumnHeader();
@@ -126,10 +131,7 @@
private WQKms[] calculateWaterlevels(final WINFOArtifact winfo, final double[] stations, final Calculation problems) {
- // FIXME: we take kms from step, but instead we would like to take kms from bedheights
- // FIXME: this will definitely break the serialization of the winfo artifact
-
- final CalculationResult waterlevelData = winfo.getWaterlevelData(this.context);
+ final CalculationResult waterlevelData = winfo.computeWaterlevelData(stations);
/* copy all problems */
final Calculation winfoProblems = waterlevelData.getReport();