Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/respec/BASINS
Browse files Browse the repository at this point in the history
  • Loading branch information
PaulHummelRESPEC committed Mar 1, 2018
2 parents e44f06c + b9439b4 commit 430a4d4
Show file tree
Hide file tree
Showing 14 changed files with 1,544 additions and 812 deletions.
95 changes: 69 additions & 26 deletions HSPEXP/CookieCutterGraphs.vb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ Public Module CookieCutterGraphs

If Not System.IO.Directory.Exists(lOutputFolder) Then
System.IO.Directory.CreateDirectory(lOutputFolder)
End If
End If

With lConstituentsToGraph
.Add("BALCLA1", "Benthic Algae")
.Add("PHYCLA", "Phytoplankton as Chlorophyll a")
Expand All @@ -31,9 +32,10 @@ Public Module CookieCutterGraphs
.Add("NO3-CONCDIS", "Nitrate")
.Add("IVOL", "Water Volume")
.Add("P-TOT-IN", "Input of Total P (Existing Conditions)")
.Add("SSED-TOT", "Total Suspended Solids (mg/l)")
.Add("SSED-TOT", "Total Suspended Solids (mg/L)")
.Add("RO", "Flow (cfs)")
.Add("BEDDEP", "Bed Depth (ft)")
.Add("DOXCONC", "Dissolved Oxygen (mg/L)")
End With

Dim lLocations As New atcCollection
Expand Down Expand Up @@ -61,8 +63,10 @@ Public Module CookieCutterGraphs
lScenarioResults.DataSets.Add(lTs)
End If
Next lTs
End If
For Each RCHRES In lLocations
End If

For Each RCHRES In lLocations
#Region "Plotting Nutrient Curves"
If RCHRES.Contains("R:") Then

Dim lRchId = RCHRES.split(":")(1)
Expand Down Expand Up @@ -169,15 +173,15 @@ Public Module CookieCutterGraphs
lCurve.Line.Color = Drawing.Color.FromName("Black")
lCurve.Line.Width = 1
lCurve.Label.Text = "Dissolved NO3-N"
lZgc.SaveIn(lOutputFolder & "RCHRES_" & lRchId & ".png")
lZgc.SaveIn(lOutputFolder & "Nutrient_RCHRES_" & lRchId & ".png")
Else
' Logger.Msg("Cannot generate Regan Plot for RCHRES" & lRchId & ". :
'All timeseries are not available at the RCHRES" & lRchId & ". Therefore Regan plot will not be generated for this reach.")
End If

'Plotting the TSS Curve


End If
#End Region
'Plotting the TSS Curve
#Region "Plotting TSS Curve"

lTimeseriesGroup = New atcTimeseriesGroup

lTimeSeries = lScenarioResults.DataSets.FindData("Location", RCHRES).FindData("Constituent", "RO")(0)
Expand Down Expand Up @@ -246,14 +250,47 @@ Public Module CookieCutterGraphs
lCurve.Line.Width = 1
lCurve.Label.Text = "Bed Depth (ft)"
lZgc.SaveIn(lOutputFolder & "TSS_RCHRES_" & lRchId & ".png")
End If


'Plotting Load Duration Curve
'Read the RES_TP_Standard.csv
End If
#End Region

'Plotting DO Concentrations
Dim lTimeseriesGroupDO As New atcTimeseriesGroup
Dim lTimeSeriesDO As New atcTimeseries(Nothing)
lTimeSeriesDO = lScenarioResults.DataSets.FindData("Location", RCHRES).FindData("Constituent", "DOXCONC")(0)
If lTimeSeriesDO.Attributes.GetDefinedValue("Time Unit").Value <= 3 Then
lTimeseriesGroupDO.Add(Aggregate(lTimeSeriesDO, atcTimeUnit.TUDay, 1, atcTran.TranMax))
lTimeseriesGroupDO.Add(Aggregate(lTimeSeriesDO, atcTimeUnit.TUDay, 1, atcTran.TranMin))

Dim lZgc As ZedGraphControl = CreateZgc(, 1024, 768)
Dim lGrapher As New clsGraphTime(lTimeseriesGroupDO, lZgc)
Dim lMainPane As GraphPane = lZgc.MasterPane.PaneList(0)

