Mercurial > dive4elements > river
diff artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flood_duration/FloodDurationCalculator.java @ 9534:b380a5693514
Calculation of Dauerlinie corrected in WInfo (fix wst position according to a reference gauge, km specific discharge instead of that of the gauge);
using same calculation in SInfo flood duration
author | mschaefer |
---|---|
date | Thu, 11 Oct 2018 18:39:21 +0200 |
parents | 55c187a0a31e |
children | 225e48df608c |
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flood_duration/FloodDurationCalculator.java Thu Oct 04 12:48:57 2018 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flood_duration/FloodDurationCalculator.java Thu Oct 11 18:39:21 2018 +0200 @@ -137,26 +137,15 @@ */ public WQDay calcWQDays(final Calculation problems, final double station, final WINFOArtifact winfo) { - final WstValueTable wst = WstValueTableFactory.getTable(this.riverInfoProvider.getRiver()); - final Gauge gauge = this.riverInfoProvider.getGauge(station, true); - final Object[] obj = gauge.fetchDurationCurveData(); - final int[] udays = (int[]) obj[0]; - final double[] qs = (double[]) obj[1]; - final int[] odays = new int[udays.length]; - final double[] oqs = new double[udays.length]; - final double[] ows = new double[udays.length]; - for (int i = 0, j = udays.length - 1; i <= udays.length - 1; i++, j--) { - odays[j] = 365 - udays[i]; - final QPosition qpos = wst.getQPosition(gauge.getStation().doubleValue(), qs[i]); - if (qpos != null) { - ows[j] = wst.interpolateW(station, qpos); - oqs[j] = wst.getQ(qpos, station); - } else { - ows[j] = Double.NaN; - oqs[j] = qs[i]; - } - } - return new WQDay(odays, ows, oqs); + final CalculationResult res = winfo.getDurationCurveData(); + final WQDay wqday = (WQDay) res.getData(); + if (wqday == null) + return null; + + final int[] odays = new int[wqday.size()]; + for (int i = 0; i <= odays.length - 1; i++) + odays[i] = 365 - wqday.getDay(i); + return new WQDay(odays, wqday.getWs(), wqday.getQs()); } /**