@@ -726,9 +726,9 @@ Public Class DFLOWCalcs
726
726
Dim lHydrologicTS As atcTimeseries = aDataGroup(lDSIndex)
727
727
Dim lHydrologicTS2 As atcTimeseries = SubsetByDateBoundary(lHydrologicTS, lStartMonth, lStartDay, Nothing , lFirstyearDFLOW, lLastYearDFLOW, lEndMonthDFLOW, lEndDayDFLOW)
728
728
Dim lFirstDate As Double = lHydrologicTS2.Attributes.GetValue( "start date" )
729
- Dim lHydrologicDS As atcTimeseries = lHydrologicTS2
730
- Dim lSYear As Integer = (lDateFormat.JDateToString(lHydrologicDS .Attributes.GetValue( "start date" ))).Substring( 0 , 4 )
731
- Dim lEYear As Integer = (lDateFormat.JDateToString(lHydrologicDS .Attributes.GetValue( "end date" ))).Substring( 0 , 4 )
729
+ ' Dim lHydrologicDS As atcTimeseries = lHydrologicTS2
730
+ Dim lSYear As Integer = (lDateFormat.JDateToString(lHydrologicTS2 .Attributes.GetValue( "start date" ))).Substring( 0 , 4 )
731
+ Dim lEYear As Integer = (lDateFormat.JDateToString(lHydrologicTS2 .Attributes.GetValue( "end date" ))).Substring( 0 , 4 )
732
732
Dim lYears As Integer = lEYear - lSYear
733
733
lHydrologicTS.Attributes.SetValue( "xBy start date" , lFirstDate)
734
734
lHydrologicTS.Attributes.SetValue( "xBy start year" , lSYear)
@@ -746,7 +746,7 @@ Public Class DFLOWCalcs
746
746
If aShowProgress Then lfrmProgress.Label1.Text = ( 1 + lItemIdx) & " of " & lTotalItems & " - " & fAveragingPeriod & "Q" & fReturnPeriod
747
747
Application.DoEvents()
748
748
If lYears >= lReturnPeriod Then
749
- lxQy = xQy(lAveragingPeriod, lReturnPeriod, lHydrologicDS , aInputs)
749
+ lxQy = xQy(lAveragingPeriod, lReturnPeriod, lHydrologicTS2 , aInputs)
750
750
Else
751
751
lxQy = lNaN
752
752
End If
@@ -765,9 +765,10 @@ Public Class DFLOWCalcs
765
765
lHydrologicTS.Attributes.SetValue(lxQyKey, lxQy)
766
766
767
767
' ===== Create 4-day running average for start of xBy excursion analysis -
768
- Dim lTimeSeries As atcTimeseries = SubsetByDateBoundary(aDataGroup(lDSIndex), lStartMonth, lStartDay, Nothing , lFirstyearDFLOW, lLastYearDFLOW, lEndMonthDFLOW, lEndDayDFLOW)
768
+ 'Dim lTimeSeries As atcTimeseries = SubsetByDateBoundary(aDataGroup(lDSIndex), lStartMonth, lStartDay, Nothing, lFirstyearDFLOW, lLastYearDFLOW, lEndMonthDFLOW, lEndDayDFLOW)
769
+ 'Dim lHydrologicTS2 As atcTimeseries = SubsetByDateBoundary(lHydrologicTS, lStartMonth, lStartDay, Nothing, lFirstyearDFLOW, lLastYearDFLOW, lEndMonthDFLOW, lEndDayDFLOW)
769
770
770
- Dim lTS As Double () = lTimeSeries .Values
771
+ Dim lTS As Double () = lHydrologicTS2 .Values
771
772
lTS( 0 ) = lNaN
772
773
773
774
Dim lTSN As Double ()
@@ -832,7 +833,8 @@ Public Class DFLOWCalcs
832
833
Next
833
834
834
835
' ----- 2. Get initial guess
835
- Dim lxBy As Double = xQy(lBioPeriod, lBioYears, aDataGroup(lDSIndex), aInputs)
836
+ 'Dim lxBy As Double = xQy(lBioPeriod, lBioYears, aDataGroup(lDSIndex), aInputs)
837
+ Dim lxBy As Double = xQy(lBioPeriod, lBioYears, lHydrologicTS2, aInputs)
836
838
837
839
' ----- 3. Do xBy calculation
838
840
Dim lExcursionCount As Integer
@@ -857,7 +859,8 @@ Public Class DFLOWCalcs
857
859
End If
858
860
Application.DoEvents()
859
861
860
- lEquivalentxQy = xQy(lAveragingPeriod, lYears, aDataGroup(lDSIndex), aInputs)
862
+ 'lEquivalentxQy = xQy(lAveragingPeriod, lYears, aDataGroup(lDSIndex), aInputs)
863
+ lEquivalentxQy = xQy(lAveragingPeriod, lYears, lHydrologicTS2, aInputs)
861
864
If lEquivalentxQy > lxBy Then
862
865
lReturnPeriodTry = lYears
863
866
Else
@@ -869,7 +872,8 @@ Public Class DFLOWCalcs
869
872
lEquivalentxQy = lxBy
870
873
While lEquivalentxQy >= lxBy And lReturnPeriodTry < lYears
871
874
lReturnPeriodTry += 1
872
- lEquivalentxQy = xQy(lAveragingPeriod, lReturnPeriodTry, aDataGroup(lDSIndex), aInputs)
875
+ 'lEquivalentxQy = xQy(lAveragingPeriod, lReturnPeriodTry, aDataGroup(lDSIndex), aInputs)
876
+ lEquivalentxQy = xQy(lAveragingPeriod, lReturnPeriodTry, lHydrologicTS2, aInputs)
873
877
If aShowProgress Then
874
878
lfrmProgress.Label1.Text = ( 1 + lItemIdx) & " of " & lTotalItems & " - xQy (" & lReturnPeriodTry & " of up to " & lYears & ")"
875
879
End If
@@ -931,12 +935,12 @@ Public Class DFLOWCalcs
931
935
Next
932
936
933
937
' ===== Store results
934
- ladsResults.CellValue(lItemIdx + 1 , 0 ) = lHydrologicDS .Attributes.GetFormattedValue("Location" ) & " - " & lHydrologicDS .Attributes.GetFormattedValue("STANAM" )
938
+ ladsResults.CellValue(lItemIdx + 1 , 0 ) = lHydrologicTS2 .Attributes.GetFormattedValue("Location" ) & " - " & lHydrologicTS2 .Attributes.GetFormattedValue("STANAM" )
935
939
936
940
' ----- Next three values are corrected by one day to account for current (3/2008) behavior of time series trimming
937
941
938
- ladsResults.CellValue(lItemIdx + 1 , 1 ) = lDateFormat.JDateToString( 1 + lHydrologicDS .Attributes.GetValue("start date" )) & " - " &
939
- lDateFormat.JDateToString(lHydrologicDS .Attributes.GetValue( "end date" ))
942
+ ladsResults.CellValue(lItemIdx + 1 , 1 ) = lDateFormat.JDateToString( 1 + lHydrologicTS2 .Attributes.GetValue("start date" )) & " - " &
943
+ lDateFormat.JDateToString(lHydrologicTS2 .Attributes.GetValue( "end date" ))
940
944
ladsResults.CellValue(lItemIdx + 1 , 2 ) = Format(UBound(lTS) - 1 , "#,##0" ) & " "
941
945
ladsResults.Alignment(lItemIdx + 1 , 2 ) = atcControls.atcAlignment.HAlignRight
942
946
ladsResults.CellValue(lItemIdx + 1 , 3 ) = Format(lNZero, "#,##0" ) & "/" & Format(lNMiss - 1 , "#,##0" ) & " "
@@ -1011,17 +1015,18 @@ Public Class DFLOWCalcs
1011
1015
lPct = lNExcHF / (UBound(lTS) - lNMiss)
1012
1016
ladsResults.CellValue(lItemIdx + 1 , 15 ) = Format(lPct, "percent" )
1013
1017
ladsResults.Alignment(lItemIdx + 1 , 15 ) = atcControls.atcAlignment.HAlignDecimal
1014
- lHydrologicTS.Attributes.SetValue(lHMeanKey, lTimeSeries .Attributes.GetValue("Harmonic Mean" ) & vbTab & Format(lPct, "percent" ) & vbTab & "N/A" )
1018
+ lHydrologicTS.Attributes.SetValue(lHMeanKey, lHydrologicTS2 .Attributes.GetValue("Harmonic Mean" ) & vbTab & Format(lPct, "percent" ) & vbTab & "N/A" )
1015
1019
Dim lHMeanAdjKey As String = "NONBIOFLOW-Harmonic Mean Adj"
1016
1020
Dim lPctAdj As Double = lNExcHFAdj / (UBound(lTS) - lNMiss)
1017
- lHydrologicTS.Attributes.SetValue(lHMeanAdjKey, lTimeSeries .Attributes.GetValue("Harmonic Mean Adj" ) & vbTab & Format(lPctAdj, "percent" ) & vbTab & "N/A" )
1021
+ lHydrologicTS.Attributes.SetValue(lHMeanAdjKey, lHydrologicTS2 .Attributes.GetValue("Harmonic Mean Adj" ) & vbTab & Format(lPctAdj, "percent" ) & vbTab & "N/A" )
1018
1022
1019
1023
If lAddSeason Then
1020
1024
ladsResults.CellValue(lItemIdx + 1 , 16 ) = lHydrologicTS.Attributes.GetValue( "seasonname" )
1021
1025
End If
1022
1026
lItemIdx = lItemIdx + 1
1023
- lHydrologicTS2.Clear() : lHydrologicTS2 = Nothing
1024
- lTimeSeries.Clear() : lTimeSeries = Nothing
1027
+ 'lHydrologicTS2.Clear()
1028
+ 'lHydrologicTS2 = Nothing
1029
+ lHydrologicTS2.numValues = 0
1025
1030
Erase lTSN
1026
1031
GC.Collect()
1027
1032
Next 'lDSIndex}
0 commit comments