Mercurial > dive4elements > river
diff artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepthdev/FlowDepthDevelopmentCalculation.java @ 8978:b5600453bb8f
SINFO Calculations: do not produce result rows if some input data has missing values.
Also check for years of waterlevels in flow depth development calculation.
author | gernotbelger |
---|---|
date | Thu, 05 Apr 2018 11:57:54 +0200 |
parents | 45f1ad66560e |
children | b194fa64506a |
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepthdev/FlowDepthDevelopmentCalculation.java Tue Apr 03 17:23:51 2018 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepthdev/FlowDepthDevelopmentCalculation.java Thu Apr 05 11:57:54 2018 +0200 @@ -97,18 +97,26 @@ return null; // FIXME: check current/hist wst have same discharge... + // FIXME: what means 'same discharge' final BedHeightInfo currentSoundingInfo = currentSounding.getInfo(); final BedHeightInfo historicalSoundingInfo = historicalSounding.getInfo(); - // final String label = createLabel(waterlevel, minBedHeight, maxBedHeight); - - // final WKms wstKms = waterlevel.getWkms(); final int currentWstYear = currentWaterlevel.getYear(); final int historicalWstYear = historicalWaterlevel.getYear(); final int currentSoundingYear = currentSoundingInfo.getYear(); final int historicalSoundingYear = historicalSoundingInfo.getYear(); + if (currentWstYear < 0) { + problems.addProblem("flowdepthdevelopmentcalculation.missingCurrentYear", currentWaterlevel.getName()); + return null; + } + + if (historicalWstYear < 0) { + problems.addProblem("flowdepthdevelopmentcalculation.missingHistoricalYear", historicalWaterlevel.getName()); + return null; + } + // FIXME: distinguish error messages FlowDepthUtils.checkYearDifference("", currentWstYear, currentSoundingYear, problems); FlowDepthUtils.checkYearDifference("", historicalWstYear, historicalSoundingYear, problems); @@ -144,6 +152,10 @@ final double historicalWst = historicalWstProvider.getWaterlevel(station); final double historicalBedHeight = historicalSounding.getMeanBedHeight(station); + /* ignore invalid lines */ + if (Double.isNaN(currentWst) || Double.isNaN(currentBedHeight) || Double.isNaN(historicalWst) || Double.isNaN(historicalBedHeight)) + continue; + final double diffWst = (currentWst - historicalWst) * 100; final double diffBedHeight = (currentBedHeight - historicalBedHeight) * 100;