Dim lCurve As ZedGraph.LineItem = Nothing
lCurve = lMainPane.CurveList.Item(0)
lCurve.Line.IsVisible = True
lCurve.Symbol.Type = SymbolType.None
lCurve.Line.Color = Drawing.Color.FromName("red")
lCurve.Line.Width = 1
lCurve.Label.Text = "Maximum Daily DO Concentration"
lCurve = lMainPane.CurveList.Item(1)
lCurve.Line.IsVisible = True
lCurve.Symbol.Type = SymbolType.None
lCurve.Line.Color = Drawing.Color.FromName("green")
lCurve.Line.Width = 1
lCurve.Label.Text = "Minimum Daily DO Concentration"

lMainPane.YAxis.Title.Text = "Dissolved Oxygen (mg/L)"
lMainPane.YAxis.Scale.Min = 0
lMainPane.YAxis.Scale.Max = 20
lZgc.SaveIn(lOutputFolder & "DO_Concentration_RCHRES_" & RCHRES.split(":")(1) & ".png")

End If

'Plotting Load Duration Curve
'Read the RES_TP_Standard.csv
#Region "Plotting RES Curve"
If CommonRESStandard = 0.0 Then


If Not (lRchId = LowerRangeRCHId Or lRchId = HigherRangeRCHId Or
(lRchId > LowerRangeRCHId AndAlso lRchId < HigherRangeRCHId)) Then
WQCriteriaInmgperliter = 0.0
Expand Down Expand Up @@ -348,13 +385,13 @@ Public Module CookieCutterGraphs
lCurve = lMainPane.CurveList.Item(0)
lCurve.Line.IsVisible = True
lCurve.Symbol.Type = SymbolType.None
lCurve.Line.Color = Drawing.Color.FromName("orange")
lCurve.Line.Color = Drawing.Color.FromName("green")
lCurve.Line.Width = 2
lCurve.Label.Text = "RES Standard (" & WQCriteriaInmgperliter & " mg/L)"
lCurve = lMainPane.CurveList.Item(1)
lCurve.Line.IsVisible = True
lCurve.Symbol.Type = SymbolType.None
lCurve.Line.Color = Drawing.Color.FromName("blue")
lCurve.Line.Color = Drawing.Color.FromName("red")
lCurve.Line.Width = 2
lCurve.Label.Text = "Baseline"

Expand All @@ -366,18 +403,24 @@ Public Module CookieCutterGraphs

End If

End If

End If



End If



End If
#End Region





Next RCHRES


End If
atcDataManager.DataSets.Clear()
End If

Next i

Dim lGraphFilesCount = 0
'Dim lRCH As HspfOperation

Expand Down
18 changes: 12 additions & 6 deletions HSPEXP/HSPEXP+-D4EM10_common.vbproj
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
<MapFileExtensions>false</MapFileExtensions>
<TargetCulture>en</TargetCulture>
<ProductName>HSPEXP+</ProductName>
<PublisherName>AQUA TERRA Consultants %28a division of RESPEC%29</PublisherName>
<PublisherName>RESPEC</PublisherName>
<WebPage>index.htm</WebPage>
<OpenBrowserOnPublish>false</OpenBrowserOnPublish>
<ApplicationRevision>0</ApplicationRevision>
Expand All @@ -59,7 +59,8 @@
<DefineDebug>true</DefineDebug>
<DefineTrace>true</DefineTrace>
<OutputPath>bin\Debug\</OutputPath>
<DocumentationFile>HSPEXP+.xml</DocumentationFile>
<DocumentationFile>
</DocumentationFile>
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022,42353,42354,42355</NoWarn>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
Expand All @@ -68,23 +69,27 @@
<DefineTrace>true</DefineTrace>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DocumentationFile>HSPEXP+.xml</DocumentationFile>
<DocumentationFile>
</DocumentationFile>
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022,42353,42354,42355</NoWarn>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<DebugSymbols>true</DebugSymbols>
<DefineDebug>true</DefineDebug>
<DefineTrace>true</DefineTrace>
<OutputPath>bin\x86\Debug\</OutputPath>
<DocumentationFile>HSPEXP+.xml</DocumentationFile>
<DocumentationFile>
</DocumentationFile>
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022,42353,42354,42355</NoWarn>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<CodeAnalysisIgnoreGeneratedCode>false</CodeAnalysisIgnoreGeneratedCode>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<DefineTrace>true</DefineTrace>
<OutputPath>bin\x86\Release\</OutputPath>
<DocumentationFile>HSPEXP+.xml</DocumentationFile>
<DocumentationFile>
</DocumentationFile>
<Optimize>true</Optimize>
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022,42353,42354,42355</NoWarn>
<DebugType>pdbonly</DebugType>
Expand All @@ -98,6 +103,7 @@
<Reference Include="System">
<Private>False</Private>
</Reference>
<Reference Include="System.Data" />
<Reference Include="System.Drawing">
<Private>False</Private>
</Reference>
Expand Down Expand Up @@ -158,7 +164,7 @@
<Compile Include="rwzProgress.vb">
<SubType>Form</SubType>
</Compile>
<Compile Include="SensitivityAnalysis.vb" />
<Compile Include="MultiSimulatioManager.vb" />
<Compile Include="SplashScreen1.Designer.vb">
<DependentUpon>SplashScreen1.vb</DependentUpon>
</Compile>
Expand Down
28 changes: 15 additions & 13 deletions HSPEXP/HSPFOutputReports.vb
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ Module HSPFOutputReports

