Displaying differences for changeset
 
display as  

src/java/cfa/CDPHE_lowFlowStats.java

@@ -569,7 +569,7 @@
             String[][] partialData = doubleArray.getYearsData(flowData, currentYear);
             if(partialData.length > 0){
                 double[] flowOnlyData = convertSecondColumn(partialData);
-                medianFlows.add(doubleMath.Median(flowOnlyData));
+                medianFlows.add(doubleMath.median(flowOnlyData));
             }
             
             int nextYear = Integer.parseInt(currentYear) + 1;

src/java/cfa/DoubleArray.java

@@ -1034,7 +1034,7 @@
         return peakFlowData;
     }
     /**
-     * Computes the daily/monthly/yearly max/min/average/total of the daily dataset provided
+     * Computes the daily/monthly/yearly max/min/average/total of the daily dataset provided (requires previously sorted data by date)
      * @param dailyData  a string array with column1 = dates (yyyy-mm-dd format), column2 = value
      * @param timeStep  the desired timestep "daily", "monthly", or "yearly"
      * @param method  the desired method "max", "min", "average", or "total"
@@ -1066,7 +1066,7 @@
     }
     /**
      * Computes the method on the dailyData provided substring-ing the dates from 0-dateLimit to 
-     * get a unique set of time periods on which to perform the method
+     * get a unique set of time periods on which to perform the method (requires previously sorted data by date)
      * @param dailyData  a string array with column1 = dates (yyyy-mm-dd format), column2 = value
      * @param method  the desired method "max", "min", "average", or "total"
      * @param dateLimit  an integer for the limit of the date substring (typically 4 or 7 for the 
@@ -1103,13 +1103,13 @@
                 //If current data != current month, calculate method on the current month's dataset, save the result and reset the dataset
                 newData[ctr][0] = uniqueTimeStep.get(ctr);
                 if(method.equalsIgnoreCase("max")){
-                        newData[ctr][1] = String.valueOf(doubleMath.max(currentMonthData));
+                    newData[ctr][1] = String.valueOf(doubleMath.max(currentMonthData));
                 }else if(method.equalsIgnoreCase("average")){
-                        newData[ctr][1] = String.valueOf(doubleMath.meanArithmetic(currentMonthData));
+                    newData[ctr][1] = String.valueOf(doubleMath.meanArithmetic(currentMonthData));
                 }else if(method.equalsIgnoreCase("min")){
-                        newData[ctr][1] = String.valueOf(doubleMath.min(currentMonthData));
+                    newData[ctr][1] = String.valueOf(doubleMath.min(currentMonthData));
                 }else if(method.equalsIgnoreCase("total")){
-                        newData[ctr][1] = String.valueOf(doubleMath.sum(currentMonthData));
+                    newData[ctr][1] = String.valueOf(doubleMath.sum(currentMonthData));
                 }
 
                 //Reset the dataset and add the current data to it as the new month's data

src/java/cfa/DoubleMath.java

@@ -363,7 +363,7 @@
             percentile = array[0];
         }else if(Double.compare(percentile_type, 0.5) == 0){
             //Find median of dataset
-            percentile = Median(array);
+            percentile = median(array);
         }else{
             //Find rank of the desired percentile
             double rank = percentile_type*(array.length + 1);//ex: 0.95*(n + 1) = rank of 95th percentile
@@ -413,13 +413,13 @@
     * @param array  input list data for median
     * @return median of the dataset.
     */
