Displaying differences for changeset
 
display as  

src/java/m/cfa/DoubleMath.java

@@ -8,7 +8,7 @@
 import org.apache.commons.math.analysis.polynomials.PolynomialSplineFunction;
 
 /**
-* Last Updated: 13-September-2016
+* Last Updated: 20-April-2017
 * @author Tyler Wible
 * @since 21-June-2012
 */
@@ -127,14 +127,13 @@
      * Rounds the double[] array to the number of decimal places "n" where roundingValue = 10^n  
      * For example if the roundingValue is equal to 10, then the returned matrix would contain the original matrix with 1 decimal place 
      * @param array  the original double[] matrix to be rounded
-     * @param roundingValue  is equal to the 10^number of decimal places desired (aka 2 decimal places has a roundingValue = 10)
+     * @param decimalPlaces  is equal to the number of decimal places desired
      * @return  a double[] array of the rounded values of the original data
      */
-    public static double[] roundColumn(double[] array, double roundingValue){
+    public static double[] roundColumn(double[] array, double decimalPlaces){
         double[] roundedArray = new double[array.length];
         for(int i=0; i<array.length; i++){
-            double tempValue = Math.round(array[i]*roundingValue);
-            roundedArray[i] = tempValue/roundingValue;
+            roundedArray[i] = round(array[i], decimalPlaces);
         }
 
         return roundedArray;

src/java/m/cfa/durationcurve/guiDC_Model.java

@@ -33,7 +33,7 @@
 import org.jfree.data.xy.XYSeriesCollection;
 
 /**
-* Last Updated: 13-September-2016
+* Last Updated: 20-April-2017
 * @author Tyler Wible
 * @since 12-June-2011
 */
@@ -1245,10 +1245,10 @@
         }
 
         //Round results for summary table
-        yFinal = DoubleMath.roundColumn(yFinal, 100);
-        period1 = DoubleMath.roundColumn(period1, 100);
-        period2 = DoubleMath.roundColumn(period2, 100);
-        period3 = DoubleMath.roundColumn(period3, 100);
+        yFinal = DoubleMath.roundColumn(yFinal, 3);
+        period1 = DoubleMath.roundColumn(period1, 3);
+        period2 = DoubleMath.roundColumn(period2, 3);
+        period3 = DoubleMath.roundColumn(period3, 3);
 
         //Create summary table in a single string
         summaryTable = "Exceedance Percentile\t" + title + "\tPeriod 1 " + title + "\tPeriod 2 " + title + "\tPeriod 3 " + title;

src/java/m/cfa/flood/Bulletin17B.java

@@ -81,7 +81,7 @@
     }
 }
 /**
-* Last Updated: 13-September-2016
+* Last Updated: 20-April-2017
 * @author Tyler Wible (converted from Matlab to Java retaining comments from the Matlab code and the original Matlab code segments as comments before/after their corresponding Java code segments)
 * @author Jeff Burkey (originally written in Matlab)
 * @since Java version: 16-May-2012
@@ -1158,10 +1158,10 @@
         double[] yFinal95U = DoubleMath.linearInterpolation(DoubleArray.getColumn(curves,1), DoubleArray.getColumn(curves,3), invfrqDisp);  //Added for extra information    (Tyler)
 
         //Round all values to one decimal place for summary table
-        yFinal = DoubleMath.roundColumn(yFinal, 10);
-        //yExpect = DoubleMath.roundColumn(yExpect, 10);
-        yFinal95L = DoubleMath.roundColumn(yFinal95L, 10);
-        yFinal95U = DoubleMath.roundColumn(yFinal95U, 10);
+        yFinal = DoubleMath.roundColumn(yFinal, 2);
+        //yExpect = DoubleMath.roundColumn(yExpect, 2);
+        yFinal95L = DoubleMath.roundColumn(yFinal95L, 2);
+        yFinal95U = DoubleMath.roundColumn(yFinal95U, 2);
 
         //Matlab code:    mm = num2str([frqDisp yFinal yExpect],'%5.2f %7.0f %7.0f');
         //below is very specific to mm format above    (Jeff)

src/java/m/cfa/regionalfdc/guiRegionalFDC_Model.java

@@ -25,7 +25,7 @@
 import org.jfree.data.xy.XYSeriesCollection;
 
 /**
-* Last Updated: 13-September-2016
+* Last Updated: 20-April-2017
 * @author Tyler Wible
 * @since 23-October-2011
 */
@@ -111,7 +111,7 @@
         double[] currentFDC = DoubleArray.getColumn(xyRanks, 0);
         double[] currentFlows = DoubleArray.getColumn(xyRanks, 1);
         double[] currentSummary = DoubleMath.linearInterpolation(currentFDC, currentFlows, frqDisp);
-        currentSummary = DoubleMath.roundColumn(currentSummary, 100);
+        currentSummary = DoubleMath.roundColumn(currentSummary, 3);
         
         //Determine if this is the first entry and should thus include the exceedance percentile summary values
         if(firstEntry){