If MultiSimulation Then
SubMultiSim(pHSPFExe, pBaseName, pTestPath, SDateJ, EDateJ, lHspfEchoFileName)
Logger.Msg("Sensitivity/Uncertainty Analysis Complete", vbOKOnly)
Logger.Msg("Multi Simulation Manager Process Complete", vbOKOnly)
OpenFile(pTestPath)
End

Expand Down Expand Up @@ -476,6 +476,7 @@ Module HSPFOutputReports
Case "TotalP"
lConstituentName = "TP"
lConstProperties = Utility.LocateConstituentNames(aHspfUci, lConstituent)
lActiveSections.Add("NITR")
lActiveSections.Add("PHOS")
lActiveSections.Add("PQUAL")
lActiveSections.Add("IQUAL")
Expand All @@ -494,23 +495,24 @@ Module HSPFOutputReports
lConstituentName = "FColi"
lActiveSections.Add("PQUAL")
lActiveSections.Add("IQUAL")
lActiveSections.Add("RQUAL")
lActiveSections.Add("GQUAL")
End Select

Dim lScenarioResults As New atcDataSource
If lOpenHspfBinDataSource.DataSets.Count > 1 Then
Dim lConstituentsToOutput As atcCollection = Utility.ConstituentsToOutput(lConstituent, lConstProperties)
For Each ConstituentForAnalysis As String In lConstituentsToOutput.Keys
'If ConstituentForAnalysis.StartsWith("I:") Then Stop
ConstituentForAnalysis = SafeSubstring(ConstituentForAnalysis, 2)
If ConstituentForAnalysis.EndsWith("1") Or ConstituentForAnalysis.EndsWith("2") Then
ConstituentForAnalysis = Left(ConstituentForAnalysis, ConstituentForAnalysis.Length - 1)
End If
lScenarioResults.DataSets.Add(atcDataManager.DataSets.FindData("Constituent", ConstituentForAnalysis))
'If lOpenHspfBinDataSource.DataSets.Count > 1 Then
' Dim lConstituentsToOutput As atcCollection = Utility.ConstituentsToOutput(lConstituent, lConstProperties)
' For Each ConstituentForAnalysis As String In lConstituentsToOutput.Keys
' Dim OpnType As String = SafeSubstring(ConstituentForAnalysis, 0, 2)
' ConstituentForAnalysis = SafeSubstring(ConstituentForAnalysis, 2)
' If Not OpnType = "R:" AndAlso (ConstituentForAnalysis.EndsWith("1") Or ConstituentForAnalysis.EndsWith("2")) Then

Next
' ConstituentForAnalysis = Left(ConstituentForAnalysis, ConstituentForAnalysis.Length - 1)
' End If
' lScenarioResults.DataSets.Add(atcDataManager.DataSets.FindData("Constituent", ConstituentForAnalysis))

End If
' Next

'End If

If lScenarioResults.DataSets.Count = 0 Then
For Each activeSection As String In lActiveSections
Expand Down
48 changes: 26 additions & 22 deletions HSPEXP/MultiSimulatioManager.vb
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ You can edit this specification file and add more parameters and outputs.", vbOK
SensitivityParameterFile.Close()
End If

Dim lOutputFile As StreamWriter = File.CreateText("MultiSimOutput.csv")
'Dim lOutputFile As StreamWriter = File.CreateText("MultiSimOutput.csv")
Dim loutputTable As DataTable
loutputTable = New DataTable("MultiSimOutput")
loutputTable = AddOutputTableColumns(loutputTable)
Expand All @@ -115,7 +115,7 @@ You can edit this specification file and add more parameters and outputs.", vbOK
For Each TableColumn As DataColumn In loutputTable.Columns 'Writing the table headings
TextToWrite &= TableColumn.Caption & ","
Next
lOutputFile.WriteLine(TextToWrite)
'lOutputFile.WriteLine(TextToWrite)

