diff artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/common/GaugeDurationValuesFinder.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 a4121ec450d6
children 9b16f58c62a7
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/common/GaugeDurationValuesFinder.java	Sun Jul 01 15:29:40 2018 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/common/GaugeDurationValuesFinder.java	Mon Jul 02 07:33:53 2018 +0200
@@ -21,7 +21,7 @@
 import gnu.trove.TDoubleArrayList;
 
 /**
- * Loading and search/interpolate the duration main values of a gauge
+ * Search/interpolation of the duration main values of a gauge
  *
  * @author Matthias Schäfer
  *
@@ -49,6 +49,7 @@
     /***** CONSTRUCTORS *****/
 
     private GaugeDurationValuesFinder(final Gauge gauge, final Calculation problems) {
+        // Load the duration main values from the database (each duration has a Q)
         this.gauge = gauge;
         this.problems = problems;
         final TDoubleArrayList qs = new TDoubleArrayList();
@@ -57,6 +58,7 @@
             qs.add(v.getValue().doubleValue());
             durs.add(Integer.valueOf(v.getMainValue().getName()).doubleValue());
         }
+        // Build the duration-by-Q interpolator
         try {
             this.qInterpolator = new LinearInterpolator().interpolate(qs.toNativeArray(), durs.toNativeArray());
             this.qRange = new DoubleRange(qs.get(0), qs.get(qs.size() - 1));
@@ -65,12 +67,14 @@
             this.qInterpolator = null;
             this.qRange = null;
         }
+        // Load the Q values by duration from the database
         qs.clear();
         durs.clear();
         for (final MainValue v : MainValue.getDurationDischargesOfGauge(gauge)) {
             durs.add(Integer.valueOf(v.getMainValue().getName()).doubleValue());
             qs.add(v.getValue().doubleValue());
         }
+        // Build the Q-by-duration interpolator
         try {
             this.durInterpolator = new LinearInterpolator().interpolate(durs.toNativeArray(), qs.toNativeArray());
             this.durRange = new DoubleRange(durs.get(0), durs.get(durs.size() - 1));
@@ -79,6 +83,7 @@
             this.durInterpolator = null;
             this.durRange = null;
         }
+        // Report problems
         if (((this.qInterpolator == null) || (this.durInterpolator == null)) && (this.problems != null)) {
             this.problems.addProblem("gauge_duration.missing", gauge.getName());
             // Report only once
@@ -89,7 +94,7 @@
     /***** METHODS *****/
 
     /**
-     * Loads the the discharge-duration table of a gauge (GAUGE.glt)
+     * Loads the the discharge-duration table of a gauge ({gauge}.sta)
      *
      * @return The main values finder of a a gauge, or null
      */

http://dive4elements.wald.intevation.org