[PATCH] bezugswst sounding select for miss'vol only (calc crashes)
Wald Commits
scm-commit at wald.intevation.org
Thu Aug 30 10:54:45 CEST 2018
# HG changeset patch
# User gernotbelger
# Date 1535619280 -7200
# Node ID be9bd06a1e3f8952e3e404a271ed05a74b0d3bbc
# Parent c77255da734bf1756584e073e2c97a955dcaaf78
bezugswst sounding select for miss'vol only (calc crashes)
diff -r c77255da734b -r be9bd06a1e3f artifacts/doc/conf/artifacts/bundu.xml
--- a/artifacts/doc/conf/artifacts/bundu.xml Thu Aug 30 10:53:40 2018 +0200
+++ b/artifacts/doc/conf/artifacts/bundu.xml Thu Aug 30 10:54:40 2018 +0200
@@ -475,7 +475,7 @@
<transition transition="org.dive4elements.river.artifacts.transitions.ValueCompareTransition">
<from state="state.bundu.wst.load.missing_volume"/>
- <to state="state.bundu.wst.soundings"/>
+ <to state="state.bundu.wst"/>
<condition data="missing_volume" value="false" operator="equal"/>
</transition>
diff -r c77255da734b -r be9bd06a1e3f artifacts/src/main/java/org/dive4elements/river/artifacts/bundu/bezugswst/BezugswstCalculation.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/bundu/bezugswst/BezugswstCalculation.java Thu Aug 30 10:53:40 2018 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/bundu/bezugswst/BezugswstCalculation.java Thu Aug 30 10:54:40 2018 +0200
@@ -68,7 +68,6 @@
this.rows = new ArrayList<>();
}
-
/**
* Calculates the result rows of a bundu bzws workflow
*/
@@ -92,7 +91,7 @@
final Calculation problems = new Calculation();
// Calculate the wspl for the selected river range as in fixa awspl
- bunduartifact.addStringData("wq_isq", "true"); // macht doch Sinn hier, sorry!
+ bunduartifact.addStringData("wq_isq", "true");
final WinfoArtifactWrapper winfo = new WinfoArtifactWrapper(bunduartifact);
final RiverInfoProvider riverInfoProvider = RiverInfoProvider.forRange(this.context, river, access.getRange(), true);
final FixRealizingResult fixResult = calculateWspl(bunduartifact, problems);
@@ -103,10 +102,8 @@
final WstInfo wstInfo = new WstInfo(wqkms.getName(), 0, riverInfoProvider.getReferenceGauge(), true);
// Fetch the bed heights of the selected sounding
- final int bedHeightId = access.getBedHeightID();
- final BedHeightsFinder bedHeightsFinder = BedHeightsFinder.forId(problems, bedHeightId, access.getRange());
- if (bedHeightsFinder == null)
- return new CalculationResult(results, problems);
+ final Integer bedHeightId = access.getBedHeightID(); // TODO: REMOVE BEDHEIGHTFINDER FROM CALCULATION - HOW?
+ final BedHeightsFinder bedHeightsFinder = bedHeightId == null ? null : BedHeightsFinder.forId(problems, bedHeightId, access.getRange());
// Fetch the river channel data
final ChannelFinder channelFinder = ChannelFinder.loadValues(problems, river, access.getBezugsJahr());
@@ -115,11 +112,14 @@
// Compute the result rows
for (int i = 0; i <= wqkms.size() - 1; i++) {
+ // TODO: REMOVE BEDHEIGHTFINDER FROM CALCULATION - HOW?
this.rows.add(createRow(wqkms.getKm(i), wqkms.getW(i), wqkms.getQ(i), bedHeightsFinder, channelFinder, riverInfoProvider, wstInfo));
}
// Compute the missing volumes
if (access.isCalculateMissingValue()) {
+ if (bedHeightsFinder == null)
+ return new CalculationResult(results, problems);
computeMissingVolumes(problems);
final BedQualityCalculator bqCalculator = computeDensities(problems, bunduartifact, access, river);
computeMissingMasses(problems, bqCalculator);
@@ -191,12 +191,15 @@
row.putValue(BunduResultType.sounding, bedHeightsFinder.getInfo().getDescription());
// Set bed and channel bottom height
+
+ // TODO: REMOVE BEDHEIGHTFINDER FROM CALCULATION - HOW?
final double msh = bedHeightsFinder.getMeanBedHeight(station);
row.putValue(SInfoResultType.meanBedHeight, msh);
if (!Double.isNaN(w) && !Double.isNaN(msh))
row.putValue(SInfoResultType.flowdepth, Formatter.roundFlowDepth(w).subtract(Formatter.roundFlowDepth(msh)).doubleValue());
else
row.putValue(SInfoResultType.flowdepth, Double.NaN);
+
final double channelDepth = channelFinder.getDepth(station);
row.putValue(BunduResultType.channelDepth, channelDepth);
double channelHeight;
@@ -239,8 +242,7 @@
row.putValue(BunduResultType.missDepthFields, fieldMissDepths);
row.putValue(BunduResultType.missWidthFields, fieldMissWidths);
row.putValue(BunduResultType.hasMissingDepth, (missFieldCnt >= 1));
- }
- else {
+ } else {
row.putValue(BunduResultType.missDepthFields, fieldNulls);
row.putValue(BunduResultType.missWidthFields, fieldNulls);
row.putValue(BunduResultType.hasMissingDepth, null);
diff -r c77255da734b -r be9bd06a1e3f artifacts/src/main/java/org/dive4elements/river/artifacts/bundu/bezugswst/BunduAccess.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/bundu/bezugswst/BunduAccess.java Thu Aug 30 10:53:40 2018 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/bundu/bezugswst/BunduAccess.java Thu Aug 30 10:54:40 2018 +0200
@@ -89,15 +89,14 @@
return getBoolean("missing_volume");
}
- public int getBedHeightID() {
+ public Integer getBedHeightID() {
final String data = getString("soundings");
- if (data == null) {
+ if (data == null || !isCalculateMissingValue()) {
log.warn("No 'soundings' parameter specified!");
- return 0;
- }
- else {
+ return null;
+ } else {
log.debug("getBedHeightIDs(): data=" + data);
}
More information about the Dive4Elements-commits
mailing list