'The file listing the sensitive parameters and the output DSN already exists.
Dim lSpecificationFileRecordsNew As New ArrayList
Expand Down Expand Up @@ -246,15 +246,17 @@ You can edit this specification file and add more parameters and outputs.", vbOK
End If

Loop While lcsvRecordIndex < lSpecificationFileRecordsNew.Count - 1

For Each TableRow As DataRow In loutputTable.Rows 'Writing the table contents
TextToWrite = ""
For Each TableColumn As DataColumn In loutputTable.Columns
TextToWrite &= TableRow(TableColumn) & ","
Next TableColumn
lOutputFile.WriteLine(TextToWrite)
Next TableRow
lOutputFile.Close()
Dim lOutputFile2 As StreamWriter = File.CreateText(Path.Combine(pTestPath, "MultiSimOutput.xml"))
loutputTable.WriteXml(lOutputFile2)
'For Each TableRow As DataRow In loutputTable.Rows 'Writing the table contents
' TextToWrite = ""
' For Each TableColumn As DataColumn In loutputTable.Columns
' TextToWrite &= TableRow(TableColumn) & ","
' Next TableColumn
' lOutputFile.WriteLine(TextToWrite)
'Next TableRow
'lOutputFile.Close()
lOutputFile2.Close()

End Sub
Private Function ReadCSVFile(aSensitivitySpecificationFile As String)
Expand Down Expand Up @@ -557,26 +559,28 @@ You can edit this specification file and add more parameters and outputs.", vbOK
row(ColumnName) = SimulatedTS.Attributes.GetDefinedValue("Sum").Value - SimulatedTS.Attributes.GetDefinedValue("%Sum75").Value
Case "50%High"
row(ColumnName) = SimulatedTS.Attributes.GetDefinedValue("Sum").Value - SimulatedTS.Attributes.GetDefinedValue("%Sum50").Value
Case "30-day GeoMean"
If SimulatedTS.Values.Count >= 30 Then
Case "max(30-day GeoMean)"
Dim lDailyTs As atcTimeseries = Aggregate(SimulatedTS, atcTimeUnit.TUDay, 1, atcTran.TranAverSame)
If lDailyTs.Values.Count >= 30 Then
Dim GeoMean As New List(Of Double)
Dim lCount As Integer = 0
Dim Test As Double = 0.0
For i As Integer = 1 To SimulatedTS.Values.Count-1
If SimulatedTS.Value(i) > 0 Then
Test += Math.Log10(SimulatedTS.Value(i))
For i As Integer = 1 To lDailyTs.Values.Count - 1
If lDailyTs.Value(i) > 0 Then
Test += Math.Log10(lDailyTs.Value(i))
End If
If i >= 31 Then
If SimulatedTS.Value(i - 30) > 0 Then Test -= Math.Log10(SimulatedTS.Value(i - 30))
If i >= 30 Then
If lDailyTs.Value(i - 30) > 0 Then Test -= Math.Log10(lDailyTs.Value(i - 30))

GeoMean.Add(10 ^ (Test / 30))
End If

Next i
Test = 0.0
For Each lValue As Double In GeoMean
Test += lValue
If lValue > Test Then Test = lValue
Next
row(ColumnName) = Test / GeoMean.Count
row(ColumnName) = Test
End If

Case Else
Expand Down Expand Up @@ -645,8 +649,8 @@ You can edit this specification file and add more parameters and outputs.", vbOK

column = New DataColumn()
column.DataType = Type.GetType("System.Double")
column.ColumnName = "30-day GeoMean"
column.Caption = "30-day Geometric Mean"
column.ColumnName = "max(30-day GeoMean)"
column.Caption = "Max(30-day Geometric Mean)"
aDataTable.Columns.Add(column)

column = New DataColumn()
Expand Down
1 change: 1 addition & 0 deletions HSPEXP/StartUp.vb
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ Public Class StartUp
chkDO.Enabled = False
chkHeat.Checked = False
chkHeat.Enabled = False
txtRCH.Enabled = False

Else
chkRunHSPF.Enabled = True
Expand Down
Loading

0 comments on commit 430a4d4

Please sign in to comment.