diff artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/common/GaugeDischargeValuesFinder.java @ 9202:b4402594213b

More work on calculations and output for S-Info flood duration workflow (chart types 1 and 2)
author mschaefer
date Mon, 02 Jul 2018 07:33:53 +0200
parents 1614cb14308f
children d9fda7af24ca
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/common/GaugeDischargeValuesFinder.java	Sun Jul 01 15:29:40 2018 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/common/GaugeDischargeValuesFinder.java	Mon Jul 02 07:33:53 2018 +0200
@@ -44,14 +44,16 @@
     /***** CONSTRUCTORS *****/
 
     private GaugeDischargeValuesFinder(final Gauge gauge, final Calculation problems, final DischargeTable dischargeTable) {
+        // Load W-Q-values from database
         this.gauge = gauge;
         this.problems = problems;
         final TDoubleArrayList ws = new TDoubleArrayList();
         final TDoubleArrayList qs = new TDoubleArrayList();
-        for (final DischargeTableValue v : DischargeTable.getValuesSortedByW(dischargeTable)) {
+        for (final DischargeTableValue v : DischargeTable.fetchValuesSortedByW(dischargeTable)) {
             ws.add(v.getW().doubleValue());
             qs.add(v.getQ().doubleValue());
         }
+        // Build interpolator
         if (ws.size() >= 2) {
             this.wInterpolator = new LinearInterpolator().interpolate(ws.toNativeArray(), qs.toNativeArray());
             this.wRange = new DoubleRange(ws.get(0), ws.get(ws.size() - 1));
@@ -71,12 +73,12 @@
     /***** METHODS *****/
 
     /**
-     * Loads the the main discharge table of a gauge (GAUGE.at)
+     * Loads the the main discharge table of a gauge ({gauge}.at)
      *
      * @return The discharge table values finder of the gauge, or null
      */
     public static GaugeDischargeValuesFinder loadValues(final Gauge gauge, final Calculation problems) {
-        final DischargeTable table = DischargeTable.getGaugeMainDischargeTable(gauge);
+        final DischargeTable table = gauge.fetchMasterDischargeTable();
         if ((table == null) || (table.getDischargeTableValues().size() == 0)) {
             problems.addProblem("gauge_discharge_table.missing", gauge.getName());
             return null;

http://dive4elements.wald.intevation.org