-    public double Median(double[] array){
+    public double median(double[] array){
         //sort dataset before calculating median
         Arrays.sort(array);
         
         //Find the median
         int midpoint = (array.length)/2;
-        double median = 0;
+        double median = -9999;
         if(array.length == 0){
             median = -9999;
         }else if(array.length%2 == 1){
@@ -434,9 +434,9 @@
     * @param array  input list data for median
     * @return median of the dataset.
     */
-    public double Median(ArrayList<Double> array){
+    public double median(ArrayList<Double> array){
         double[] newArray = convertArray(array);
-        double median = Median(newArray);
+        double median = median(newArray);
         return median;
     }
     /**

src/java/cfa/FlowStatistics.java

@@ -727,7 +727,7 @@
         additionalSummary[4] = String.valueOf(doubleMath.round(doubleMath.min(allData), 3));//Minimum, overall
         additionalSummary[5] = String.valueOf(doubleMath.round(doubleMath.Percentile_function(allData,0.75), 3));//Upper Quartile, overall
         additionalSummary[6] = String.valueOf(doubleMath.round(doubleMath.Percentile_function(allData,0.25), 3));//Lower Quartile, overall
-        additionalSummary[7] = String.valueOf(doubleMath.round(doubleMath.Median(allData), 3));//Median, overall
+        additionalSummary[7] = String.valueOf(doubleMath.round(doubleMath.median(allData), 3));//Median, overall
         additionalSummary[8] = String.valueOf(doubleMath.round(doubleMath.meanArithmetic(allData), 3));//Average, overall
         additionalSummary[9] = String.valueOf(doubleMath.round(doubleMath.StandardDeviationSample(allData), 3));//Standard Deviation, overall
         additionalSummary[10] = String.valueOf(doubleMath.round(doubleMath.VarianceSample(allData), 3));//Variance, overall
@@ -857,7 +857,7 @@
         statsSummaryTable[index + 2] = String.valueOf(doubleMath.round(doubleMath.min(data), 3));//Minimum
         statsSummaryTable[index + 3] = String.valueOf(doubleMath.round(doubleMath.Percentile_function(data, 0.75), 3));//Upper Quartile
         statsSummaryTable[index + 4] = String.valueOf(doubleMath.round(doubleMath.Percentile_function(data,0.25), 3));//Lower Quartile
-        statsSummaryTable[index + 5] = String.valueOf(doubleMath.round(doubleMath.Median(data), 3));//Median
+        statsSummaryTable[index + 5] = String.valueOf(doubleMath.round(doubleMath.median(data), 3));//Median
         statsSummaryTable[index + 6] = String.valueOf(doubleMath.round(doubleMath.meanArithmetic(data), 3));//Average
         statsSummaryTable[index + 7] = String.valueOf(doubleMath.round(doubleMath.StandardDeviationSample(data), 3));//Standard Deviation
         statsSummaryTable[index + 8] = String.valueOf(doubleMath.round(doubleMath.VarianceSample(data), 3));//Variance

src/java/cfa/guiBaseflow_Model.java

@@ -504,22 +504,22 @@
         //Calculate the statistics for each baseflow filter pass
         this.bflowStream_max = doubleMath.round(doubleMath.max(getColumn(graphData,1)),3);
         this.bflowStream_min = doubleMath.round(doubleMath.min(getColumn(graphData,1)),3);
-        this.bflowStream_median = doubleMath.round(doubleMath.Median(getColumn(graphData,1)),3);
+        this.bflowStream_median = doubleMath.round(doubleMath.median(getColumn(graphData,1)),3);
         this.bflowStream_mean = doubleMath.round(doubleMath.meanArithmetic(getColumn(graphData,1)),3);
         
         this.bflow1_max = doubleMath.round(doubleMath.max(getColumn(graphData,2)),3);
         this.bflow1_min = doubleMath.round(doubleMath.min(getColumn(graphData,2)),3);
-        this.bflow1_median = doubleMath.round(doubleMath.Median(getColumn(graphData,2)),3);
+        this.bflow1_median = doubleMath.round(doubleMath.median(getColumn(graphData,2)),3);
         this.bflow1_mean = doubleMath.round(doubleMath.meanArithmetic(getColumn(graphData,2)),3);
         
         this.bflow2_max = doubleMath.round(doubleMath.max(getColumn(graphData,3)),3);
         this.bflow2_min = doubleMath.round(doubleMath.min(getColumn(graphData,3)),3);
-        this.bflow2_median = doubleMath.round(doubleMath.Median(getColumn(graphData,3)),3);
+        this.bflow2_median = doubleMath.round(doubleMath.median(getColumn(graphData,3)),3);
         this.bflow2_mean = doubleMath.round(doubleMath.meanArithmetic(getColumn(graphData,3)),3);
         
         this.bflow3_max = doubleMath.round(doubleMath.max(getColumn(graphData,4)),3);
         this.bflow3_min = doubleMath.round(doubleMath.min(getColumn(graphData,4)),3);
-        this.bflow3_median = doubleMath.round(doubleMath.Median(getColumn(graphData,4)),3);
+        this.bflow3_median = doubleMath.round(doubleMath.median(getColumn(graphData,4)),3);
         this.bflow3_mean = doubleMath.round(doubleMath.meanArithmetic(getColumn(graphData,4)),3);
     }
     /**

src/java/cfa/guiDC_Model.java

@@ -1345,7 +1345,7 @@
         
         //Calculate statistics
         DoubleMath doubleMath = new DoubleMath();
-        this.flowMedian = doubleMath.round(doubleMath.Median(dataList),3);//Call Median function
+        this.flowMedian = doubleMath.round(doubleMath.median(dataList),3);//Call Median function
         this.flowMean = doubleMath.round(doubleMath.meanArithmetic(dataList),3);//Call Mean function
     }
     /**

src/java/cfa/guiLOADEST_Model.java

@@ -642,7 +642,7 @@
         double temp2 = doubleMath.round(doubleMath.min(dataList),3);//Call Min function
         double temp3 = doubleMath.round(doubleMath.Percentile_function(dataList,0.75),3);//Call Upper Quartile function
         double temp4 = doubleMath.round(doubleMath.Percentile_function(dataList,0.25),3);//Call Lower Quartile function
-        double temp5 = doubleMath.round(doubleMath.Median(dataList),3);//Call Median function
+        double temp5 = doubleMath.round(doubleMath.median(dataList),3);//Call Median function
         double temp6 = doubleMath.round(doubleMath.meanArithmetic(dataList),3);//Call Mean function
         double temp7 = doubleMath.round(doubleMath.StandardDeviationSample(dataList),3);//Call standard deviation
         

src/java/cfa/guiTimeseries_Model.java

@@ -118,6 +118,19 @@
     double coeffvar = -1;
     double kendallCorlCoeff = -1;
     
+    String len_seasonal = "-1";
+    double max_seasonal = -1;
+    double min_seasonal = -1;
+    double upperQuartile_seasonal = -1;
+    double lowerQuartile_seasonal = -1;
+    double median_seasonal = -1;
+    double mean_seasonal = -1;
+    double standardDeviation_seasonal = -1;
+    double variance_seasonal = -1;
+    double skew_seasonal = -1;
+    double coeffvar_seasonal = -1;
+    double kendallCorlCoeff_seasonal = -1;
+    
     String len_period1 = "-1";
     double max_period1 = -1;
     double min_period1 = -1;
@@ -312,6 +325,42 @@
     public String getKendallCorrelationCoefficient(){
         return String.valueOf(kendallCorlCoeff);
     }
+    public String getLen_seasonal(){
+        return len_seasonal;
+    }
+    public String getMax_seasonal(){
+        return String.valueOf(max_seasonal);
+    }
+    public String getMin_seasonal(){
+        return String.valueOf(min_seasonal);
+    }
+    public String getUpperQuartile_seasonal(){
+        return String.valueOf(upperQuartile_seasonal);
+    }
+    public String getLowerQuartile_seasonal(){
+        return String.valueOf(lowerQuartile_seasonal);
+    }
+    public String getMedian_seasonal(){
+        return String.valueOf(median_seasonal);
+    }
+    public String getMean_seasonal(){
+        return String.valueOf(mean_seasonal);
+    }
+    public String getStandardDeviation_seasonal(){
+        return String.valueOf(standardDeviation_seasonal);
+    }
+    public String getVariance_seasonal(){
+        return String.valueOf(variance_seasonal);
+    }
+    public String getSkewness_seasonal(){
+        return String.valueOf(skew_seasonal);
+    }
+    public String getCoefficientOfVariation_seasonal(){
+        return String.valueOf(coeffvar_seasonal);
+    }
+    public String getKendallCorrelationCoefficient_seasonal(){
+        return String.valueOf(kendallCorlCoeff_seasonal);
+    }
     public String getLen_period1(){
         return len_period1;
     }
@@ -551,7 +600,7 @@
         double temp2 = doubleMath.round(doubleMath.min(dataList),3);//Call Min function
         double temp3 = doubleMath.round(doubleMath.Percentile_function(dataList,0.75),3);//Call Upper Quartile function
         double temp4 = doubleMath.round(doubleMath.Percentile_function(dataList,0.25),3);//Call Lower Quartile function
-        double temp5 = doubleMath.round(doubleMath.Median(dataList),3);//Call Median function
+        double temp5 = doubleMath.round(doubleMath.median(dataList),3);//Call Median function
         double temp6 = doubleMath.round(doubleMath.meanArithmetic(dataList),3);//Call Mean function
         double temp7 = doubleMath.round(doubleMath.StandardDeviationSample(dataList),3);//Call standard deviation function
         double temp8 = doubleMath.round(doubleMath.VarianceSample(dataList),3);//Call variance function
@@ -571,6 +620,19 @@
             skew = temp9;
             coeffvar = temp10;
             kendallCorlCoeff = temp11;
+        }else if(flag.equalsIgnoreCase("seasonal")){
+            len_seasonal = String.valueOf(data.length);
+            max_seasonal = temp1;
+            min_seasonal = temp2;
+            upperQuartile_seasonal = temp3;
+            lowerQuartile_seasonal = temp4;
+            median_seasonal = temp5;
+            mean_seasonal = temp6;
+            standardDeviation_seasonal = temp7;
+            variance_seasonal = temp8;
+            skew_seasonal = temp9;
+            coeffvar_seasonal = temp10;
+            kendallCorlCoeff_seasonal = temp11;
         }else if(flag.equalsIgnoreCase("period1")){
             max_period1 = temp1;
             min_period1 = temp2;
@@ -1251,7 +1313,7 @@
             //Calculate average/median
             double dayValue = 0;
             if(medianTF){
-                dayValue = doubleMath.Median(dateData);
+                dayValue = doubleMath.median(dateData);
             }else{
                 dayValue = doubleMath.meanArithmetic(dateData);
             }
@@ -1954,6 +2016,7 @@
         String[][] period1Data = doubleArray.getPeriodData(sortedData_combined, period1Begin, period1End);
         String[][] period2Data = doubleArray.getPeriodData(sortedData_combined, period2Begin, period2End);
         String[][] period3Data = doubleArray.getPeriodData(sortedData_combined, period3Begin, period3End);
+        String[][] seasonalData = doubleArray.getSeasonalData(sortedData_combined, seasonBegin, seasonEnd);
         
         //Perform operations on daily data before it is converted to the user desired timeStep
         createTimeseriesMonthlyGraph(sortedData_combined, period1Data, period2Data, period3Data, monthlyYaxisTitle);
@@ -2032,12 +2095,14 @@
         period1Data = doubleArray.computeFlowMethod(period1Data, timeStep, method, false);
         period2Data = doubleArray.computeFlowMethod(period2Data, timeStep, method, false);
         period3Data = doubleArray.computeFlowMethod(period3Data, timeStep, method, false);
+        seasonalData = doubleArray.computeFlowMethod(seasonalData, timeStep, method, false);
         
         //CalculateStatistics
         CalculateStatistics(sortedData_combined, "all");
         CalculateStatistics(period1Data, "period1");
         CalculateStatistics(period2Data, "period2");
         CalculateStatistics(period3Data, "period3");
+        CalculateStatistics(seasonalData, "seasonal");
         
         //Graph the timeseries data
         createTimeseriesGraph(sortedData_combined, sortedData_user, period1Data, period2Data, period3Data, color, color2, showLine, yAxisTitle, graphUnits, medianTF);

src/java/m/cfa/Timeseries_V1_0.java

@@ -131,6 +131,19 @@
         putResult("skewness", model.getSkewness());
         putResult("coefficientOfVariation", model.getCoefficientOfVariation());
         putResult("kendalCorrelationCoefficient", model.getKendallCorrelationCoefficient());
+        //Get seasonal results
+        putResult("len_seasonal", model.getLen_seasonal());
+        putResult("max_seasonal", model.getMax_seasonal(), null, model.getUnits());
+        putResult("min_seasonal", model.getMin_seasonal(), null, model.getUnits());
+        putResult("upperQuartile_seasonal", model.getUpperQuartile_seasonal(), null, model.getUnits());
+        putResult("lowerQuartile_seasonal", model.getLowerQuartile_seasonal(), null, model.getUnits());
+        putResult("median_seasonal", model.getMedian_seasonal(), null, model.getUnits());
+        putResult("mean_seasonal", model.getMean_seasonal(), null, model.getUnits());
+        putResult("standardDeviation_seasonal", model.getStandardDeviation_seasonal(), null, model.getUnits());
+        putResult("variance_seasonal", model.getVariance_seasonal());
+        putResult("skewness_seasonal", model.getSkewness_seasonal());
+        putResult("coefficientOfVariation_seasonal", model.getCoefficientOfVariation_seasonal());
+        putResult("kendalCorrelationCoefficient_seasonal", model.getKendallCorrelationCoefficient_seasonal());
         //Get Period 1 results
         putResult("len_period1", model.getLen_period1());
         putResult("max_period1", model.getMax_period1(), null, model.getUnits());