diff --git a/HSPEXP/HSPEXP+-D4EM10_common.vbproj b/HSPEXP/HSPEXP+-D4EM10_common.vbproj index 26ed89d92..1360a86e7 100644 --- a/HSPEXP/HSPEXP+-D4EM10_common.vbproj +++ b/HSPEXP/HSPEXP+-D4EM10_common.vbproj @@ -47,7 +47,7 @@ index.htm false 0 - 1.30.0.0 + 2.0.0.0 false true true diff --git a/HSPEXP/HSPFOutputReports.vb b/HSPEXP/HSPFOutputReports.vb index 55a560443..e4a8921d0 100644 --- a/HSPEXP/HSPFOutputReports.vb +++ b/HSPEXP/HSPFOutputReports.vb @@ -91,10 +91,28 @@ Module HSPFOutputReports pConstituents.Add("Heat") End If - - If StartUp.chkFecalColiform.Checked Then - pConstituents.Add("FColi") + If StartUp.chkGQUAL1.Checked Then + pConstituents.Add(StartUp.chkGQUAL1.Text & "-1") + End If + If StartUp.chkGQUAL2.Checked Then + pConstituents.Add(StartUp.chkGQUAL2.Text & "-2") + End If + If StartUp.chkGQUAL3.Checked Then + pConstituents.Add(StartUp.chkGQUAL3.Text & "-3") + End If + If StartUp.chkGQUAL4.Checked Then + pConstituents.Add(StartUp.chkGQUAL4.Text & "-4") + End If + If StartUp.chkGQUAL5.Checked Then + pConstituents.Add(StartUp.chkGQUAL5.Text & "-5") + End If + If StartUp.chkGQUAL6.Checked Then + pConstituents.Add(StartUp.chkGQUAL6.Text & "-6") + End If + If StartUp.chkGQUAL7.Checked Then + pConstituents.Add(StartUp.chkGQUAL7.Text & "-7") End If + 'set up the timeseries attributes for statistics atcTimeseriesStatistics.atcTimeseriesStatistics.InitializeShared() @@ -442,6 +460,7 @@ Module HSPFOutputReports Dim lConstituentName As String = "" Dim lActiveSections As New List(Of String) Dim CheckQUALID As Boolean = False + Dim lGQALID As Integer = 0 Select Case lConstituent Case "Water" lConstituentName = "WAT" @@ -491,29 +510,18 @@ Module HSPFOutputReports lActiveSections.Add("OXRX") lActiveSections.Add("NUTRX") lActiveSections.Add("PLANK") - Case "FColi" - lConstituentName = "FColi" + Case Else + lGQALID = Right(lConstituent, 1) + lConstituentName = SafeSubstring(lConstituent, 0, lConstituent.Length - 2) + lConstProperties = Utility.LocateConstituentNames(aHspfUci, lConstituentName, lGQALID) lActiveSections.Add("PQUAL") lActiveSections.Add("IQUAL") 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 - ' 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 - - ' ConstituentForAnalysis = Left(ConstituentForAnalysis, ConstituentForAnalysis.Length - 1) - ' End If - ' lScenarioResults.DataSets.Add(atcDataManager.DataSets.FindData("Constituent", ConstituentForAnalysis)) - - ' Next - - 'End If - + If lScenarioResults.DataSets.Count = 0 Then For Each activeSection As String In lActiveSections lScenarioResults.DataSets.Add(atcDataManager.DataSets.FindData("Section", activeSection)) @@ -527,13 +535,15 @@ Module HSPFOutputReports lReportCons = Nothing Dim lOutFileName As String = "" - LandLoadingReports(loutfoldername, lScenarioResults, aHspfUci, pBaseName, lRunMade, lConstituent, lConstProperties, SDateJ, EDateJ) - ReachBudgetReports(loutfoldername, lScenarioResults, aHspfUci, pBaseName, lRunMade, lConstituent, lConstProperties, SDateJ, EDateJ) + LandLoadingReports(loutfoldername, lScenarioResults, aHspfUci, pBaseName, lRunMade, lConstituentName, lConstProperties, SDateJ, EDateJ, lGQALID) + ReachBudgetReports(loutfoldername, lScenarioResults, aHspfUci, pBaseName, lRunMade, lConstituentName, lConstProperties, SDateJ, EDateJ, lGQALID) Logger.Status(Now & " Generating Reports for " & lConstituent) Logger.Dbg(Now & " Generating Reports for " & lConstituent) lReportCons = Nothing - If Not (lConstituent = "DO" Or lConstituent = "Heat" Or lConstituent = "BOD-Labile") Then + If lConstituent = "TotalN" OrElse lConstituent = "TotalP" OrElse + lConstituent = "Sediment" OrElse lConstituent = "Water" Then + With HspfSupport.ConstituentBudget.Report(aHspfUci, lConstituent, lOperationTypes, pBaseName, lScenarioResults, pOutputLocations, lRunMade, SDateJ, EDateJ, lConstProperties) lReportCons = .Item1 @@ -605,8 +615,8 @@ Module HSPFOutputReports Else - Logger.Dbg("The HBN file didn't have any data for the constituent " & lConstituent & " therefore the balance reports for " & - lConstituent & " will not be generated. Make sure that HSPF run completed last time.") + Logger.Dbg("The HBN file didn't have any data for the constituent " & lConstituent & " therefore the balance reports for " & + lConstituent & " will not be generated. Make sure that HSPF run completed last time.") Dim ans As Integer ans = MsgBox("HBN files do not have any data. Constituent Balance reports will not be generated. " & "Did uci file run properly last time?") diff --git a/HSPEXP/My Project/AssemblyInfo.vb b/HSPEXP/My Project/AssemblyInfo.vb index 674c8248b..08f71d9a5 100644 --- a/HSPEXP/My Project/AssemblyInfo.vb +++ b/HSPEXP/My Project/AssemblyInfo.vb @@ -32,6 +32,6 @@ Imports System.Runtime.InteropServices ' by using the '*' as shown below: ' - - + + diff --git a/HSPEXP/SetUpScript.iss b/HSPEXP/SetUpScript.iss index b3e6b8a47..df1fb301e 100644 --- a/HSPEXP/SetUpScript.iss +++ b/HSPEXP/SetUpScript.iss @@ -2,7 +2,7 @@ ; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES! #define MyAppName "HSPEXP+" -#define MyAppVersion "1.40beta7" +#define MyAppVersion "2.00beta" #define MyAppPublisher "RESPEC" #define MyAppURL "http://www.respec.com/product/hspexp/" #define MyAppExeName "HSPEXP+.exe" @@ -21,7 +21,7 @@ AppSupportURL={#MyAppURL} AppUpdatesURL={#MyAppURL} DefaultDirName={reg:HKLM\SOFTWARE\RESPEC\BASINS41,Base Directory|{pf}\HSPEXP+} DefaultGroupName={#MyAppName} -OutputBaseFilename=HSPEXP+1.40beta7SetUp +OutputBaseFilename=HSPEXP+2.00betaSetUp Compression=lzma SolidCompression=yes InfoBeforeFile=install.txt diff --git a/HSPEXP/SplashScreen1.vb b/HSPEXP/SplashScreen1.vb index fee7084e4..74799b649 100644 --- a/HSPEXP/SplashScreen1.vb +++ b/HSPEXP/SplashScreen1.vb @@ -27,7 +27,7 @@ ' Version.Text = System.String.Format(Version.Text, My.Application.Info.Version.Major, My.Application.Info.Version.Minor, My.Application.Info.Version.Build, My.Application.Info.Version.Revision) With My.Application.Info.Version - Version.Text = "Version " & .Major & "." & .Minor & " beta7" + Version.Text = "Version " & .Major & "." & .Minor & " beta" If .MajorRevision > 0 OrElse .MinorRevision > 0 Then Version.Text &= "." & .MajorRevision & "." & .MinorRevision End If diff --git a/HSPEXP/StartUp.Designer.vb b/HSPEXP/StartUp.Designer.vb index c6388420f..a853e7b31 100644 --- a/HSPEXP/StartUp.Designer.vb +++ b/HSPEXP/StartUp.Designer.vb @@ -34,17 +34,8 @@ Partial Class StartUp Me.chkAreaReports = New System.Windows.Forms.CheckBox() Me.chkRunHSPF = New System.Windows.Forms.CheckBox() Me.pnlHighlight = New System.Windows.Forms.Panel() - Me.chkWaterBalance = New System.Windows.Forms.CheckBox() - Me.chkSedimentBalance = New System.Windows.Forms.CheckBox() - Me.chkFecalColiform = New System.Windows.Forms.CheckBox() - Me.chkBODBalance = New System.Windows.Forms.CheckBox() - Me.chkTotalPhosphorus = New System.Windows.Forms.CheckBox() - Me.chkTotalNitrogen = New System.Windows.Forms.CheckBox() Me.chkAdditionalgraphs = New System.Windows.Forms.CheckBox() Me.btn_help = New System.Windows.Forms.Button() - Me.GroupBox2 = New System.Windows.Forms.GroupBox() - Me.chkHeat = New System.Windows.Forms.CheckBox() - Me.chkDO = New System.Windows.Forms.CheckBox() Me.cmbUCIPath = New System.Windows.Forms.ComboBox() Me.DateTimePicker1 = New System.Windows.Forms.DateTimePicker() Me.DateTimePicker2 = New System.Windows.Forms.DateTimePicker() @@ -56,9 +47,24 @@ Partial Class StartUp Me.ttHSPEXP = New System.Windows.Forms.ToolTip(Me.components) Me.chkExpertStats = New System.Windows.Forms.CheckBox() Me.chkMultiSim = New System.Windows.Forms.CheckBox() - Me.GroupBox2.SuspendLayout() + Me.chkTotalNitrogen = New System.Windows.Forms.CheckBox() + Me.chkSedimentBalance = New System.Windows.Forms.CheckBox() + Me.chkWaterBalance = New System.Windows.Forms.CheckBox() + Me.chkTotalPhosphorus = New System.Windows.Forms.CheckBox() + Me.chkBODBalance = New System.Windows.Forms.CheckBox() + Me.chkGQUAL1 = New System.Windows.Forms.CheckBox() + Me.chkDO = New System.Windows.Forms.CheckBox() + Me.chkHeat = New System.Windows.Forms.CheckBox() + Me.chkGQUAL2 = New System.Windows.Forms.CheckBox() + Me.chkGQUAL3 = New System.Windows.Forms.CheckBox() + Me.GroupBox2 = New System.Windows.Forms.GroupBox() + Me.chkGQUAL4 = New System.Windows.Forms.CheckBox() + Me.chkGQUAL5 = New System.Windows.Forms.CheckBox() + Me.chkGQUAL6 = New System.Windows.Forms.CheckBox() + Me.chkGQUAL7 = New System.Windows.Forms.CheckBox() Me.GroupBox3.SuspendLayout() Me.Plotting.SuspendLayout() + Me.GroupBox2.SuspendLayout() Me.SuspendLayout() ' 'cmdStart @@ -66,7 +72,7 @@ Partial Class StartUp Me.cmdStart.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) Me.cmdStart.DialogResult = System.Windows.Forms.DialogResult.OK Me.cmdStart.Enabled = False - Me.cmdStart.Location = New System.Drawing.Point(326, 578) + Me.cmdStart.Location = New System.Drawing.Point(326, 594) Me.cmdStart.Name = "cmdStart" Me.cmdStart.Size = New System.Drawing.Size(75, 23) Me.cmdStart.TabIndex = 20 @@ -97,7 +103,7 @@ Partial Class StartUp ' Me.lblRCH.AutoSize = True Me.lblRCH.Enabled = False - Me.lblRCH.Location = New System.Drawing.Point(18, 518) + Me.lblRCH.Location = New System.Drawing.Point(20, 537) Me.lblRCH.MaximumSize = New System.Drawing.Size(500, 0) Me.lblRCH.Name = "lblRCH" Me.lblRCH.Size = New System.Drawing.Size(391, 13) @@ -109,7 +115,7 @@ Partial Class StartUp ' Me.txtRCH.BackColor = System.Drawing.SystemColors.Window Me.txtRCH.Enabled = False - Me.txtRCH.Location = New System.Drawing.Point(23, 542) + Me.txtRCH.Location = New System.Drawing.Point(25, 561) Me.txtRCH.Name = "txtRCH" Me.txtRCH.Size = New System.Drawing.Size(47, 20) Me.txtRCH.TabIndex = 19 @@ -120,7 +126,7 @@ Partial Class StartUp ' Me.lblOutReach2.AutoSize = True Me.lblOutReach2.Enabled = False - Me.lblOutReach2.Location = New System.Drawing.Point(81, 545) + Me.lblOutReach2.Location = New System.Drawing.Point(83, 564) Me.lblOutReach2.MaximumSize = New System.Drawing.Size(400, 0) Me.lblOutReach2.Name = "lblOutReach2" Me.lblOutReach2.Size = New System.Drawing.Size(359, 13) @@ -131,7 +137,7 @@ Partial Class StartUp ' Me.cmdEnd.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) Me.cmdEnd.DialogResult = System.Windows.Forms.DialogResult.Cancel - Me.cmdEnd.Location = New System.Drawing.Point(407, 578) + Me.cmdEnd.Location = New System.Drawing.Point(407, 594) Me.cmdEnd.Name = "cmdEnd" Me.cmdEnd.Size = New System.Drawing.Size(75, 23) Me.cmdEnd.TabIndex = 21 @@ -168,77 +174,11 @@ Partial Class StartUp ' Me.pnlHighlight.BackColor = System.Drawing.Color.Red Me.pnlHighlight.Enabled = False - Me.pnlHighlight.Location = New System.Drawing.Point(17, 538) + Me.pnlHighlight.Location = New System.Drawing.Point(19, 557) Me.pnlHighlight.Name = "pnlHighlight" Me.pnlHighlight.Size = New System.Drawing.Size(58, 28) Me.pnlHighlight.TabIndex = 17 ' - 'chkWaterBalance - ' - Me.chkWaterBalance.AutoSize = True - Me.chkWaterBalance.Enabled = False - Me.chkWaterBalance.Location = New System.Drawing.Point(6, 19) - Me.chkWaterBalance.Name = "chkWaterBalance" - Me.chkWaterBalance.Size = New System.Drawing.Size(55, 17) - Me.chkWaterBalance.TabIndex = 11 - Me.chkWaterBalance.Text = "Water" - Me.chkWaterBalance.UseVisualStyleBackColor = True - ' - 'chkSedimentBalance - ' - Me.chkSedimentBalance.AutoSize = True - Me.chkSedimentBalance.Enabled = False - Me.chkSedimentBalance.Location = New System.Drawing.Point(6, 42) - Me.chkSedimentBalance.Name = "chkSedimentBalance" - Me.chkSedimentBalance.Size = New System.Drawing.Size(70, 17) - Me.chkSedimentBalance.TabIndex = 12 - Me.chkSedimentBalance.Text = "Sediment" - Me.chkSedimentBalance.UseVisualStyleBackColor = True - ' - 'chkFecalColiform - ' - Me.chkFecalColiform.AutoSize = True - Me.chkFecalColiform.Enabled = False - Me.chkFecalColiform.Location = New System.Drawing.Point(248, 65) - Me.chkFecalColiform.Name = "chkFecalColiform" - Me.chkFecalColiform.Size = New System.Drawing.Size(109, 17) - Me.chkFecalColiform.TabIndex = 18 - Me.chkFecalColiform.Text = "Indicator Bacteria" - Me.chkFecalColiform.UseVisualStyleBackColor = True - ' - 'chkBODBalance - ' - Me.chkBODBalance.AutoSize = True - Me.chkBODBalance.Enabled = False - Me.chkBODBalance.Location = New System.Drawing.Point(6, 111) - Me.chkBODBalance.Name = "chkBODBalance" - Me.chkBODBalance.Size = New System.Drawing.Size(80, 17) - Me.chkBODBalance.TabIndex = 15 - Me.chkBODBalance.Text = "BOD-Labile" - Me.chkBODBalance.UseVisualStyleBackColor = True - ' - 'chkTotalPhosphorus - ' - Me.chkTotalPhosphorus.AutoSize = True - Me.chkTotalPhosphorus.Enabled = False - Me.chkTotalPhosphorus.Location = New System.Drawing.Point(6, 88) - Me.chkTotalPhosphorus.Name = "chkTotalPhosphorus" - Me.chkTotalPhosphorus.Size = New System.Drawing.Size(109, 17) - Me.chkTotalPhosphorus.TabIndex = 14 - Me.chkTotalPhosphorus.Text = "Total Phosphorus" - Me.chkTotalPhosphorus.UseVisualStyleBackColor = True - ' - 'chkTotalNitrogen - ' - Me.chkTotalNitrogen.AutoSize = True - Me.chkTotalNitrogen.Enabled = False - Me.chkTotalNitrogen.Location = New System.Drawing.Point(6, 65) - Me.chkTotalNitrogen.Name = "chkTotalNitrogen" - Me.chkTotalNitrogen.Size = New System.Drawing.Size(93, 17) - Me.chkTotalNitrogen.TabIndex = 13 - Me.chkTotalNitrogen.Text = "Total Nitrogen" - Me.chkTotalNitrogen.UseVisualStyleBackColor = True - ' 'chkAdditionalgraphs ' Me.chkAdditionalgraphs.AutoSize = True @@ -262,45 +202,6 @@ Partial Class StartUp Me.btn_help.Text = "Help" Me.btn_help.UseVisualStyleBackColor = True ' - 'GroupBox2 - ' - Me.GroupBox2.Controls.Add(Me.chkHeat) - Me.GroupBox2.Controls.Add(Me.chkDO) - Me.GroupBox2.Controls.Add(Me.chkFecalColiform) - Me.GroupBox2.Controls.Add(Me.chkBODBalance) - Me.GroupBox2.Controls.Add(Me.chkTotalPhosphorus) - Me.GroupBox2.Controls.Add(Me.chkWaterBalance) - Me.GroupBox2.Controls.Add(Me.chkSedimentBalance) - Me.GroupBox2.Controls.Add(Me.chkTotalNitrogen) - Me.GroupBox2.Location = New System.Drawing.Point(18, 343) - Me.GroupBox2.Name = "GroupBox2" - Me.GroupBox2.Size = New System.Drawing.Size(442, 147) - Me.GroupBox2.TabIndex = 10 - Me.GroupBox2.TabStop = False - Me.GroupBox2.Text = "Constituent Balance Reports" - Me.ttHSPEXP.SetToolTip(Me.GroupBox2, "This following reports require binary output to be at a monthly or shorter interv" & - "al.") - ' - 'chkHeat - ' - Me.chkHeat.AutoSize = True - Me.chkHeat.Location = New System.Drawing.Point(248, 42) - Me.chkHeat.Name = "chkHeat" - Me.chkHeat.Size = New System.Drawing.Size(49, 17) - Me.chkHeat.TabIndex = 17 - Me.chkHeat.Text = "Heat" - Me.chkHeat.UseVisualStyleBackColor = True - ' - 'chkDO - ' - Me.chkDO.AutoSize = True - Me.chkDO.Location = New System.Drawing.Point(248, 19) - Me.chkDO.Name = "chkDO" - Me.chkDO.Size = New System.Drawing.Size(111, 17) - Me.chkDO.TabIndex = 16 - Me.chkDO.Text = "Dissolved Oxygen" - Me.chkDO.UseVisualStyleBackColor = True - ' 'cmbUCIPath ' Me.cmbUCIPath.AllowDrop = True @@ -418,13 +319,183 @@ Partial Class StartUp "e, a default specification file will be generated,") Me.chkMultiSim.UseVisualStyleBackColor = True ' + 'chkTotalNitrogen + ' + Me.chkTotalNitrogen.AutoSize = True + Me.chkTotalNitrogen.Enabled = False + Me.chkTotalNitrogen.Location = New System.Drawing.Point(6, 65) + Me.chkTotalNitrogen.Name = "chkTotalNitrogen" + Me.chkTotalNitrogen.Size = New System.Drawing.Size(93, 17) + Me.chkTotalNitrogen.TabIndex = 13 + Me.chkTotalNitrogen.Text = "Total Nitrogen" + Me.chkTotalNitrogen.UseVisualStyleBackColor = True + ' + 'chkSedimentBalance + ' + Me.chkSedimentBalance.AutoSize = True + Me.chkSedimentBalance.Enabled = False + Me.chkSedimentBalance.Location = New System.Drawing.Point(6, 42) + Me.chkSedimentBalance.Name = "chkSedimentBalance" + Me.chkSedimentBalance.Size = New System.Drawing.Size(70, 17) + Me.chkSedimentBalance.TabIndex = 12 + Me.chkSedimentBalance.Text = "Sediment" + Me.chkSedimentBalance.UseVisualStyleBackColor = True + ' + 'chkWaterBalance + ' + Me.chkWaterBalance.AutoSize = True + Me.chkWaterBalance.Enabled = False + Me.chkWaterBalance.Location = New System.Drawing.Point(6, 19) + Me.chkWaterBalance.Name = "chkWaterBalance" + Me.chkWaterBalance.Size = New System.Drawing.Size(55, 17) + Me.chkWaterBalance.TabIndex = 11 + Me.chkWaterBalance.Text = "Water" + Me.chkWaterBalance.UseVisualStyleBackColor = True + ' + 'chkTotalPhosphorus + ' + Me.chkTotalPhosphorus.AutoSize = True + Me.chkTotalPhosphorus.Enabled = False + Me.chkTotalPhosphorus.Location = New System.Drawing.Point(6, 88) + Me.chkTotalPhosphorus.Name = "chkTotalPhosphorus" + Me.chkTotalPhosphorus.Size = New System.Drawing.Size(109, 17) + Me.chkTotalPhosphorus.TabIndex = 14 + Me.chkTotalPhosphorus.Text = "Total Phosphorus" + Me.chkTotalPhosphorus.UseVisualStyleBackColor = True + ' + 'chkBODBalance + ' + Me.chkBODBalance.AutoSize = True + Me.chkBODBalance.Enabled = False + Me.chkBODBalance.Location = New System.Drawing.Point(6, 111) + Me.chkBODBalance.Name = "chkBODBalance" + Me.chkBODBalance.Size = New System.Drawing.Size(80, 17) + Me.chkBODBalance.TabIndex = 15 + Me.chkBODBalance.Text = "BOD-Labile" + Me.chkBODBalance.UseVisualStyleBackColor = True + ' + 'chkGQUAL1 + ' + Me.chkGQUAL1.AutoSize = True + Me.chkGQUAL1.Location = New System.Drawing.Point(246, 19) + Me.chkGQUAL1.Name = "chkGQUAL1" + Me.chkGQUAL1.Size = New System.Drawing.Size(69, 17) + Me.chkGQUAL1.TabIndex = 18 + Me.chkGQUAL1.Text = "GQUAL1" + Me.chkGQUAL1.UseVisualStyleBackColor = True + ' + 'chkDO + ' + Me.chkDO.AutoSize = True + Me.chkDO.Location = New System.Drawing.Point(6, 134) + Me.chkDO.Name = "chkDO" + Me.chkDO.Size = New System.Drawing.Size(111, 17) + Me.chkDO.TabIndex = 16 + Me.chkDO.Text = "Dissolved Oxygen" + Me.chkDO.UseVisualStyleBackColor = True + ' + 'chkHeat + ' + Me.chkHeat.AutoSize = True + Me.chkHeat.Location = New System.Drawing.Point(6, 155) + Me.chkHeat.Name = "chkHeat" + Me.chkHeat.Size = New System.Drawing.Size(49, 17) + Me.chkHeat.TabIndex = 17 + Me.chkHeat.Text = "Heat" + Me.chkHeat.UseVisualStyleBackColor = True + ' + 'chkGQUAL2 + ' + Me.chkGQUAL2.AutoSize = True + Me.chkGQUAL2.Location = New System.Drawing.Point(246, 42) + Me.chkGQUAL2.Name = "chkGQUAL2" + Me.chkGQUAL2.Size = New System.Drawing.Size(69, 17) + Me.chkGQUAL2.TabIndex = 19 + Me.chkGQUAL2.Text = "GQUAL2" + Me.chkGQUAL2.UseVisualStyleBackColor = True + ' + 'chkGQUAL3 + ' + Me.chkGQUAL3.AutoSize = True + Me.chkGQUAL3.Location = New System.Drawing.Point(246, 65) + Me.chkGQUAL3.Name = "chkGQUAL3" + Me.chkGQUAL3.Size = New System.Drawing.Size(69, 17) + Me.chkGQUAL3.TabIndex = 20 + Me.chkGQUAL3.Text = "GQUAL3" + Me.chkGQUAL3.UseVisualStyleBackColor = True + ' + 'GroupBox2 + ' + Me.GroupBox2.Controls.Add(Me.chkGQUAL7) + Me.GroupBox2.Controls.Add(Me.chkGQUAL6) + Me.GroupBox2.Controls.Add(Me.chkGQUAL5) + Me.GroupBox2.Controls.Add(Me.chkGQUAL4) + Me.GroupBox2.Controls.Add(Me.chkGQUAL3) + Me.GroupBox2.Controls.Add(Me.chkGQUAL2) + Me.GroupBox2.Controls.Add(Me.chkHeat) + Me.GroupBox2.Controls.Add(Me.chkDO) + Me.GroupBox2.Controls.Add(Me.chkGQUAL1) + Me.GroupBox2.Controls.Add(Me.chkBODBalance) + Me.GroupBox2.Controls.Add(Me.chkTotalPhosphorus) + Me.GroupBox2.Controls.Add(Me.chkWaterBalance) + Me.GroupBox2.Controls.Add(Me.chkSedimentBalance) + Me.GroupBox2.Controls.Add(Me.chkTotalNitrogen) + Me.GroupBox2.Location = New System.Drawing.Point(18, 343) + Me.GroupBox2.Name = "GroupBox2" + Me.GroupBox2.Size = New System.Drawing.Size(442, 179) + Me.GroupBox2.TabIndex = 10 + Me.GroupBox2.TabStop = False + Me.GroupBox2.Text = "Constituent Balance Reports" + Me.ttHSPEXP.SetToolTip(Me.GroupBox2, "This following reports require binary output to be at a monthly or shorter interv" & + "al.") + ' + 'chkGQUAL4 + ' + Me.chkGQUAL4.AutoSize = True + Me.chkGQUAL4.Location = New System.Drawing.Point(246, 88) + Me.chkGQUAL4.Name = "chkGQUAL4" + Me.chkGQUAL4.Size = New System.Drawing.Size(69, 17) + Me.chkGQUAL4.TabIndex = 21 + Me.chkGQUAL4.Text = "GQUAL4" + Me.chkGQUAL4.UseVisualStyleBackColor = True + ' + 'chkGQUAL5 + ' + Me.chkGQUAL5.AutoSize = True + Me.chkGQUAL5.Location = New System.Drawing.Point(246, 111) + Me.chkGQUAL5.Name = "chkGQUAL5" + Me.chkGQUAL5.Size = New System.Drawing.Size(69, 17) + Me.chkGQUAL5.TabIndex = 22 + Me.chkGQUAL5.Text = "GQUAL5" + Me.chkGQUAL5.UseVisualStyleBackColor = True + ' + 'chkGQUAL6 + ' + Me.chkGQUAL6.AutoSize = True + Me.chkGQUAL6.Location = New System.Drawing.Point(246, 134) + Me.chkGQUAL6.Name = "chkGQUAL6" + Me.chkGQUAL6.Size = New System.Drawing.Size(69, 17) + Me.chkGQUAL6.TabIndex = 23 + Me.chkGQUAL6.Text = "GQUAL6" + Me.chkGQUAL6.UseVisualStyleBackColor = True + ' + 'chkGQUAL7 + ' + Me.chkGQUAL7.AutoSize = True + Me.chkGQUAL7.Location = New System.Drawing.Point(246, 155) + Me.chkGQUAL7.Name = "chkGQUAL7" + Me.chkGQUAL7.Size = New System.Drawing.Size(69, 17) + Me.chkGQUAL7.TabIndex = 24 + Me.chkGQUAL7.Text = "GQUAL7" + Me.chkGQUAL7.UseVisualStyleBackColor = True + ' 'StartUp ' Me.AcceptButton = Me.cmdStart Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font Me.CancelButton = Me.cmdEnd - Me.ClientSize = New System.Drawing.Size(493, 618) + Me.ClientSize = New System.Drawing.Size(493, 634) Me.Controls.Add(Me.chkMultiSim) Me.Controls.Add(Me.chkExpertStats) Me.Controls.Add(Me.Plotting) @@ -449,12 +520,12 @@ Partial Class StartUp Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen Me.Text = "HSPEXP+ " Me.TransparencyKey = System.Drawing.SystemColors.ActiveBorder - Me.GroupBox2.ResumeLayout(False) - Me.GroupBox2.PerformLayout() Me.GroupBox3.ResumeLayout(False) Me.GroupBox3.PerformLayout() Me.Plotting.ResumeLayout(False) Me.Plotting.PerformLayout() + Me.GroupBox2.ResumeLayout(False) + Me.GroupBox2.PerformLayout() Me.ResumeLayout(False) Me.PerformLayout() @@ -469,15 +540,8 @@ Partial Class StartUp Friend WithEvents chkAreaReports As System.Windows.Forms.CheckBox Friend WithEvents chkRunHSPF As System.Windows.Forms.CheckBox Friend WithEvents pnlHighlight As System.Windows.Forms.Panel - Friend WithEvents chkWaterBalance As System.Windows.Forms.CheckBox - Friend WithEvents chkSedimentBalance As System.Windows.Forms.CheckBox - Friend WithEvents chkTotalNitrogen As System.Windows.Forms.CheckBox - Friend WithEvents chkTotalPhosphorus As System.Windows.Forms.CheckBox - Friend WithEvents chkBODBalance As System.Windows.Forms.CheckBox - Friend WithEvents chkFecalColiform As System.Windows.Forms.CheckBox Friend WithEvents chkAdditionalgraphs As System.Windows.Forms.CheckBox Friend WithEvents btn_help As System.Windows.Forms.Button - Friend WithEvents GroupBox2 As System.Windows.Forms.GroupBox Friend WithEvents cmbUCIPath As System.Windows.Forms.ComboBox Friend WithEvents DateTimePicker1 As System.Windows.Forms.DateTimePicker Friend WithEvents DateTimePicker2 As System.Windows.Forms.DateTimePicker @@ -489,6 +553,19 @@ Partial Class StartUp Friend WithEvents ttHSPEXP As ToolTip Friend WithEvents chkExpertStats As CheckBox Friend WithEvents chkMultiSim As CheckBox + Friend WithEvents chkTotalNitrogen As CheckBox + Friend WithEvents chkSedimentBalance As CheckBox + Friend WithEvents chkWaterBalance As CheckBox + Friend WithEvents chkTotalPhosphorus As CheckBox + Friend WithEvents chkBODBalance As CheckBox + Friend WithEvents chkGQUAL1 As CheckBox Friend WithEvents chkDO As CheckBox Friend WithEvents chkHeat As CheckBox + Friend WithEvents chkGQUAL2 As CheckBox + Friend WithEvents chkGQUAL3 As CheckBox + Friend WithEvents GroupBox2 As GroupBox + Friend WithEvents chkGQUAL7 As CheckBox + Friend WithEvents chkGQUAL6 As CheckBox + Friend WithEvents chkGQUAL5 As CheckBox + Friend WithEvents chkGQUAL4 As CheckBox End Class diff --git a/HSPEXP/StartUp.vb b/HSPEXP/StartUp.vb index 1d809cf2e..b2d77d408 100644 --- a/HSPEXP/StartUp.vb +++ b/HSPEXP/StartUp.vb @@ -60,7 +60,20 @@ Public Class StartUp lblOutReach2.Enabled = lExists pnlHighlight.Enabled = lExists cmdStart.Enabled = lExists - + chkGQUAL1.Visible = False + chkGQUAL2.Visible = False + chkGQUAL3.Visible = False + chkGQUAL4.Visible = False + chkGQUAL5.Visible = False + chkGQUAL6.Visible = False + chkGQUAL7.Visible = False + chkGQUAL1.Enabled = False + chkGQUAL2.Enabled = False + chkGQUAL3.Enabled = False + chkGQUAL4.Enabled = False + chkGQUAL5.Enabled = False + chkGQUAL6.Enabled = False + chkGQUAL7.Enabled = False Dim lUCI As String = cmbUCIPath.Text @@ -78,6 +91,51 @@ Public Class StartUp DateTimePicker1.Value = System.DateTime.FromOADate(lSDateJ) DateTimePicker2.Value = System.DateTime.FromOADate(lEDateJ - 1) + + 'list of available gquals + If pUci.OpnBlks("RCHRES").Ids(0).TableExists("GQ-QALDATA") Then + chkGQUAL1.Text = pUci.OpnBlks("RCHRES").Ids(0).Tables("GQ-QALDATA").ParmValue("GQID") + chkGQUAL1.Tag = pUci.OpnBlks("RCHRES").Ids(0).Tables("GQ-QALDATA").ParmValue("QTYID") + chkGQUAL1.Enabled = True + chkGQUAL1.Visible = True + End If + If pUci.OpnBlks("RCHRES").Ids(0).TableExists("GQ-QALDATA:2") Then + chkGQUAL2.Text = pUci.OpnBlks("RCHRES").Ids(0).Tables("GQ-QALDATA:2").ParmValue("GQID") + chkGQUAL2.Tag = pUci.OpnBlks("RCHRES").Ids(0).Tables("GQ-QALDATA:2").ParmValue("QTYID") + chkGQUAL2.Enabled = True + chkGQUAL2.Visible = True + End If + If pUci.OpnBlks("RCHRES").Ids(0).TableExists("GQ-QALDATA:3") Then + chkGQUAL3.Text = pUci.OpnBlks("RCHRES").Ids(0).Tables("GQ-QALDATA:3").ParmValue("GQID") + chkGQUAL3.Tag = pUci.OpnBlks("RCHRES").Ids(0).Tables("GQ-QALDATA:3").ParmValue("QTYID") + chkGQUAL3.Enabled = True + chkGQUAL3.Visible = True + End If + If pUci.OpnBlks("RCHRES").Ids(0).TableExists("GQ-QALDATA:4") Then + chkGQUAL4.Text = pUci.OpnBlks("RCHRES").Ids(0).Tables("GQ-QALDATA:4").ParmValue("GQID") + chkGQUAL4.Tag = pUci.OpnBlks("RCHRES").Ids(0).Tables("GQ-QALDATA:4").ParmValue("QTYID") + chkGQUAL4.Enabled = True + chkGQUAL4.Visible = True + End If + If pUci.OpnBlks("RCHRES").Ids(0).TableExists("GQ-QALDATA:5") Then + chkGQUAL5.Text = pUci.OpnBlks("RCHRES").Ids(0).Tables("GQ-QALDATA:5").ParmValue("GQID") + chkGQUAL5.Tag = pUci.OpnBlks("RCHRES").Ids(0).Tables("GQ-QALDATA:5").ParmValue("QTYID") + chkGQUAL5.Enabled = True + chkGQUAL5.Visible = True + End If + If pUci.OpnBlks("RCHRES").Ids(0).TableExists("GQ-QALDATA:6") Then + chkGQUAL6.Text = pUci.OpnBlks("RCHRES").Ids(0).Tables("GQ-QALDATA:6").ParmValue("GQID") + chkGQUAL6.Tag = pUci.OpnBlks("RCHRES").Ids(0).Tables("GQ-QALDATA:6").ParmValue("QTYID") + chkGQUAL6.Enabled = True + chkGQUAL6.Visible = True + End If + If pUci.OpnBlks("RCHRES").Ids(0).TableExists("GQ-QALDATA:7") Then + chkGQUAL7.Text = pUci.OpnBlks("RCHRES").Ids(0).Tables("GQ-QALDATA:7").ParmValue("GQID") + chkGQUAL7.Tag = pUci.OpnBlks("RCHRES").Ids(0).Tables("GQ-QALDATA:7").ParmValue("QTYID") + chkGQUAL7.Enabled = True + chkGQUAL7.Visible = True + End If + Catch ex As Exception Logger.Msg("HSPEXP+ had trouble opening " & lUCI, MsgBoxStyle.Critical, "UCI Reading Issue!") pUci = Nothing @@ -99,13 +157,20 @@ Public Class StartUp End Sub - Private Sub chkConstituentReportChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles chkWaterBalance.CheckedChanged, chkSedimentBalance.CheckedChanged, chkTotalNitrogen.CheckedChanged, chkTotalPhosphorus.CheckedChanged, chkBODBalance.CheckedChanged, chkFecalColiform.CheckedChanged + Private Sub chkConstituentReportChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles chkWaterBalance.CheckedChanged, chkSedimentBalance.CheckedChanged, chkTotalNitrogen.CheckedChanged, chkTotalPhosphorus.CheckedChanged, chkBODBalance.CheckedChanged, + chkGQUAL1.CheckedChanged, chkGQUAL2.CheckedChanged, chkGQUAL3.CheckedChanged, chkGQUAL4.CheckedChanged, chkGQUAL5.CheckedChanged, chkGQUAL6.CheckedChanged, chkGQUAL7.CheckedChanged If chkWaterBalance.Checked OrElse chkSedimentBalance.Checked OrElse chkTotalNitrogen.Checked OrElse chkTotalPhosphorus.Checked OrElse chkBODBalance.Checked OrElse - chkFecalColiform.Checked Then + chkGQUAL1.Checked OrElse + chkGQUAL2.Checked OrElse + chkGQUAL3.Checked OrElse + chkGQUAL4.Checked OrElse + chkGQUAL5.Checked OrElse + chkGQUAL6.Checked OrElse + chkGQUAL7.Checked Then lblRCH.Enabled = True lblOutReach2.Enabled = True @@ -193,8 +258,8 @@ Public Class StartUp chkAdditionalgraphs.Checked = False chkBODBalance.Enabled = False chkBODBalance.Checked = False - chkFecalColiform.Checked = False - chkFecalColiform.Enabled = False + chkGQUAL1.Checked = False + chkGQUAL1.Enabled = False chkTotalNitrogen.Enabled = False chkTotalNitrogen.Checked = False chkTotalPhosphorus.Enabled = False @@ -207,6 +272,20 @@ Public Class StartUp chkDO.Enabled = False chkHeat.Checked = False chkHeat.Enabled = False + chkGQUAL1.Checked = False + chkGQUAL2.Checked = False + chkGQUAL3.Checked = False + chkGQUAL4.Checked = False + chkGQUAL5.Checked = False + chkGQUAL6.Checked = False + chkGQUAL7.Checked = False + chkGQUAL1.Enabled = False + chkGQUAL2.Enabled = False + chkGQUAL3.Enabled = False + chkGQUAL4.Enabled = False + chkGQUAL5.Enabled = False + chkGQUAL6.Enabled = False + chkGQUAL7.Enabled = False txtRCH.Enabled = False Else @@ -216,13 +295,19 @@ Public Class StartUp chkReganGraphs.Enabled = True chkAdditionalgraphs.Enabled = True chkBODBalance.Enabled = True - chkFecalColiform.Enabled = True chkTotalNitrogen.Enabled = True chkTotalPhosphorus.Enabled = True chkWaterBalance.Enabled = True chkSedimentBalance.Enabled = True chkDO.Enabled = True chkHeat.Enabled = True + chkGQUAL1.Enabled = True + chkGQUAL2.Enabled = True + chkGQUAL3.Enabled = True + chkGQUAL4.Enabled = True + chkGQUAL5.Enabled = True + chkGQUAL6.Enabled = True + chkGQUAL7.Enabled = True End If diff --git a/HSPEXP/install.txt b/HSPEXP/install.txt index d62918b48..549d1dd98 100644 --- a/HSPEXP/install.txt +++ b/HSPEXP/install.txt @@ -1,3 +1,20 @@ +HSPEXP+2.0.0beta +Date: 03/08/2018 +Features: +1. Multi Simulation Manager is available that can be used for sensitivity analysis, uncertainty analysis, and scenario analysis. +2. Reports for additional constituents including Heat, DO, BOD-Labile are also generated. +3. Reach Budget reports for N and P constituents are also generated. +4. Some reports are now generated so that they can be easily filtered in spreadhseet program as needed. +5. Monthly land loading reports are also generated. +6. Box-whisker plots of constituent loading by land use and box-whisker plots of monthly constituent loadings are also produced. +7. In the Regan plots, daily maximum and daily minimimum DO concentrations are plotted if hourly DO data is available in the binary files. +8. If GQUAL is simulated, then land loading and reach budget reports for all the GQUAL constituents are available. + +Bugs Fixed: +1. Multiple small bugs fixed. In general, the warning messages do not stop HSPEXP+ calculations. The warning messages are added in the log file. +2. HSPEXP+ calculations were made more efficient. + + HSPEXP+1.40beta7 Dated: 02/08/2018 Features: diff --git a/atcHspfSupport/atcConstituentTables.vb b/atcHspfSupport/atcConstituentTables.vb index 25630eed6..937fc9d19 100644 --- a/atcHspfSupport/atcConstituentTables.vb +++ b/atcHspfSupport/atcConstituentTables.vb @@ -13,8 +13,9 @@ Public Module atcConstituentTables ByVal aScenario As String, ByVal aRunMade As String, ByVal aBalanceType As String, - aConstProperties As List(Of ConstituentProperties), - aSDateJ As Double, aEDateJ As Double) + ByVal aConstProperties As List(Of ConstituentProperties), + ByVal aSDateJ As Double, ByVal aEDateJ As Double, + Optional ByVal aGQALID As Integer = 0) 'This Sub prepares a text report for constituents like TN and TP. Dim lReport As New atcReport.ReportText @@ -166,6 +167,7 @@ Public Module atcConstituentTables Dim lMasslinkFactor As Double = 1.0 If lOutflowDataType = "TotalOutflow" Then lTS = lTotalTS + If lTS Is Nothing Then Continue For Dim lTsMonthly As atcTimeseries = Aggregate(lTS, atcTimeUnit.TUMonth, 1, atcTran.TranSumDiv) Dim lSeasons As New atcSeasonsMonth Dim lSeasonalAttributes As New atcDataAttributes @@ -317,6 +319,7 @@ Public Module atcConstituentTables Dim lMasslinkFactor As Double = 1.0 If lOutflowDataType = "TotalOutflow" Then lTS = lTotalTS + If lTS.numValues = 0 Then Continue For Dim lTsMonthly As atcTimeseries = Aggregate(lTS, atcTimeUnit.TUMonth, 1, atcTran.TranSumDiv) Dim lSeasons As New atcSeasonsMonth Dim lSeasonalAttributes As New atcDataAttributes @@ -411,7 +414,7 @@ Public Module atcConstituentTables Dim lConversionFactor As Double = 1.0 If aUCI.GlobalBlock.EmFg = 1 Then lUnits = "lbs/ac" - lConversionFactor = 2240 + lConversionFactor = 2000 'English tons to lbs - US needs to move to SI units ElseIf aUCI.GlobalBlock.EmFg = 2 Then lUnits = "kgs/ha" lConversionFactor = 1000 @@ -461,6 +464,7 @@ Public Module atcConstituentTables Dim lMasslinkFactor As Double = 1.0 If lOutflowDataType = "TotalOutflow" Then lTS = lTotalTS + If lTS.numValues = 0 Then Continue For Dim lTsMonthly As atcTimeseries = Aggregate(lTS, atcTimeUnit.TUMonth, 1, atcTran.TranSumDiv) Dim lSeasons As New atcSeasonsMonth Dim lSeasonalAttributes As New atcDataAttributes @@ -551,8 +555,7 @@ Public Module atcConstituentTables #Region "Case Else" Case Else - Dim column As DataColumn - 'Dim columnMonthly As DataColumn + Dim column As DataColumn Dim row As DataRow column = New DataColumn() @@ -591,13 +594,8 @@ Public Module atcConstituentTables column.Caption = "Unit" Land_Constituent_Monthly_Table.Columns.Add(column) - Land_Constituent_Monthly_Table = AddMonthlyColumnsColumns(Land_Constituent_Monthly_Table) - 'column = New DataColumn() - 'column.DataType = Type.GetType("System.Double") - 'column.ColumnName = "ATDEP" - 'column.Caption = "Atmospheric Deposition" - 'QUALConstTable.Columns.Add(column) - + Land_Constituent_Monthly_Table = AddMonthlyColumnsColumns(Land_Constituent_Monthly_Table) + column = New DataColumn() column.DataType = Type.GetType("System.Double") column.ColumnName = "WASHQS" @@ -647,8 +645,8 @@ Public Module atcConstituentTables lOperationNameNumber.Add(LocationName) - landUseNameForTheCollection = lOperation.Name.Substring(0, 1) & ":" & lOperation.Description - 'Look at this. Do not want operation id with this + landUseNameForTheCollection = lOperation.Name.Substring(0, 1) & ":" & lOperation.Description + If Not listLanduses.Contains(landUseNameForTheCollection) Then listLanduses.Add(landUseNameForTheCollection) End If @@ -665,7 +663,8 @@ Public Module atcConstituentTables lConstituentNames.Add(constituent.ConstNameForEXPPlus) End If - Dim lOutflowDataTypes1 As Dictionary(Of String, String) = ConstituentList(aBalanceType, constituent.ConstituentNameInUCI, constituent.ConstNameForEXPPlus) + Dim lOutflowDataTypes1 As Dictionary(Of String, String) = ConstituentList(aBalanceType, constituent.ConstituentNameInUCI, + constituent.ConstNameForEXPPlus, False, lOperation.Name) Dim lTSNumber As Integer = 0 Dim lTS As New atcTimeseries(Nothing) Dim AddTS As New atcDataGroup @@ -674,6 +673,7 @@ Public Module atcConstituentTables Dim lMassLinkFactor As Double = 1.0 If lOutflowDataType.StartsWith("TotalOutflow") And lTotalTS.Dates IsNot Nothing Then lTS = lTotalTS + If lTS.numValues = 0 Then Continue For 'Start doing the montly calculations here. Dim lTsMonthly As atcTimeseries = Aggregate(lTS, atcTimeUnit.TUMonth, 1, atcTran.TranSumDiv) Dim lSeasons As New atcSeasonsMonth @@ -700,19 +700,22 @@ Public Module atcConstituentTables lTS = aBinaryData.DataSets.FindData("Location", LocationName).FindData("Constituent", lOutflowDataTypes1(lOutflowDataType))(0) If lTS Is Nothing Then Continue For + If lTS.Attributes.GetDefinedValue("Sum").Value = 0 Then Continue For lTS = SubsetByDate(lTS, aSDateJ, aEDateJ, Nothing) For Each lConnection As HspfConnection In lOperation.Targets If lConnection.Target.VolName = "RCHRES" Then Dim aReach As HspfOperation = aUCI.OpnBlks("RCHRES").OperFromID(lConnection.Target.VolId) Dim aConversionFactor As Double = 0.0 - aConversionFactor = ConversionFactorfromOxygen(aUCI, constituent.ReportType, aReach) + If aBalanceType = "TN" Or aBalanceType = "TP" Then + aConversionFactor = ConversionFactorfromOxygen(aUCI, constituent.ReportType, aReach) + End If Dim lMassLinkID As Integer = lConnection.MassLink If Not lMassLinkID = 0 Then lMassLinkFactor = FindMassLinkFactor(aUCI, lMassLinkID, lOutflowDataType, - constituent.ReportType, aConversionFactor, lMultipleIndex) + constituent.ReportType, aConversionFactor, lMultipleIndex, aGQALID) Exit For End If - + 'End If End If Next lConnection End If @@ -751,6 +754,7 @@ Public Module atcConstituentTables lYears.Add(Year) End If RowNumber += 1 + If lTSNumber = 0 Then row("OpTypeNumber") = LocationName row("OpDesc") = lOperation.Description @@ -759,9 +763,13 @@ Public Module atcConstituentTables row("ConstNameEXP") = constituent.ConstNameForEXPPlus row("Unit") = constituent.ConstituentUnit 'row("WASHQS") = lValue - row(lTSAttributes.Split("-")(0)) = lValue - Land_Constituent_Table.Rows.Add(row) - Else + If lTSAttributes.Split("-")(0) = "SOQS" Then 'For IMPLND, WASHQS is not a constituent, but Anurag wants to put this value in that column + row("WASHQS") = lValue + Else + row(lTSAttributes.Split("-")(0)) = lValue + End If + Land_Constituent_Table.Rows.Add(row) + Else Land_Constituent_Table.Rows(RowNumber - 1)(lTSAttributes.Split("-")(0)) = HspfTable.NumFmtRE(lValue, 10) End If Next i @@ -877,13 +885,17 @@ Public Module atcConstituentTables Dim OpType1 As String = item.Split("-")(0) Dim SelectExpression As String = "OpTypeNumber Like '" & item.Split(":")(0) & "%' And Year = 'SumAnnual' And OpDesc ='" & item.Split(":")(1) & "' And ConstNameEXP = '" & Constituent.ConstNameForEXPPlus & "'" Dim foundRows() As DataRow = Land_Constituent_Table.Select(SelectExpression) - Dim Values As New List(Of Double) - For Each foundrow As DataRow In foundRows - Values.Add(foundrow("TotalOutflow")) - Next foundrow - - lDataForBoxWhiskerPlot.Units = "(" & foundRows(0)("Unit") & "/yr)" - landUseSumAnnualValues.Add(item, Values.ToArray) + Dim Values As New List(Of Double) + If foundRows.Length > 0 Then + For Each foundrow As DataRow In foundRows + Values.Add(foundrow("TotalOutflow")) + Next foundrow + + If Values.Count > 0 Then + lDataForBoxWhiskerPlot.Units = "(" & foundRows(0)("Unit") & "/yr)" + landUseSumAnnualValues.Add(item, Values.ToArray) + End If + End If Next item lDataForBoxWhiskerPlot.LabelValueCollection = landUseSumAnnualValues CreateGraph_BoxAndWhisker(lDataForBoxWhiskerPlot, aoutfoldername & Constituent.ConstNameForEXPPlus & "_BoxWhisker.png") @@ -896,24 +908,27 @@ Public Module atcConstituentTables Dim OpType1 As String = item.Split("-")(0) Dim SelectExpression As String = "OpTypeNumber Like '" & item.Split(":")(0) & "%' And OpDesc ='" & item.Split(":")(1) & "' And ConstNameEXP = '" & Constituent.ConstNameForEXPPlus & "'" Dim foundRows() As DataRow = Land_Constituent_Monthly_Table.Select(SelectExpression) - - For Each month As String In lMonthNames - Dim Values As New List(Of Double) - For Each MonthRow As DataRow In foundRows - Values.Add(MonthRow(month)) + If foundRows.Length > 0 Then + For Each month As String In lMonthNames + Dim Values As New List(Of Double) + For Each MonthRow As DataRow In foundRows + Values.Add(MonthRow(month)) + Next + If Values.Count > 0 Then + landUseSumAnnualValues.Add(Right(month, 3), Values.ToArray) + End If Next - landUseSumAnnualValues.Add(Right(month, 3), Values.ToArray) - Next - - lDataForBoxWhiskerPlot.LabelValueCollection = landUseSumAnnualValues - lDataForBoxWhiskerPlot.Units = "(" & foundRows(0)("Unit") & ")" - - CreateGraph_BoxAndWhisker(lDataForBoxWhiskerPlot, AbsolutePath(System.IO.Path.Combine("MonthlyLoadings\" & Constituent.ConstNameForEXPPlus & "_" & item.Split(":")(0) & "_" & item.Split(":")(1) & "_BoxWhisker.png"), aoutfoldername), - "Monthly Loading Rate from Land Use " & item & "") - landUseSumAnnualValues.Clear() + lDataForBoxWhiskerPlot.LabelValueCollection = landUseSumAnnualValues + If landUseSumAnnualValues.Count > 0 Then + lDataForBoxWhiskerPlot.Units = "(" & foundRows(0)("Unit") & ")" + CreateGraph_BoxAndWhisker(lDataForBoxWhiskerPlot, AbsolutePath(System.IO.Path.Combine("MonthlyLoadings\" & Constituent.ConstNameForEXPPlus & "_" & item.Split(":")(0) & "_" & item.Split(":")(1) & "_BoxWhisker.png"), aoutfoldername), + "Monthly Loading Rate from Land Use " & item & "") + landUseSumAnnualValues.Clear() + End If + End If Next item @@ -927,39 +942,47 @@ Public Module atcConstituentTables Dim OpType1 As String = item.Split("-")(0) Dim SelectExpression As String = "OpTypeNumber Like '" & item.Split(":")(0) & "%' And Year = 'SumAnnual' And OpDesc ='" & item.Split(":")(1) & "'" Dim foundRows() As DataRow = Land_Constituent_Table.Select(SelectExpression) - Dim Values As New List(Of Double) - For Each foundrow As DataRow In foundRows - Values.Add(foundrow("TotalOutflow")) - Next foundrow - landUseSumAnnualValues.Add(item, Values.ToArray) - Next item - lDataForBoxWhiskerPlot.Units = "(" & lUnits & "/yr)" - lDataForBoxWhiskerPlot.LabelValueCollection = landUseSumAnnualValues - CreateGraph_BoxAndWhisker(lDataForBoxWhiskerPlot, aoutfoldername & aBalanceType & "_BoxWhisker.png") - landUseSumAnnualValues.Clear() + Dim Values As New List(Of Double) + If foundRows.Length > 0 Then + For Each foundrow As DataRow In foundRows + Values.Add(foundrow("TotalOutflow")) + Next foundrow + If Values.Count > 0 Then + landUseSumAnnualValues.Add(item, Values.ToArray) + End If + End If + Next item + If landUseSumAnnualValues.Count > 0 Then + lDataForBoxWhiskerPlot.Units = "(" & lUnits & "/yr)" + lDataForBoxWhiskerPlot.LabelValueCollection = landUseSumAnnualValues + CreateGraph_BoxAndWhisker(lDataForBoxWhiskerPlot, aoutfoldername & aBalanceType & "_BoxWhisker.png") + landUseSumAnnualValues.Clear() - lDataForBoxWhiskerPlot.Constituent = aBalanceType - For Each item As String In listLanduses - Dim OpType1 As String = item.Split("-")(0) - Dim SelectExpression As String = "OpTypeNumber Like '" & item.Split(":")(0) & "%' And OpDesc ='" & item.Split(":")(1) & "'" - Dim foundRows() As DataRow = Land_Constituent_Monthly_Table.Select(SelectExpression) - For Each month As String In lMonthNames - Dim Values As New List(Of Double) - For Each MonthRow As DataRow In foundRows - Values.Add(MonthRow(month)) - Next - landUseSumAnnualValues.Add(Right(month, 3), Values.ToArray) - Next + lDataForBoxWhiskerPlot.Constituent = aBalanceType + For Each item As String In listLanduses + Dim OpType1 As String = item.Split("-")(0) + Dim SelectExpression As String = "OpTypeNumber Like '" & item.Split(":")(0) & "%' And OpDesc ='" & item.Split(":")(1) & "'" + Dim foundRows() As DataRow = Land_Constituent_Monthly_Table.Select(SelectExpression) + If foundRows.Length > 0 Then + For Each month As String In lMonthNames + Dim Values As New List(Of Double) + For Each MonthRow As DataRow In foundRows + Values.Add(MonthRow(month)) + Next + landUseSumAnnualValues.Add(Right(month, 3), Values.ToArray) + Next - lDataForBoxWhiskerPlot.LabelValueCollection = landUseSumAnnualValues - lDataForBoxWhiskerPlot.Units = "(" & lUnits & ")" + lDataForBoxWhiskerPlot.LabelValueCollection = landUseSumAnnualValues + lDataForBoxWhiskerPlot.Units = "(" & lUnits & ")" - CreateGraph_BoxAndWhisker(lDataForBoxWhiskerPlot, AbsolutePath(System.IO.Path.Combine("MonthlyLoadings\" & aBalanceType & "_" & item.Split(":")(0) & "_" & item.Split(":")(1) & "_BoxWhisker.png"), aoutfoldername), - "Monthly Loading Rate from Land Use " & item & "") - landUseSumAnnualValues.Clear() - Next + CreateGraph_BoxAndWhisker(lDataForBoxWhiskerPlot, AbsolutePath(System.IO.Path.Combine("MonthlyLoadings\" & aBalanceType & "_" & item.Split(":")(0) & "_" & item.Split(":")(1) & "_BoxWhisker.png"), aoutfoldername), + "Monthly Loading Rate from Land Use " & item & "") + End If + landUseSumAnnualValues.Clear() + Next + End If End If @@ -973,7 +996,7 @@ Public Module atcConstituentTables ByVal aRunMade As String, ByVal aBalanceType As String, ByVal aConstProperties As List(Of ConstituentProperties), - ByVal aSDateJ As Double, ByVal aEDateJ As Double) + ByVal aSDateJ As Double, ByVal aEDateJ As Double, Optional aGQALID As Integer = 0) Dim lReport As New atcReport.ReportText Dim lUpstreamInflows As New atcCollection Dim lCumulativePointNonpointColl As New atcCollection @@ -983,6 +1006,8 @@ Public Module atcConstituentTables Dim lUnits As String = "" Select Case aBalanceType + Case "Water", "Sediment" + 'not generating reach budget report for water and sediment #Region "DO Case" Case "DO" @@ -1064,6 +1089,7 @@ Public Module atcConstituentTables For Each lReach As HspfOperation In aUCI.OpnSeqBlock.Opns row = Reach_Budget_Table.NewRow If Not lReach.Name = "RCHRES" Then Continue For + If Not lReach.Tables("ACTIVITY").Parms("OXFG").Value = "1" Then Continue For Dim LocationName As String = lReach.Name.Substring(0, 1) & ":" & lReach.Id 'Dim lOutflowDataTypes1 As String() = ConstituentListRCHRES(aBalanceType) Dim lTS As New atcTimeseries(Nothing) @@ -1218,6 +1244,7 @@ Public Module atcConstituentTables For Each lReach As HspfOperation In aUCI.OpnSeqBlock.Opns row = Reach_Budget_Table.NewRow If Not lReach.Name = "RCHRES" Then Continue For + If Not lReach.Tables("ACTIVITY").Parms("HTFG").Value = "1" Then Continue For Dim LocationName As String = lReach.Name.Substring(0, 1) & ":" & lReach.Id 'Dim lOutflowDataTypes1 As String() = ConstituentListRCHRES(aBalanceType) Dim lTS As New atcTimeseries(Nothing) @@ -1427,7 +1454,7 @@ Public Module atcConstituentTables SaveFileString(aoutfoldername & aBalanceType & "_Reach_Budget.txt", lReport.ToString) #End Region #Region "TotalN Case" - Case "TotalN" + Case "TN" For Each lConstituent As ConstituentProperties In aConstProperties Reach_Budget_Table = New DataTable Dim lReachConstituent As String = lConstituent.ConstNameForEXPPlus @@ -1486,8 +1513,11 @@ Public Module atcConstituentTables Dim lTotalIn As Double = SubsetByDate(aBinaryData.DataSets.FindData("Location", LocationName).FindData("Constituent", lReachConstituent & "-INTOT")(0), aSDateJ, aEDateJ, Nothing).Attributes.GetDefinedValue("SumAnnual").Value - Dim lTotalAtmDep As Double = SubsetByDate(aBinaryData.DataSets.FindData("Location", LocationName).FindData("Constituent", lReachConstituent & "-ATMDEPTOT")(0), - aSDateJ, aEDateJ, Nothing).Attributes.GetDefinedValue("SumAnnual").Value + Dim lTotalAtmDep As Double = 0.0 + If aBinaryData.DataSets.FindData("Location", LocationName).FindData("Constituent", lReachConstituent & "-ATMDEPTOT").Count > 0 Then + lTotalAtmDep = SubsetByDate(aBinaryData.DataSets.FindData("Location", LocationName).FindData("Constituent", lReachConstituent & "-ATMDEPTOT")(0), + aSDateJ, aEDateJ, Nothing).Attributes.GetDefinedValue("SumAnnual").Value + End If Dim lProcFluxTot As Double = SubsetByDate(aBinaryData.DataSets.FindData("Location", LocationName).FindData("Constituent", lReachConstituent & "-PROCFLUX-TOT")(0), aSDateJ, aEDateJ, Nothing).Attributes.GetDefinedValue("SumAnnual").Value If lReachConstituent = "NO3" Then @@ -1532,9 +1562,10 @@ Public Module atcConstituentTables Case lReachConstituent & "-OUTTOT" row(ColumnName) = lOutflow Case Else - row(ColumnName) = HspfTable.NumFmtRE(SubsetByDate(aBinaryData.DataSets.FindData("Location", LocationName).FindData("Constituent", ColumnName)(0), + If aBinaryData.DataSets.FindData("Location", LocationName).FindData("Constituent", ColumnName).Count > 0 Then + row(ColumnName) = HspfTable.NumFmtRE(SubsetByDate(aBinaryData.DataSets.FindData("Location", LocationName).FindData("Constituent", ColumnName)(0), aSDateJ, aEDateJ, Nothing).Attributes.GetDefinedValue("SumAnnual").Value, 10) - + End If End Select Next columnValue @@ -1566,7 +1597,7 @@ Public Module atcConstituentTables #End Region #Region "TotalP Case" - Case "TotalP" + Case "TP" For Each lConstituent As ConstituentProperties In aConstProperties Reach_Budget_Table = New DataTable Dim lReachConstituent As String = lConstituent.ConstNameForEXPPlus @@ -1683,10 +1714,139 @@ Public Module atcConstituentTables Next lConstituent #End Region +#Region "Else Case" + Case Else + 'For GQAL Constituents + For Each lConstituent As ConstituentProperties In aConstProperties + + lUnits = GQualUnits(aUCI, lConstituent.ConstituentNameInUCI) + + Dim column As DataColumn + Dim row As DataRow + Reach_Budget_Table = AddFirstSixColumnsReachBudget(Reach_Budget_Table, lUnits) + column = New DataColumn() + column.DataType = Type.GetType("System.Double") + column.ColumnName = aBalanceType & "-TIQAL" + column.Caption = "Total " & aBalanceType & " Inflow (" & lUnits & ")" + Reach_Budget_Table.Columns.Add(column) + + column = New DataColumn() + column.DataType = Type.GetType("System.Double") + column.ColumnName = aBalanceType & "-PDQAL" + column.Caption = "Input of " & aBalanceType & " due to decay of parents (" & lUnits & ")" + Reach_Budget_Table.Columns.Add(column) + + column = New DataColumn() + column.DataType = Type.GetType("System.Double") + column.ColumnName = aBalanceType & "-GQADEP" + column.Caption = "Total Atmospheric deposition of " & aBalanceType & " (" & lUnits & ")" + Reach_Budget_Table.Columns.Add(column) + + column = New DataColumn() + column.DataType = Type.GetType("System.Double") + column.ColumnName = aBalanceType & "-DDQAL-TOT" + column.Caption = "Decay of Dissolved " & aBalanceType & " (" & lUnits & ")" + Reach_Budget_Table.Columns.Add(column) + + column = New DataColumn() + column.DataType = Type.GetType("System.Double") + column.ColumnName = aBalanceType & "-DSQAL-TOT" + column.Caption = "Dep(+)/Scour(-) of " & aBalanceType & " (" & lUnits & ")" + Reach_Budget_Table.Columns.Add(column) + + column = New DataColumn() + column.DataType = Type.GetType("System.Double") + column.ColumnName = aBalanceType & "-ADQAL-TOT" + column.Caption = "Adsorption(+)/Desorption(-) of " & aBalanceType & "(" & lUnits & ")" + Reach_Budget_Table.Columns.Add(column) + + column = New DataColumn() + column.DataType = Type.GetType("System.Double") + column.ColumnName = aBalanceType & "-TROQAL" + column.Caption = "Total Outflow of " & aBalanceType & " (" & lUnits & ")" + Reach_Budget_Table.Columns.Add(column) + + + For Each lReach As HspfOperation In aUCI.OpnSeqBlock.Opns + row = Reach_Budget_Table.NewRow + If Not lReach.Name = "RCHRES" Then Continue For + If Not lReach.Tables("ACTIVITY").Parms("HTFG").Value = "1" Then Continue For + Dim LocationName As String = lReach.Name.Substring(0, 1) & ":" & lReach.Id + 'If lReach.Id = 106 Then Stop + Dim lTS As New atcTimeseries(Nothing) + Dim AddTS As New atcDataGroup + Dim lTotalTS As New atcTimeseries(Nothing) + Dim lDownstreamReachID As Integer = lReach.DownOper("RCHRES") + Dim lUpstreamIn As Double = 0.0 + If lUpstreamInflows.Keys.Contains(lReach.Id) Then + lUpstreamIn = lUpstreamInflows.ItemByKey(lReach.Id) + End If + Dim lNPSLoad As Double = CalculateNPSLoad(aUCI, lReach, aBalanceType, aGQALID) + Dim lPSLoad As Double = CalculatePSLoad(aUCI, lReach, aSDateJ, aEDateJ, aBalanceType, aGQALID) + Dim lOutflow As Double = SubsetByDate(aBinaryData.DataSets.FindData("Location", LocationName).FindData("Constituent", aBalanceType & "-TROQAL")(0), + aSDateJ, aEDateJ, Nothing).Attributes.GetDefinedValue("SumAnnual").Value + Dim lTotalIn As Double = SubsetByDate(aBinaryData.DataSets.FindData("Location", LocationName).FindData("Constituent", aBalanceType & "-TIQAL")(0), + aSDateJ, aEDateJ, Nothing).Attributes.GetDefinedValue("SumAnnual").Value + Dim lDiversion As Double = CalculateDiversion(aUCI, aBinaryData, lReach, lUpstreamInflows, lDownstreamReachID, lOutflow, aBalanceType, aGQALID) + Dim lGENERLoad As Double = CalculateGENERLoad(aUCI, lReach, aBalanceType, aSDateJ, aEDateJ, aGQALID) + Dim lMassBalance As Double = lTotalIn - lNPSLoad - lUpstreamIn - lPSLoad - lGENERLoad + For Each columnValue As DataColumn In Reach_Budget_Table.Columns + Dim ColumnName As String = columnValue.ColumnName + Select Case ColumnName + Case "OpTypeNumber" + row(ColumnName) = LocationName + Case "OpDesc" + row(ColumnName) = lReach.Description + Case "NPSLoad" + row(ColumnName) = HspfTable.NumFmtRE(lNPSLoad, 10) + Case "PSLoad" + row(ColumnName) = HspfTable.NumFmtRE(lPSLoad, 10) + Case "GENERLoad" + row(ColumnName) = HspfTable.NumFmtRE(lGENERLoad, 10) + Case "Diversion" + row(ColumnName) = HspfTable.NumFmtRE(lDiversion, 10) + Case "MassBalance" + row(ColumnName) = HspfTable.NumFmtRE(lMassBalance, 10) + Case "UpstreamIn" + row(ColumnName) = HspfTable.NumFmtRE(lUpstreamIn, 10) + Case Else + Try + row(ColumnName) = HspfTable.NumFmtRE(SubsetByDate(aBinaryData.DataSets.FindData("Location", LocationName).FindData("Constituent", ColumnName)(0), + aSDateJ, aEDateJ, Nothing).Attributes.GetDefinedValue("SumAnnual").Value, 10) + Catch + 'row(ColumnName) + End Try + End Select + Next columnValue + + Reach_Budget_Table.Rows.Add(row) + Next lReach + Dim TextToWrite As String = "" + For Each TableColumn As DataColumn In Reach_Budget_Table.Columns 'Writing the table headings + TextToWrite &= TableColumn.Caption & vbTab + Next + lReport.AppendLine(TextToWrite) + For Each TableRow As DataRow In Reach_Budget_Table.Rows 'Writing the table contents + TextToWrite = "" + For Each TableColumn As DataColumn In Reach_Budget_Table.Columns + TextToWrite &= TableRow(TableColumn) & vbTab + Next TableColumn + lReport.AppendLine(TextToWrite) + Next TableRow + lReport.AppendLine() + lReport.AppendLine("Tabular Report of Average Annual Reach Budget for all the Reach Operations.") + lReport.AppendLine(" " & aUCI.GlobalBlock.RunInf.Value) + lReport.AppendLine(" Run Made " & aRunMade) + lReport.AppendLine(" " & TimeSpanAsString(aSDateJ, aEDateJ, "Analysis Period: ")) + SaveFileString(aoutfoldername & aBalanceType & "_Reach_Budget.txt", lReport.ToString) + Next lConstituent +#End Region + + End Select End Sub - Private Function CalculateNPSLoad(ByVal aUCI As HspfUci, ByVal aReach As HspfOperation, ByVal aConstituentName As String) As Double + Private Function CalculateNPSLoad(ByVal aUCI As HspfUci, ByVal aReach As HspfOperation, ByVal aConstituentName As String, Optional ByVal aGQALID As Integer = 0) As Double Dim NPSLoad As Double = 0.0 Dim SelectExpression As String = "" For Each lReachSource As HspfConnection In aReach.Sources @@ -1714,7 +1874,8 @@ Public Module atcConstituentTables End Function Private Function CalculatePSLoad(ByVal aUCI As HspfUci, ByVal aReach As HspfOperation, ByVal aSDateJ As Double, - ByVal aEDateJ As Double, ByVal aConstituentName As String) As Double + ByVal aEDateJ As Double, ByVal aConstituentName As String, + Optional ByVal aGQALID As Integer = 0) As Double Dim PSLoad As Double = 0.0 Select Case aConstituentName Case "DO" @@ -1891,11 +2052,40 @@ Public Module atcConstituentTables Next End If - Next lSource - End Select - - + Next lSource + Case Else + For Each lSource As HspfPointSource In aReach.PointSources + If (lSource.Target.Group = "INFLOW" AndAlso lSource.Target.Member = "IDQAL" AndAlso lSource.Target.MemSub1 = aGQALID) OrElse + (lSource.Target.Group = "INFLOW" AndAlso lSource.Target.Member = "ISQAL" AndAlso lSource.Target.MemSub2 = aGQALID) Then + Dim TimeSeriesTransformaton As String = lSource.Tran.ToString + Dim VolName As String = lSource.Source.VolName + Dim lDSN As Integer = lSource.Source.VolId + Dim lMfact As Double = lSource.MFact + Dim TransformationMultFact As Double = 0 + For i As Integer = 0 To aUCI.FilesBlock.Count + If aUCI.FilesBlock.Value(i).Typ = VolName Then + Dim lFileName As String = AbsolutePath(aUCI.FilesBlock.Value(i).Name.Trim, CurDir()) + Dim lDataSource As atcDataSource = atcDataManager.DataSourceBySpecification(lFileName) + If lDataSource Is Nothing Then + If atcDataManager.OpenDataSource(lFileName) Then + lDataSource = atcDataManager.DataSourceBySpecification(lFileName) + End If + End If + Dim ltimeseries As atcTimeseries = lDataSource.DataSets.FindData("ID", lDSN)(0) + ltimeseries = SubsetByDate(ltimeseries, aSDateJ, aEDateJ, Nothing) + TransformationMultFact = MultiFactorForPointSource(ltimeseries.Attributes.GetDefinedValue("Time Step").Value, ltimeseries.Attributes.GetDefinedValue("Time Unit").Value.ToString, + TimeSeriesTransformaton, aUCI.OpnSeqBlock.Delt) + PSLoad += ltimeseries.Attributes.GetDefinedValue("Sum").Value * lMfact * TransformationMultFact / YearCount(aSDateJ, aEDateJ) + End If + Next + End If + Next lSource + + End Select + + + Return PSLoad End Function @@ -1916,8 +2106,9 @@ Public Module atcConstituentTables Return MultiFactor End Function Private Function CalculateDiversion(ByVal aUCI As HspfUci, ByVal aBinaryDataSource As atcDataSource, ByVal aReach As HspfOperation, ByRef aUpstreamInflows As atcCollection, - ByVal aDownstreamReachID As Integer, ByVal aOutflow As Double, ByVal aConstituent As String) As Double + ByVal aDownstreamReachID As Integer, ByVal aOutflow As Double, ByVal aConstituent As String, Optional ByVal aGQALID As Integer = 0) As Double Dim lDiversion As Double = 0.0 + Dim lTimeSeries As New atcTimeseries(Nothing) Try If aReach.Tables("GEN-INFO").Parms("NEXITS").Value = 1 Then 'Logger.Dbg(aReach.Id) @@ -1930,51 +2121,91 @@ Public Module atcConstituentTables Select Case aConstituent Case "DO" lExitFlowConstituent = "DOXOUT-EXIT" & lExitNUmber - lTotalOutFlow = (aBinaryDataSource.DataSets.FindData("Location", "R:" & aReach.Id). - FindData("Constituent", lExitFlowConstituent)(0).Attributes.GetDefinedValue("SumAnnual").Value) + lTimeSeries = aBinaryDataSource.DataSets.FindData("Location", "R:" & aReach.Id). + FindData("Constituent", lExitFlowConstituent)(0) + If Not lTimeSeries Is Nothing Then + lTotalOutFlow = lTimeSeries.Attributes.GetDefinedValue("SumAnnual").Value + End If lDiversion = aOutflow - lTotalOutFlow - Case "BOD-Labile" lExitFlowConstituent = "BODOUT-EXIT" & lExitNUmber - lTotalOutFlow = (aBinaryDataSource.DataSets.FindData("Location", "R:" & aReach.Id). - FindData("Constituent", lExitFlowConstituent)(0).Attributes.GetDefinedValue("SumAnnual").Value) + lTimeSeries = aBinaryDataSource.DataSets.FindData("Location", "R:" & aReach.Id). + FindData("Constituent", lExitFlowConstituent)(0) + If Not lTimeSeries Is Nothing Then + lTotalOutFlow = lTimeSeries.Attributes.GetDefinedValue("SumAnnual").Value + End If lDiversion = aOutflow - lTotalOutFlow - Case "Heat" lExitFlowConstituent = "OHEAT - EXIT-" & lExitNUmber - lTotalOutFlow = (aBinaryDataSource.DataSets.FindData("Location", "R:" & aReach.Id). - FindData("Constituent", lExitFlowConstituent)(0).Attributes.GetDefinedValue("SumAnnual").Value) + lTimeSeries = aBinaryDataSource.DataSets.FindData("Location", "R:" & aReach.Id). + FindData("Constituent", lExitFlowConstituent)(0) + If Not lTimeSeries Is Nothing Then + lTotalOutFlow = lTimeSeries.Attributes.GetDefinedValue("SumAnnual").Value + End If lDiversion = aOutflow - lTotalOutFlow - Case "NO3" lExitFlowConstituent = "NO3-OUTDIS-EXIT" & lExitNUmber - lTotalOutFlow = (aBinaryDataSource.DataSets.FindData("Location", "R:" & aReach.Id). - FindData("Constituent", lExitFlowConstituent)(0).Attributes.GetDefinedValue("SumAnnual").Value) + lTimeSeries = aBinaryDataSource.DataSets.FindData("Location", "R:" & aReach.Id). + FindData("Constituent", lExitFlowConstituent)(0) + If Not lTimeSeries Is Nothing Then + lTotalOutFlow = lTimeSeries.Attributes.GetDefinedValue("SumAnnual").Value + End If lExitFlowConstituent = "NO2-OUTDIS-EXIT" & lExitNUmber - lTotalOutFlow += (aBinaryDataSource.DataSets.FindData("Location", "R:" & aReach.Id). - FindData("Constituent", lExitFlowConstituent)(0).Attributes.GetDefinedValue("SumAnnual").Value) + lTimeSeries = aBinaryDataSource.DataSets.FindData("Location", "R:" & aReach.Id). + FindData("Constituent", lExitFlowConstituent)(0) + If Not lTimeSeries Is Nothing Then + lTotalOutFlow += lTimeSeries.Attributes.GetDefinedValue("SumAnnual").Value + End If lDiversion = aOutflow - lTotalOutFlow Case "TAM" lExitFlowConstituent = "TAM-OUTDIS-EXIT" & lExitNUmber - lTotalOutFlow = (aBinaryDataSource.DataSets.FindData("Location", "R:" & aReach.Id). - FindData("Constituent", lExitFlowConstituent)(0).Attributes.GetDefinedValue("SumAnnual").Value) + lTimeSeries = aBinaryDataSource.DataSets.FindData("Location", "R:" & aReach.Id). + FindData("Constituent", lExitFlowConstituent)(0) + If Not lTimeSeries Is Nothing Then + lTotalOutFlow = lTimeSeries.Attributes.GetDefinedValue("SumAnnual").Value + End If lExitFlowConstituent = "TAM-OUTPART-TOT-EXIT" & lExitNUmber - lTotalOutFlow += (aBinaryDataSource.DataSets.FindData("Location", "R:" & aReach.Id). - FindData("Constituent", lExitFlowConstituent)(0).Attributes.GetDefinedValue("SumAnnual").Value) + lTimeSeries = aBinaryDataSource.DataSets.FindData("Location", "R:" & aReach.Id). + FindData("Constituent", lExitFlowConstituent)(0) + If Not lTimeSeries Is Nothing Then + lTotalOutFlow += lTimeSeries.Attributes.GetDefinedValue("SumAnnual").Value + End If lDiversion = aOutflow - lTotalOutFlow Case "PO4" lExitFlowConstituent = "PO4-OUTDIS-EXIT" & lExitNUmber - lTotalOutFlow = (aBinaryDataSource.DataSets.FindData("Location", "R:" & aReach.Id). - FindData("Constituent", lExitFlowConstituent)(0).Attributes.GetDefinedValue("SumAnnual").Value) + lTimeSeries = aBinaryDataSource.DataSets.FindData("Location", "R:" & aReach.Id). + FindData("Constituent", lExitFlowConstituent)(0) + If Not lTimeSeries Is Nothing Then + lTotalOutFlow = lTimeSeries.Attributes.GetDefinedValue("SumAnnual").Value + End If lExitFlowConstituent = "PO4-OUTPART-TOT-EXIT" & lExitNUmber - lTotalOutFlow += (aBinaryDataSource.DataSets.FindData("Location", "R:" & aReach.Id). - FindData("Constituent", lExitFlowConstituent)(0).Attributes.GetDefinedValue("SumAnnual").Value) + lTimeSeries = aBinaryDataSource.DataSets.FindData("Location", "R:" & aReach.Id). + FindData("Constituent", lExitFlowConstituent)(0) + If Not lTimeSeries Is Nothing Then + lTotalOutFlow += lTimeSeries.Attributes.GetDefinedValue("SumAnnual").Value + End If + lDiversion = aOutflow - lTotalOutFlow + + Case Else + lExitFlowConstituent = aConstituent & "-OSQAL-TOT-" & lExitNUmber + + lTimeSeries = aBinaryDataSource.DataSets.FindData("Location", "R:" & aReach.Id). + FindData("Constituent", lExitFlowConstituent)(0) + If Not lTimeSeries Is Nothing Then + lTotalOutFlow = lTimeSeries.Attributes.GetDefinedValue("SumAnnual").Value + End If + lExitFlowConstituent = aConstituent & "-TOSQAL-EXIT" & lExitNUmber + lTimeSeries = aBinaryDataSource.DataSets.FindData("Location", "R:" & aReach.Id). + FindData("Constituent", lExitFlowConstituent)(0) + If Not lTimeSeries Is Nothing Then + lTotalOutFlow += lTimeSeries.Attributes.GetDefinedValue("SumAnnual").Value + End If lDiversion = aOutflow - lTotalOutFlow End Select @@ -1990,7 +2221,7 @@ Public Module atcConstituentTables Return lDiversion End Function Private Function CalculateGENERLoad(ByVal aUCI As HspfUci, ByVal aReach As HspfOperation, ByVal aConstituentName As String, - ByVal aSDateJ As Double, ByVal aEDateJ As Double) As Double + ByVal aSDateJ As Double, ByVal aEDateJ As Double, Optional ByVal aGQALID As Integer = 0) As Double Dim lGENERLoad As Double = 0.0 Select Case aConstituentName @@ -2217,8 +2448,40 @@ Public Module atcConstituentTables End If Next lSource - - + + Case Else + lGENERLoad = 0 + + For Each lSource As HspfConnection In aReach.Sources + Dim lGENERSum As Double = 0.0 + Dim lMfact As Double = 0.0 + If lSource.Source.VolName = "GENER" Then + Dim lGENEROperationisOutputtoWDM As Boolean = False + With GetGENERSum(aUCI, lSource, aSDateJ, aEDateJ) + lGENERSum = .Item1 + lGENEROperationisOutputtoWDM = .Item2 + End With + If lSource.MassLink > 0 Then + lGENERSum *= lSource.MFact + For Each lMassLink As HspfMassLink In aUCI.MassLinks + If (lMassLink.MassLinkId = lSource.MassLink AndAlso lMassLink.Target.Member = "IDQAL" AndAlso lMassLink.Target.MemSub1 = aGQALID) OrElse + (lMassLink.MassLinkId = lSource.MassLink AndAlso lMassLink.Target.Member = "ISQAL" AndAlso lMassLink.Target.MemSub2 = aGQALID) Then + lGENERSum *= lMassLink.MFact + lGENERLoad += lGENERSum + Exit For + End If + Next lMassLink + ElseIf (lSource.Target.Group = "INFLOW" AndAlso lSource.Target.Member = "IDQAL" AndAlso lSource.Target.MemSub1 = aGQALID) OrElse + (lSource.Target.Group = "INFLOW" AndAlso lSource.Target.Member = "ISQAL" AndAlso lSource.Target.MemSub2 = aGQALID) Then + lGENERSum *= lSource.MFact + lGENERLoad += lGENERSum + End If + If Not lGENEROperationisOutputtoWDM Then + Logger.Dbg("GENER Loadings Issue: The RCHRES operation " & aReach.Id & " has loadings input for the constituent " & aConstituentName & " from GENER connections in the Network Block. Please make sure that these GENER operations output to a WDM dataset for accurate source accounting.") + End If + End If + + Next lSource End Select Return lGENERLoad @@ -2383,4 +2646,36 @@ Public Module atcConstituentTables aDataTable.Columns.Add(column) Return aDataTable End Function + Private Function GetGENERSum(ByVal aUCI As HspfUci, ByVal aSource As HspfConnection, ByVal aSDateJ As Double, ByVal aEDateJ As Double) As Tuple(Of Double, Boolean) + Dim aGenerSum As Double = 0 + Dim aGENERID As Integer = aSource.Source.VolId + Dim aGENEROperationisOutputtoWDM As Boolean = False + Dim aGENEROperation As HspfOperation = aSource.Source.Opn + For Each EXTTarget As HspfConnection In aGENEROperation.Targets + If EXTTarget.Target.VolName.Contains("WDM") Then + aGENEROperationisOutputtoWDM = True + Dim lWDMFile As String = EXTTarget.Target.VolName.ToString + Dim lDSN As Integer = EXTTarget.Target.VolId + For i As Integer = 0 To aUCI.FilesBlock.Count + If aUCI.FilesBlock.Value(i).Typ = lWDMFile Then + Dim lFileName As String = AbsolutePath(aUCI.FilesBlock.Value(i).Name.Trim, CurDir()) + Dim lDataSource As atcDataSource = atcDataManager.DataSourceBySpecification(lFileName) + If lDataSource Is Nothing Then + If atcDataManager.OpenDataSource(lFileName) Then + lDataSource = atcDataManager.DataSourceBySpecification(lFileName) + End If + End If + Dim ltimeseries As atcTimeseries = lDataSource.DataSets.FindData("ID", lDSN)(0) + ltimeseries = SubsetByDate(ltimeseries, aSDateJ, aEDateJ, Nothing) + aGenerSum = ltimeseries.Attributes.GetDefinedValue("Sum").Value / YearCount(aSDateJ, aEDateJ) + + End If + Next + End If + Next EXTTarget + + Return New Tuple(Of Double, Boolean)(aGenerSum, aGENEROperationisOutputtoWDM) + End Function + + End Module diff --git a/atcHspfSupport/atcHspfConstituentBalance.vb b/atcHspfSupport/atcHspfConstituentBalance.vb index a0698266b..408b062f8 100644 --- a/atcHspfSupport/atcHspfConstituentBalance.vb +++ b/atcHspfSupport/atcHspfConstituentBalance.vb @@ -43,12 +43,13 @@ Public Module ConstituentBalance Optional ByVal aDecimalPlaces As Integer = 3, Optional ByVal aSignificantDigits As Integer = 5, Optional ByVal aFieldWidth As Integer = 12) As atcReport.IReport - Dim lConstituentsToOutput As atcCollection = ConstituentsToOutput(aBalanceType, aConstProperties) + Dim lUnits As String = GQualUnits(aUci, aBalanceType) 'if not a gqual, will return a blank string + Dim lConstituentsToOutput As atcCollection = ConstituentsToOutput(aBalanceType, aConstProperties, , lUnits) Dim lReport As New atcReport.ReportText lReport.AppendLine(aScenario & " " & "Annual Loading Rates of " & aBalanceType & " For Each PERLND, and IMPLND, and") - lReport.AppendLine("Annual Loadings of" & aBalanceType & " For Each Reach.") + lReport.AppendLine("Annual Loadings of " & aBalanceType & " For Each Reach.") lReport.AppendLine(" Run Made " & aRunMade) lReport.AppendLine(" " & aUci.GlobalBlock.RunInf.Value) lReport.AppendLine(" " & TimeSpanAsString(aSDateJ, aEDateJ, "Analysis Period: ")) @@ -144,11 +145,16 @@ Public Module ConstituentBalance .Header = aBalanceType & " Balance Report For " & lLocation & " (" & lDesc & ") (lbs/ac)" Case "TotalN_RCHRES", "TotalP_RCHRES", "BOD-Labile_RCHRES" .Header = aBalanceType & " Balance Report For " & lLocation & " (" & lDesc & ") (lbs)" - Case "FColi_PERLND", "FColi_IMPLND" - .Header = aBalanceType & " Balance Report For " & lLocation & " (" & lDesc & ") (10^9 org/ac)" - Case "FColi_RCHRES" - .Header = aBalanceType & " Balance Report For " & lLocation & " (" & lDesc & ") (10^9 org)" - + Case Else + Dim lPrefix As String = "" + If aBalanceType.ToUpper.Contains("F.COLIFORM") Or aBalanceType.ToUpper.StartsWith("BACT") Then 'Assuming this is f.coli or bacteria + lPrefix = "10^9 " + End If + If lOperName = "PERLND" Or lOperName = "IMPLND" Then + .Header = aBalanceType & " Balance Report For " & lLocation & " (" & lDesc & ") (" & lPrefix & lUnits & "/ac)" + ElseIf lOperName = "RCHRES" Then + .Header = aBalanceType & " Balance Report For " & lLocation & " (" & lDesc & ") (" & lPrefix & lUnits & ")" + End If End Select .NumHeaderRows = 1 @@ -246,9 +252,7 @@ Public Module ConstituentBalance End If - - If lConstituentDataName.Contains("F.Coliform") Then 'Assuming that unit of F.Coliform unit is #ORG - + If lConstituentDataName.ToUpper.Contains("F.COLIFORM") Or lConstituentDataName.ToUpper.StartsWith("BACT") Then 'Assuming that unit of F.Coliform unit is #ORG lMult = 1 / 1000000000.0 '10^9 End If diff --git a/atcHspfSupport/atcHspfConstituentBudget.vb b/atcHspfSupport/atcHspfConstituentBudget.vb index 85137af52..89e30bc91 100644 --- a/atcHspfSupport/atcHspfConstituentBudget.vb +++ b/atcHspfSupport/atcHspfConstituentBudget.vb @@ -1718,4 +1718,36 @@ Public Module ConstituentBudget Return MultiFactor End Function + Private Function GetGENERSum(ByVal aUCI As HspfUci, ByVal aSource As HspfConnection, ByVal aSDateJ As Double, ByVal aEDateJ As Double) As Tuple(Of Double, Boolean) + Dim aGenerSum As Double = 0 + Dim aGENERID As Integer = aSource.Source.VolId + Dim aGENEROperationisOutputtoWDM As Boolean = False + Dim aGENEROperation As HspfOperation = aSource.Source.Opn + For Each EXTTarget As HspfConnection In aGENEROperation.Targets + If EXTTarget.Target.VolName.Contains("WDM") Then + aGENEROperationisOutputtoWDM = True + Dim lWDMFile As String = EXTTarget.Target.VolName.ToString + Dim lDSN As Integer = EXTTarget.Target.VolId + For i As Integer = 0 To aUCI.FilesBlock.Count + If aUCI.FilesBlock.Value(i).Typ = lWDMFile Then + Dim lFileName As String = AbsolutePath(aUCI.FilesBlock.Value(i).Name.Trim, CurDir()) + Dim lDataSource As atcDataSource = atcDataManager.DataSourceBySpecification(lFileName) + If lDataSource Is Nothing Then + If atcDataManager.OpenDataSource(lFileName) Then + lDataSource = atcDataManager.DataSourceBySpecification(lFileName) + End If + End If + Dim ltimeseries As atcTimeseries = lDataSource.DataSets.FindData("ID", lDSN)(0) + ltimeseries = SubsetByDate(ltimeseries, aSDateJ, aEDateJ, Nothing) + aGenerSum = ltimeseries.Attributes.GetDefinedValue("Sum").Value / YearCount(aSDateJ, aEDateJ) + + End If + Next + End If + Next EXTTarget + + Return New Tuple(Of Double, Boolean)(aGenerSum, aGENEROperationisOutputtoWDM) + End Function + + End Module diff --git a/atcHspfSupport/atcHspfWatershedConstituentBalance.vb b/atcHspfSupport/atcHspfWatershedConstituentBalance.vb index 4eb658c7a..09f52034c 100644 --- a/atcHspfSupport/atcHspfWatershedConstituentBalance.vb +++ b/atcHspfSupport/atcHspfWatershedConstituentBalance.vb @@ -263,7 +263,8 @@ Public Module WatershedConstituentBalance lOutletReport = True End If - Dim lConstituentsToOutput As atcCollection = ConstituentsToOutput(aBalanceType, aConstProperties) + Dim lUnits As String = GQualUnits(aUci, aBalanceType) 'if not a gqual, will return a blank string + Dim lConstituentsToOutput As atcCollection = ConstituentsToOutput(aBalanceType, aConstProperties, , lUnits) Logger.Dbg("ConstituentCount:" & lConstituentsToOutput.Count) Dim lConstituentTotals As New atcCollection Dim lConstituentLandUseTotals As New atcCollection @@ -347,12 +348,18 @@ Public Module WatershedConstituentBalance .Header = aBalanceType & " Balance Report For " & lLandUse & " (lbs/ac)" & vbCrLf Case "TotalN_RCHRES", "TotalP_RCHRES", "BOD-Labile_RCHRES" .Header = aBalanceType & " Balance Report For " & lLandUse & " (lbs)" & vbCrLf - Case "FColi_PERLND", "FColi_IMPLND" - .Header = aBalanceType & " Balance Report For " & lLandUse & " (10^9 org/ac)" & vbCrLf - Case "FColi_RCHRES" - .Header = aBalanceType & " Balance Report For " & lLandUse & " (10^9 org)" & vbCrLf - + Case Else + Dim lPrefix As String = "" + If aBalanceType.ToUpper.Contains("F.COLIFORM") Or aBalanceType.ToUpper.StartsWith("FCOLI") Or aBalanceType.ToUpper.StartsWith("BACT") Then 'Assuming this is f.coli or bacteria + lPrefix = "10^9 " + End If + If lOperationType = "PERLND" Or lOperationType = "IMPLND" Then + .Header = aBalanceType & " Balance Report For " & lLandUse & " (" & lPrefix & lUnits & "/ac)" & vbCrLf + ElseIf lOperationType = "RCHRES" Then + .Header = aBalanceType & " Balance Report For " & lLandUse & " (" & lPrefix & lUnits & ")" & vbCrLf + End If End Select + .NumHeaderRows = 2 If lOutletReport And lOperationType <> "RCHRES" Then .NumFields = lLandUseOperations.Count + 2 @@ -473,9 +480,10 @@ Public Module WatershedConstituentBalance End If - If aBalanceType = "FColi" Then + If aBalanceType.ToUpper.Contains("F.COLIFORM") Or aBalanceType.ToUpper.StartsWith("FCOLI") Or aBalanceType.ToUpper.StartsWith("BACT") Then 'Assuming this is f.coli or bacteria lMult = 1 / 1000000000.0 '10^9 End If + Dim lAttribute As atcDefinedValue = Nothing If ConstituentsThatUseLast.Contains(lConstituentDataName) Then 'lAttribute = lTempDataSet.Attributes.GetDefinedValue("Last") @@ -903,7 +911,7 @@ Public Module WatershedConstituentBalance lSummaryReport.AppendLine(Space(lRowIdLength) & vbTab & "tons/ac".PadLeft(12) & vbTab & "tons".PadLeft(12) & vbTab & "tons/ac".PadLeft(12)) - ElseIf aBalanceType = "FColi" Then + ElseIf aBalanceType.ToUpper.Contains("F.COLIFORM") Or aBalanceType.ToUpper.StartsWith("FCOLI") Or aBalanceType.ToUpper.StartsWith("BACT") Then 'Assuming this is f.coli or bacteria lSummaryReport.AppendLine(Space(lRowIdLength) & vbTab & "10^9/ac".PadLeft(12) & vbTab & "10^9".PadLeft(12) & vbTab & "10^9/ac".PadLeft(12)) @@ -936,7 +944,7 @@ Public Module WatershedConstituentBalance ElseIf aBalanceType = "Sediment" Then lSummaryReport.AppendLine(Space(lRowIdLength) & vbTab & "tons".PadLeft(12) & vbTab & "tons/ac".PadLeft(12)) - ElseIf aBalanceType = "FColi" Then + ElseIf aBalanceType.ToUpper.Contains("F.COLIFORM") Or aBalanceType.ToUpper.StartsWith("FCOLI") Or aBalanceType.ToUpper.StartsWith("BACT") Then 'Assuming this is f.coli or bacteria lSummaryReport.AppendLine(Space(lRowIdLength) & vbTab & "10^9/ac".PadLeft(12) & vbTab & "10^9".PadLeft(12)) Else diff --git a/atcHspfSupport/atcHspfWatershedSummary.vb b/atcHspfSupport/atcHspfWatershedSummary.vb index b962df365..70600fb9a 100644 --- a/atcHspfSupport/atcHspfWatershedSummary.vb +++ b/atcHspfSupport/atcHspfWatershedSummary.vb @@ -44,12 +44,6 @@ Public Module WatershedSummary lPerlndConstituents.Add("PODOXM") lImplndConstituents.Add("SODOXM") lRchresConstituents.Add("DOXOUTTOT") - Case "FColi" - lPerlndConstituents.Add("POQUAL-F.Coliform") - lImplndConstituents.Add("SOQUAL-F.Coliform") - lUnits = "10^9" - lTotalUnits = lUnits - lRchresConstituents.Add("F.Coliform-TROQAL") Case "Lead" lPerlndConstituents.Add("POQUAL-LEAD") lImplndConstituents.Add("SOQUAL-LEAD") @@ -118,6 +112,19 @@ Public Module WatershedSummary lPerlndConstituents.Add("POQUAL-ZINC") lImplndConstituents.Add("SOQUAL-ZINC") lRchresConstituents.Add("ZINC-TROQAL") + Case Else + lUnits = GQualUnits(aUci, aSummaryType) + If aSummaryType.ToUpper.Contains("F.COLIFORM") Or aSummaryType.ToUpper.StartsWith("FCOLI") Or aSummaryType.ToUpper.StartsWith("BACT") Then 'Assuming this is f.coli or bacteria + lUnits = "10^9 " & lUnits + End If + Dim lGQualName As String = aSummaryType + If lGQualName = "FColi" Then + lGQualName = "F.Coliform" + End If + lPerlndConstituents.Add("POQUAL-" & lGQualName) + lImplndConstituents.Add("SOQUAL-" & lGQualName) + lTotalUnits = lUnits + lRchresConstituents.Add(lGQualName & "-TROQAL") End Select Dim lReport As New atcReport.ReportText diff --git a/atcHspfSupport/modUtility.vb b/atcHspfSupport/modUtility.vb index 5b0c03991..c7b811b6b 100644 --- a/atcHspfSupport/modUtility.vb +++ b/atcHspfSupport/modUtility.vb @@ -135,7 +135,8 @@ Public Module Utility Return pConstituentsThatNeedMassLink End Function Public Function ConstituentsToOutput(ByVal aType As String, ByVal aConstProperties As List(Of ConstituentProperties), - Optional ByVal aCategory As Boolean = False) As atcCollection + Optional ByVal aCategory As Boolean = False, + Optional ByVal aUnits As String = "") As atcCollection Dim lConstituentsToOutput As New atcCollection Select Case aType #Region "Case Water" @@ -267,22 +268,6 @@ Public Module Utility .Add("R:Copper-TROQAL", "Total Cu") End With #End Region -#Region "Case FColi" - Case "FColi" - With lConstituentsToOutput - .Add("P:Header1", "F.Coliform (10^9 org/ac)") - .Add("P:SOQUAL-F.Coliform", " Surface") - .Add("P:IOQUAL-F.Coliform", " Interflow") - .Add("P:AOQUAL-F.Coliform", " Baseflow") - .Add("P:Total3", " Total") - .Add("I:Header2", "F.Coliform (10^9 org/ac)") - .Add("I:SOQUAL-F.Coliform", " ImpervSurf") - .Add("R:Header3", "F.Coliform (10^9 org)") - .Add("R:F.Coliform-TIQAL", " Inflow") - .Add("R:F.Coliform-DDQAL-TOT", " Decay") - .Add("R:F.Coliform-TROQAL", " Outflow") - End With -#End Region #Region "Case N-PQUAL" Case "N-PQUAL" With lConstituentsToOutput @@ -605,15 +590,15 @@ Public Module Utility .Add("R:N-TOT-OUT-EXIT5", " Total N OutflowExit5") End With - '.Add("R:TAM-OUTTOT-EXIT3", " Total NH3 Outflow-Exit3") - '.Add("R:TAM-OUTDIS-EXIT3", " Dissolved NH3 Outflow-Exit3") - '.Add("R:TAM-OUTPART-TOT-EXIT3", " Particulate NH3 Outflow-Exit3") + '.Add("R:TAM-OUTTOT-EXIT3", " Total NH3 Outflow-Exit3") + '.Add("R:TAM-OUTDIS-EXIT3", " Dissolved NH3 Outflow-Exit3") + '.Add("R:TAM-OUTPART-TOT-EXIT3", " Particulate NH3 Outflow-Exit3") - '.Add("R:NO3-OUTTOT-EXIT3", " Total NO3 Outflow - Exit 3") + '.Add("R:NO3-OUTTOT-EXIT3", " Total NO3 Outflow - Exit 3") - '.Add("R:N-TOT-OUT-EXIT1", " N-TOT-OUT-EXIT1") - '.Add("R:N-TOT-OUT-EXIT2", " N-TOT-OUT-EXIT2") - '.Add("R:N-TOT-OUT-EXIT3", " N-TOT-OUT-EXIT3") + '.Add("R:N-TOT-OUT-EXIT1", " N-TOT-OUT-EXIT1") + '.Add("R:N-TOT-OUT-EXIT2", " N-TOT-OUT-EXIT2") + '.Add("R:N-TOT-OUT-EXIT3", " N-TOT-OUT-EXIT3") #End Region #Region "Case TotalP" Case "TotalP" @@ -811,13 +796,33 @@ Public Module Utility .Add("R:BODFLUX-TOT", " BODFLUX-Total") .Add("R:BODOUTTOT", " BODOUTTOT") End With +#End Region +#Region "Case Else" + Case Else + Dim lUnits As String = aUnits + If aType.ToUpper.Contains("F.COLIFORM") Or aType.ToUpper.StartsWith("BACT") Then 'Assuming this is f.coli or bacteria + lUnits = "10^9 " & aUnits + End If + With lConstituentsToOutput + .Add("P:Header1", aType & " (" & lUnits & "/ac)") + .Add("P:SOQUAL-" & aType, " Surface") + .Add("P:IOQUAL-" & aType, " Interflow") + .Add("P:AOQUAL-" & aType, " Baseflow") + .Add("P:Total3", " Total") + .Add("I:Header2", aType & " (" & lUnits & "/ac)") + .Add("I:SOQUAL-" & aType, " ImpervSurf") + .Add("R:Header3", aType & " (" & lUnits & ")") + .Add("R:" & aType & "-TIQAL", " Inflow") + .Add("R:" & aType & "-DDQAL-TOT", " Decay") + .Add("R:" & aType & "-TROQAL", " Outflow") + End With #End Region End Select Return lConstituentsToOutput End Function - Public Function LandUses(ByVal aUci As HspfUci, _ - ByVal aOperationTypes As atcCollection, _ + Public Function LandUses(ByVal aUci As HspfUci, + ByVal aOperationTypes As atcCollection, Optional ByVal aOutletLocation As String = "") As atcCollection Dim lLocations As New atcCollection If aOutletLocation.Length > 0 Then @@ -875,25 +880,25 @@ Public Module Utility Return lLandUsesTemp End Function - Public Function UpstreamLocations(ByVal aUci As HspfUci, _ - ByVal aOperationTypes As atcCollection, _ + Public Function UpstreamLocations(ByVal aUci As HspfUci, + ByVal aOperationTypes As atcCollection, ByVal aLocation As String) As atcCollection Dim lLocations As New atcCollection 'key-location, value-total area UpstreamLocationAreaCalc(aUci, aLocation, aOperationTypes, lLocations) Return lLocations End Function - Private Sub UpstreamLocationAreaCalc(ByVal aUci As HspfUci, _ - ByVal aLocation As String, _ - ByVal aOperationTypes As atcCollection, _ + Private Sub UpstreamLocationAreaCalc(ByVal aUci As HspfUci, + ByVal aLocation As String, + ByVal aOperationTypes As atcCollection, ByRef aLocations As atcCollection) LocationAreaCalc(aUci, aLocation, aOperationTypes, aLocations, True) End Sub - Public Sub LocationAreaCalc(ByVal aUci As HspfUci, _ - ByVal aLocation As String, _ - ByVal aOperationTypes As atcCollection, _ - ByRef aLocations As atcCollection, _ + Public Sub LocationAreaCalc(ByVal aUci As HspfUci, + ByVal aLocation As String, + ByVal aOperationTypes As atcCollection, + ByRef aLocations As atcCollection, ByVal aUpstream As Boolean) Dim lOperName As String = aOperationTypes.ItemByKey(aLocation.Substring(0, 2)) @@ -915,8 +920,8 @@ Public Module Utility If aUpstream Then If lUpstreamChecked.Contains(lLocationKey) Then Logger.Dbg("SkipDuplicate:" & lLocationKey) - ElseIf aUci.Name.ToLower.Contains("scr") AndAlso _ - lConnection.Source.VolId = 229 AndAlso _ + ElseIf aUci.Name.ToLower.Contains("scr") AndAlso + lConnection.Source.VolId = 229 AndAlso lConnection.Target.VolId = 516 Then 'TODO: figure out a way not to hardcode this! Logger.Dbg("Skip 229 to 516 in SantaClara") @@ -950,7 +955,7 @@ Public Module Utility Return lArea End Function - Public Function CfsToInches(ByVal aTSerIn As atcTimeseries, _ + Public Function CfsToInches(ByVal aTSerIn As atcTimeseries, ByVal aArea As Double) As atcTimeseries Dim lConversionFactor As Double = (12.0# * 24.0# * 3600.0#) / (aArea * 43560.0#) 'cfs days to inches Dim lTsMath As atcTimeseriesSource = New atcTimeseriesMath.atcTimeseriesMath @@ -961,7 +966,7 @@ Public Module Utility Return lTsMath.DataSets(0) End Function - Public Function InchesToCfs(ByVal aTSerIn As atcTimeseries, _ + Public Function InchesToCfs(ByVal aTSerIn As atcTimeseries, ByVal aArea As Double) As atcTimeseries Dim lConversionFactor As Double = (aArea * 43560.0#) / (12.0# * 24.0# * 3600.0#) 'inches to cfs days Dim lInterval As Double = aTSerIn.Attributes.GetValue("interval", 1.0) @@ -974,29 +979,29 @@ Public Module Utility Return lTsMath.DataSets(0) End Function - Friend Sub CheckDateJ(ByVal aTSer As atcTimeseries, _ - ByVal aName As String, _ - ByRef aSDateJ As Double, _ - ByRef aEDateJ As Double, _ + Friend Sub CheckDateJ(ByVal aTSer As atcTimeseries, + ByVal aName As String, + ByRef aSDateJ As Double, + ByRef aEDateJ As Double, ByRef aStr As String) Dim lDateTmp As Double = aTSer.Dates.Values(0) If aSDateJ < lDateTmp Then - aStr &= " Adjusted Start Date from " & Format(Date.FromOADate(aSDateJ), "yyyy/MM/dd") & _ - "to " & Format(Date.FromOADate(lDateTmp), "yyyy/MM/dd") & _ + aStr &= " Adjusted Start Date from " & Format(Date.FromOADate(aSDateJ), "yyyy/MM/dd") & + "to " & Format(Date.FromOADate(lDateTmp), "yyyy/MM/dd") & " due to " & aName & vbCrLf & vbCrLf aSDateJ = lDateTmp End If lDateTmp = aTSer.Dates.Values(aTSer.numValues) If aEDateJ > lDateTmp Then - aStr &= " Adjusted End Date from " & Format(Date.FromOADate(aEDateJ), "yyyy/MM/dd") & _ - " to " & Format(Date.FromOADate(lDateTmp), "yyyy/MM/dd") & _ + aStr &= " Adjusted End Date from " & Format(Date.FromOADate(aEDateJ), "yyyy/MM/dd") & + " to " & Format(Date.FromOADate(lDateTmp), "yyyy/MM/dd") & " due to " & aName & vbCrLf & vbCrLf aEDateJ = lDateTmp End If End Sub - Public Function AreaReport(ByVal aUci As HspfUci, ByVal aRunMade As String, _ - ByVal aOperationTypes As atcCollection, ByVal aLocations As atcCollection, _ + Public Function AreaReport(ByVal aUci As HspfUci, ByVal aRunMade As String, + ByVal aOperationTypes As atcCollection, ByVal aLocations As atcCollection, ByVal aLandUseReport As Boolean, ByVal aReportPath As String) As atcReport.IReport Dim lReport As New atcReport.ReportText lReport.AppendLine("Area Summary Report") @@ -1015,8 +1020,8 @@ Public Module Utility Return lReport End Function - Private Function AreaReportLocation(ByVal aUci As HspfUci, ByVal aOperationtypes As atcCollection, _ - ByVal aLocation As String, ByVal aLandUseReport As Boolean, _ + Private Function AreaReportLocation(ByVal aUci As HspfUci, ByVal aOperationtypes As atcCollection, + ByVal aLocation As String, ByVal aLandUseReport As Boolean, ByVal aReportPath As String, ByVal aRunMade As String) As String If aLandUseReport Then Dim lReport As New atcReport.ReportText @@ -1025,9 +1030,9 @@ Public Module Utility lReport.AppendLine(" Run Made " & aRunMade) lReport.AppendLine(" " & aUci.GlobalBlock.RunInf.Value) lReport.AppendLine("") - lReport.AppendLine("Landuse".PadLeft(20) & vbTab & _ - "PervArea".PadLeft(12) & vbTab & _ - "ImpvArea".PadLeft(12) & vbTab & _ + lReport.AppendLine("Landuse".PadLeft(20) & vbTab & + "PervArea".PadLeft(12) & vbTab & + "ImpvArea".PadLeft(12) & vbTab & "TotalArea".PadLeft(12)) Dim lLandUses As atcCollection = LandUses(aUci, aOperationtypes, aLocation) Dim lLandUsesCombinePervImpv As atcCollection = LandUsesCombined(lLandUses) @@ -1046,9 +1051,9 @@ Public Module Utility Dim lLandUseArea As Double = lPervArea + lImprArea - lReport.AppendLine(lLandUsesCombinePervImpv.Keys(lLandUseIndex).ToString.PadLeft(20) & vbTab & _ - DecimalAlign(lPervArea, , 2, 7) & vbTab & _ - DecimalAlign(lImprArea, , 2, 7) & vbTab & _ + lReport.AppendLine(lLandUsesCombinePervImpv.Keys(lLandUseIndex).ToString.PadLeft(20) & vbTab & + DecimalAlign(lPervArea, , 2, 7) & vbTab & + DecimalAlign(lImprArea, , 2, 7) & vbTab & DecimalAlign(lLandUseArea, , 2, 7)) lTotalAreaPerv += lPervArea lTotalAreaImpr += lImprArea @@ -1057,9 +1062,9 @@ Public Module Utility lLandUsesCombinePervImpv.Clear() lLandUses.Clear() lReport.AppendLine("") - lReport.AppendLine("Total".PadLeft(20) & vbTab & _ - DecimalAlign(lTotalAreaPerv, , 2, 7) & vbTab & _ - DecimalAlign(lTotalAreaImpr, , 2, 7) & vbTab & _ + lReport.AppendLine("Total".PadLeft(20) & vbTab & + DecimalAlign(lTotalAreaPerv, , 2, 7) & vbTab & + DecimalAlign(lTotalAreaImpr, , 2, 7) & vbTab & DecimalAlign(lTotalAreaFromLandUses, , 2, 7)) SaveFileString(aReportPath & SafeFilename("AreaLanduse_" & aLocation & ".txt"), lReport.ToString) End If @@ -1096,9 +1101,9 @@ Public Module Utility lStr &= AreaReportLocation(aUci, aOperationtypes, lUpstreamLocation, aLandUseReport, aReportPath, aRunMade) Next lUpstreamLocations.Clear() - lStr &= aLocation.PadRight(8) & vbTab & _ - DecimalAlign(lTotalArea, , 2, 7) & vbTab & _ - DecimalAlign(lLocalArea, , 2, 7) & vbTab & _ + lStr &= aLocation.PadRight(8) & vbTab & + DecimalAlign(lTotalArea, , 2, 7) & vbTab & + DecimalAlign(lLocalArea, , 2, 7) & vbTab & lUpstreamLocationsString & vbCrLf Return lStr End Function @@ -1135,7 +1140,8 @@ Public Module Utility End Function Public Function FindMassLinkFactor(ByVal aUCI As HspfUci, ByVal aMassLink As Integer, ByVal aConstituent As String, - ByVal aBalanceType As String, ByVal aConversionFactor As Double, ByVal aMultipleIndex As Integer) As Double + ByVal aBalanceType As String, ByVal aConversionFactor As Double, ByVal aMultipleIndex As Integer, + Optional ByVal aGQALID As Integer = 0) As Double 'If aConstituent = "TAM" Then aConstituent = "NH3+NH4" Dim lMassLinkFactor As Double = 0.0 For Each lMassLink As HspfMassLink In aUCI.MassLinks @@ -1164,19 +1170,6 @@ Public Module Utility Case "TotalN" Select Case True - Case (aConstituent = "NO3+NO2-N - SURFACE LAYER OUTFLOW" OrElse aConstituent = "NO3+NO2-N - UPPER LAYER OUTFLOW" OrElse - aConstituent = "NO3+NO2-N - GROUNDWATER OUTFLOW" OrElse aConstituent = "NO3-N - TOTAL OUTFLOW") AndAlso - lMassLink.Target.Member.ToString = "NUIF1" And lMassLink.Target.MemSub1 = 1 - lMassLinkFactor = lMassLink.MFact - Return lMassLinkFactor - - Case (aConstituent = "NH4-N IN SOLUTION - SURFACE LAYER OUTFLOW" OrElse aConstituent = "NH4-N IN SOLUTION - UPPER LAYER OUTFLOW" OrElse - aConstituent = "NH4-N IN SOLUTION - GROUNDWATER OUTFLOW") AndAlso lMassLink.Target.Member.ToString = "NUIF1" AndAlso lMassLink.Target.MemSub1 = 2 - lMassLinkFactor = lMassLink.MFact - Return lMassLinkFactor - Case aConstituent = "NH4-N ADS - SEDIMENT ASSOC OUTFLOW" AndAlso lMassLink.Target.Member.ToString = "NUIF2" AndAlso - lMassLink.Target.MemSub2 = 1 'lMassLink.Target.MemSub1 = 1 AndAlso - lMassLinkFactor += lMassLink.MFact Case (aConstituent = "SOQUAL-NH3+NH4" OrElse aConstituent = "SOQO-NH3+NH4") AndAlso lMassLink.Target.Member.ToString = "NUIF1" AndAlso lMassLink.Target.MemSub1 = 2 AndAlso (lMassLink.Source.Member = "SOQUAL" OrElse lMassLink.Source.Member = "POQUAL") lMassLinkFactor = lMassLink.MFact @@ -1189,9 +1182,34 @@ Public Module Utility (lMassLink.Source.Member = "IOQUAL" OrElse lMassLink.Source.Member = "POQUAL") lMassLinkFactor = lMassLink.MFact Return lMassLinkFactor - Case (aConstituent = "WASHQS-NH3+NH4" OrElse aConstituent = "SCRQS-NH3+NH4") AndAlso lMassLink.Target.Member.ToString = "NUIF1" AndAlso - lMassLink.Target.MemSub1 = 2 AndAlso (lMassLink.Source.Member = "SOQUAL" OrElse lMassLink.Source.Member = "POQUAL") + + 'When dissolved Nh3+NH4 enters into strean as sediment attached. + + Case aConstituent = "SOQO-NH3+NH4" AndAlso lMassLink.Target.Member.ToString = "NUIF2" AndAlso lMassLink.Target.MemSub1 = 1 AndAlso + (lMassLink.Source.Member = "SOQUAL" OrElse lMassLink.Source.Member = "POQUAL") + lMassLinkFactor += lMassLink.MFact + + + 'When sediment associated NH3+NH4 enters into stream as dissolved + Case aConstituent = "WASHQS-NH3+NH4" AndAlso lMassLink.Target.Member.ToString = "NUIF1" AndAlso lMassLink.Target.MemSub1 = 2 AndAlso + (lMassLink.Source.Member = "SOQUAL" OrElse lMassLink.Source.Member = "POQUAL") lMassLinkFactor = lMassLink.MFact + Case aConstituent = "SCRQS-NH3+NH4" AndAlso lMassLink.Target.Member.ToString = "NUIF1" AndAlso lMassLink.Target.MemSub1 = 2 AndAlso + (lMassLink.Source.Member = "SOQUAL" OrElse lMassLink.Source.Member = "POQUAL") + lMassLinkFactor = lMassLink.MFact + Case aConstituent = "SOQS-NH3+NH4" AndAlso lMassLink.Target.Member.ToString = "NUIF1" AndAlso lMassLink.Target.MemSub1 = 2 AndAlso + (lMassLink.Source.Member = "SOQUAL" OrElse lMassLink.Source.Member = "SOQS") + lMassLinkFactor = lMassLink.MFact + + 'When sediment associated NH3+NH4 enters into stream as associated with sediment + Case aConstituent = "WASHQS-NH3+NH4" AndAlso lMassLink.Target.Member.ToString = "NUIF2" AndAlso lMassLink.Target.MemSub2 = 1 AndAlso + (lMassLink.Source.Member = "SOQUAL" OrElse lMassLink.Source.Member = "POQUAL" OrElse lMassLink.Source.Member = "WASHQS" OrElse lMassLink.Source.Member = "SOQS") + lMassLinkFactor += lMassLink.MFact + Case aConstituent = "SCRQS-NH3+NH4" AndAlso lMassLink.Target.Member.ToString = "NUIF2" AndAlso lMassLink.Target.MemSub2 = 1 AndAlso + (lMassLink.Source.Member = "SOQUAL" OrElse lMassLink.Source.Member = "POQUAL" OrElse lMassLink.Source.Member = "SCRQS" OrElse lMassLink.Source.Member = "SOQS") + lMassLinkFactor += lMassLink.MFact + + Case (aConstituent = "SOQUAL-NO3" OrElse aConstituent = "SOQO-NO3") AndAlso lMassLink.Target.Member.ToString = "NUIF1" AndAlso lMassLink.Target.MemSub1 = 1 AndAlso (lMassLink.Source.Member = "SOQUAL" OrElse lMassLink.Source.Member = "POQUAL") lMassLinkFactor = lMassLink.MFact @@ -1204,6 +1222,7 @@ Public Module Utility (lMassLink.Source.Member = "IOQUAL" OrElse lMassLink.Source.Member = "POQUAL") lMassLinkFactor = lMassLink.MFact Return lMassLinkFactor + Case (aConstituent = "WASHQS-BOD" OrElse aConstituent = "SCRQS-BOD" OrElse aConstituent = "SOQO-BOD" OrElse aConstituent = "SOQUAL-BOD" OrElse aConstituent = "WASHQS-Ref-OrgN" OrElse aConstituent = "SCRQS-Ref-OrgN" OrElse aConstituent = "SOQO-Ref-OrgN" OrElse aConstituent = "SOQUAL-Ref-OrgN" OrElse aConstituent = "WASHQS-lab-OrgN" OrElse aConstituent = "SCRQS-lab-OrgN" OrElse aConstituent = "SOQO-lab-OrgN" OrElse aConstituent = "SOQUAL-lab-OrgN") AndAlso @@ -1239,6 +1258,20 @@ Public Module Utility lMassLinkFactor = lMassLink.MFact + BODMFact(aUCI, "AOQUAL-BOD", lMassLink.MassLinkId) * aConversionFactor End If Return lMassLinkFactor + + 'Following are AGCHEM cases + Case (aConstituent = "NO3+NO2-N - SURFACE LAYER OUTFLOW" OrElse aConstituent = "NO3+NO2-N - UPPER LAYER OUTFLOW" OrElse + aConstituent = "NO3+NO2-N - GROUNDWATER OUTFLOW" OrElse aConstituent = "NO3-N - TOTAL OUTFLOW") AndAlso + lMassLink.Target.Member.ToString = "NUIF1" And lMassLink.Target.MemSub1 = 1 + lMassLinkFactor = lMassLink.MFact + Return lMassLinkFactor + Case (aConstituent = "NH4-N IN SOLUTION - SURFACE LAYER OUTFLOW" OrElse aConstituent = "NH4-N IN SOLUTION - UPPER LAYER OUTFLOW" OrElse + aConstituent = "NH4-N IN SOLUTION - GROUNDWATER OUTFLOW") AndAlso lMassLink.Target.Member.ToString = "NUIF1" AndAlso lMassLink.Target.MemSub1 = 2 + lMassLinkFactor = lMassLink.MFact + Return lMassLinkFactor + Case aConstituent = "NH4-N ADS - SEDIMENT ASSOC OUTFLOW" AndAlso lMassLink.Target.Member.ToString = "NUIF2" AndAlso + lMassLink.Target.MemSub2 = 1 'lMassLink.Target.MemSub1 = 1 AndAlso + lMassLinkFactor += lMassLink.MFact Case aConstituent = "ORGN - TOTAL OUTFLOW" AndAlso lMassLink.Target.Member.ToString = "PKIF" AndAlso lMassLink.Target.MemSub1 = 3 If aMultipleIndex = 2 Then lMassLinkFactor = lMassLink.MFact @@ -1260,6 +1293,7 @@ Public Module Utility lMassLinkFactor = 1 Return lMassLinkFactor + End Select ' 'Anurag does not remember what specific cases do three following lines address. @@ -1280,7 +1314,7 @@ Public Module Utility Select Case True Case (aConstituent = "SOQUAL-PO4" OrElse aConstituent = "SOQO-PO4") AndAlso lMassLink.Target.Member.ToString = "NUIF1" AndAlso lMassLink.Target.MemSub1 = 4 AndAlso (lMassLink.Source.Member = "SOQUAL" OrElse lMassLink.Source.Member = "POQUAL") - lMassLinkFactor = lMassLink.MFact + lMassLinkFactor += lMassLink.MFact Return lMassLinkFactor Case aConstituent = "AOQUAL-PO4" AndAlso lMassLink.Target.Member.ToString = "NUIF1" AndAlso lMassLink.Target.MemSub1 = 4 AndAlso (lMassLink.Source.Member = "AOQUAL" OrElse lMassLink.Source.Member = "POQUAL") @@ -1289,13 +1323,32 @@ Public Module Utility Case aConstituent = "IOQUAL-PO4" AndAlso lMassLink.Target.Member.ToString = "NUIF1" AndAlso lMassLink.Target.MemSub1 = 4 AndAlso (lMassLink.Source.Member = "IOQUAL" OrElse lMassLink.Source.Member = "POQUAL") lMassLinkFactor += lMassLink.MFact - Case (aConstituent = "WASHQS-PO4" OrElse aConstituent = "SCRQS-PO4") AndAlso lMassLink.Target.Member.ToString = "NUIF2" AndAlso - lMassLink.Target.MemSub2 = 2 AndAlso (lMassLink.Source.Member = "SOQUAL" OrElse lMassLink.Source.Member = "POQUAL") + + 'if dissolved PO4 enters into stream as sediment attached PO4 + Case aConstituent = "SOQO-PO4" AndAlso lMassLink.Target.Member.ToString = "NUIF2" AndAlso lMassLink.Target.MemSub2 = 2 AndAlso + (lMassLink.Source.Member = "SOQUAL" OrElse lMassLink.Source.Member = "POQUAL") lMassLinkFactor += lMassLink.MFact - Case (aConstituent = "WASHQS-PO4" OrElse aConstituent = "SCRQS-PO4") AndAlso lMassLink.Target.Member.ToString = "NUIF1" AndAlso - lMassLink.Target.MemSub1 = 4 AndAlso (lMassLink.Source.Member = "SOQUAL" OrElse lMassLink.Source.Member = "POQUAL") - lMassLinkFactor = lMassLink.MFact + + 'If sediment associated PO4 enters into stream as dissolved PO4 + Case (aConstituent = "WASHQS-PO4" OrElse aConstituent = "SCRQS-PO4" OrElse aConstituent = "SOQS-PO4") AndAlso + lMassLink.Target.Member.ToString = "NUIF1" AndAlso lMassLink.Target.MemSub1 = 4 AndAlso + (lMassLink.Source.Member = "SOQUAL" OrElse lMassLink.Source.Member = "POQUAL") + lMassLinkFactor += lMassLink.MFact + 'Return lMassLinkFactor + + 'If sediment associated PO4 enters into stream as sediment associated + Case aConstituent = "WASHQS-PO4" AndAlso lMassLink.Target.Member.ToString = "NUIF2" AndAlso lMassLink.Target.MemSub2 = 2 AndAlso + (lMassLink.Source.Member = "SOQUAL" OrElse lMassLink.Source.Member = "POQUAL" OrElse lMassLink.Source.Member = "WASHQS" OrElse lMassLink.Source.Member = "SOQS") + lMassLinkFactor += lMassLink.MFact + + Case aConstituent = "SCRQS-PO4" AndAlso lMassLink.Target.Member.ToString = "NUIF2" AndAlso lMassLink.Target.MemSub2 = 2 AndAlso + (lMassLink.Source.Member = "SOQUAL" OrElse lMassLink.Source.Member = "POQUAL" OrElse lMassLink.Source.Member = "SCRQS" OrElse lMassLink.Source.Member = "SOQS") + lMassLinkFactor += lMassLink.MFact + + Case aConstituent = "SOQS-PO4" AndAlso lMassLink.Target.Member.ToString = "NUIF2" AndAlso lMassLink.Target.MemSub2 = 2 AndAlso + (lMassLink.Source.Member = "SOQUAL" OrElse lMassLink.Source.Member = "SOQS") + lMassLinkFactor += lMassLink.MFact Case (aConstituent = "SOQUAL-ORTHO P" OrElse aConstituent = "SOQO-ORTHO P") AndAlso lMassLink.Target.Member.ToString = "NUIF1" AndAlso lMassLink.Target.MemSub1 = 4 AndAlso (lMassLink.Source.Member = "SOQUAL" OrElse lMassLink.Source.Member = "POQUAL") @@ -1309,11 +1362,30 @@ Public Module Utility (lMassLink.Source.Member = "IOQUAL" OrElse lMassLink.Source.Member = "POQUAL") lMassLinkFactor = lMassLink.MFact Return lMassLinkFactor - Case (aConstituent = "WASHQS-ORTHO P" OrElse aConstituent = "SCRQS-ORTHO P") AndAlso lMassLink.Target.Member.ToString = "NUIF1" AndAlso - lMassLink.Target.MemSub1 = 4 AndAlso (lMassLink.Source.Member = "SOQUAL" OrElse lMassLink.Source.Member = "POQUAL") + + 'if dissolved PO4 enters into stream as sediment attached PO4 + Case aConstituent = "SOQO-ORTHO P" AndAlso lMassLink.Target.Member.ToString = "NUIF2" AndAlso lMassLink.Target.MemSub2 = 2 AndAlso + (lMassLink.Source.Member = "SOQUAL" OrElse lMassLink.Source.Member = "POQUAL") + lMassLinkFactor += lMassLink.MFact + + + 'If sediment associated PO4 enters into stream as dissolved PO4 + Case (aConstituent = "WASHQS-ORTHO P" OrElse aConstituent = "SCRQS-ORTHO P" OrElse aConstituent = "SOQS-ORTHO P") AndAlso + lMassLink.Target.Member.ToString = "NUIF1" AndAlso lMassLink.Target.MemSub1 = 4 AndAlso + (lMassLink.Source.Member = "SOQUAL" OrElse lMassLink.Source.Member = "POQUAL") + lMassLinkFactor = lMassLink.MFact + Return lMassLinkFactor + 'If sediment associated PO4 enters into stream as sediment associated + Case aConstituent = "WASHQS-ORTHO P" AndAlso lMassLink.Target.Member.ToString = "NUIF2" AndAlso lMassLink.Target.MemSub2 = 2 AndAlso + (lMassLink.Source.Member = "SOQUAL" OrElse lMassLink.Source.Member = "POQUAL" OrElse lMassLink.Source.Member = "WASHQS" OrElse lMassLink.Source.Member = "SOQS") + lMassLinkFactor += lMassLink.MFact + + Case aConstituent = "SCRQS-ORTHO P" AndAlso lMassLink.Target.Member.ToString = "NUIF2" AndAlso lMassLink.Target.MemSub2 = 2 AndAlso + (lMassLink.Source.Member = "SOQUAL" OrElse lMassLink.Source.Member = "POQUAL" OrElse lMassLink.Source.Member = "SCRQS" OrElse lMassLink.Source.Member = "SOQS") lMassLinkFactor += lMassLink.MFact - Case (aConstituent = "WASHQS-ORTHO P" OrElse aConstituent = "SCRQS-ORTHO P") AndAlso lMassLink.Target.Member.ToString = "NUIF2" AndAlso - lMassLink.Target.MemSub2 = 2 AndAlso (lMassLink.Source.Member = "SOQUAL" OrElse lMassLink.Source.Member = "POQUAL") + + Case aConstituent = "SOQS-ORTHO P" AndAlso lMassLink.Target.Member.ToString = "NUIF2" AndAlso lMassLink.Target.MemSub2 = 2 AndAlso + (lMassLink.Source.Member = "SOQUAL" OrElse lMassLink.Source.Member = "SOQS") lMassLinkFactor += lMassLink.MFact Case (aConstituent = "WASHQS-BOD" OrElse aConstituent = "SCRQS-BOD" OrElse aConstituent = "SOQO-BOD" OrElse aConstituent = "SOQUAL-BOD" OrElse @@ -1494,11 +1566,11 @@ Public Module Utility Case "BOD-Labile" Select Case True - Case (lMassLink.Source.Member = "SOQUAL" OrElse lMassLink.Source.Member = "POQUAL" OrElse lMassLink.Source.Member = "WASHQS") AndAlso + Case (lMassLink.Source.Member = "SOQUAL" OrElse lMassLink.Source.Member = "POQUAL" OrElse lMassLink.Source.Member = "WASHQS" OrElse lMassLink.Source.Member = "SOQS") AndAlso aConstituent = "WASHQS-BOD-Labile" AndAlso lMassLink.Target.Member = "OXIF" AndAlso lMassLink.Target.MemSub1 = 2 lMassLinkFactor = lMassLink.MFact Return lMassLinkFactor - Case (lMassLink.Source.Member = "SOQUAL" OrElse lMassLink.Source.Member = "POQUAL" OrElse lMassLink.Source.Member = "SCRQS") AndAlso + Case (lMassLink.Source.Member = "SOQUAL" OrElse lMassLink.Source.Member = "POQUAL" OrElse lMassLink.Source.Member = "SCRQS" OrElse lMassLink.Source.Member = "SOQS") AndAlso aConstituent = "SCRQS-BOD-Labile" AndAlso lMassLink.Target.Member = "OXIF" AndAlso lMassLink.Target.MemSub1 = 2 lMassLinkFactor = lMassLink.MFact Return lMassLinkFactor @@ -1552,6 +1624,32 @@ Public Module Utility "SOHT_POHT_IHEAT_1", "IOHT_POHT_IHEAT_1", "AOHT_POHT_IHEAT_1" lMassLinkFactor = lMassLink.MFact End Select + Case Else + + Select Case True + 'Need to do it for sediment associated GQUAL + Case aConstituent.Contains("SOQO") AndAlso lMassLink.Target.Member = "IDQAL" AndAlso lMassLink.Target.MemSub1 = aGQALID AndAlso + (lMassLink.Source.Member = "POQUAL" OrElse lMassLink.Source.Member = "SOQUAL") + lMassLinkFactor = lMassLink.MFact + Return lMassLinkFactor + Case aConstituent.Contains("IOQUAL") AndAlso lMassLink.Target.Member = "IDQAL" AndAlso lMassLink.Target.MemSub1 = aGQALID AndAlso + (lMassLink.Source.Member = "POQUAL" OrElse lMassLink.Source.Member = "IOQUAL") + lMassLinkFactor = lMassLink.MFact + Return lMassLinkFactor + Case aConstituent.Contains("AOQUAL") AndAlso lMassLink.Target.Member = "IDQAL" AndAlso lMassLink.Target.MemSub1 = aGQALID AndAlso + (lMassLink.Source.Member = "POQUAL" OrElse lMassLink.Source.Member = "AOQUAL") + lMassLinkFactor = lMassLink.MFact + Return lMassLinkFactor + Case aConstituent.Contains("WASHQS") AndAlso lMassLink.Target.Member = "ISQAL" AndAlso lMassLink.Target.MemSub2 = aGQALID AndAlso + (lMassLink.Source.Member = "POQUAL" Or lMassLink.Source.Member = "SOQUAL" OrElse lMassLink.Source.Member = "WASHQS" OrElse lMassLink.Source.Member = "SOQS") + lMassLinkFactor += lMassLink.MFact + Case aConstituent.Contains("SCRQS") AndAlso lMassLink.Target.Member = "ISQAL" AndAlso lMassLink.Target.MemSub2 = aGQALID AndAlso + (lMassLink.Source.Member = "POQUAL" Or lMassLink.Source.Member = "SOQUAL" OrElse lMassLink.Source.Member = "SCRQS" OrElse lMassLink.Source.Member = "SOQS") + lMassLinkFactor += lMassLink.MFact + Case aConstituent.Contains("SOQS") AndAlso lMassLink.Target.Member = "ISQAL" AndAlso lMassLink.Target.MemSub2 = aGQALID AndAlso + (lMassLink.Source.Member = "SOQUAL" OrElse lMassLink.Source.Member = "SOQS") + lMassLinkFactor += lMassLink.MFact + End Select End Select Next @@ -1562,9 +1660,9 @@ Public Module Utility End Function Public Function BODMFact(ByVal aUCI As HspfUci, ByVal aconstituent As String, ByVal aMassLinkID As Integer) As Double For Each lMasslink As HspfMassLink In aUCI.MassLinks - If lMasslink.MassLinkId = aMassLinkID AndAlso _ - (lMasslink.Source.Member.Substring(0, 2) = "PO" Or lMasslink.Source.Member.Substring(0, 2) = aconstituent.Substring(0, 2)) AndAlso _ - lMasslink.Target.Member = "OXIF" AndAlso _ + If lMasslink.MassLinkId = aMassLinkID AndAlso + (lMasslink.Source.Member.Substring(0, 2) = "PO" Or lMasslink.Source.Member.Substring(0, 2) = aconstituent.Substring(0, 2)) AndAlso + lMasslink.Target.Member = "OXIF" AndAlso lMasslink.Target.MemSub1 = 2 Then Return lMasslink.MFact @@ -1629,7 +1727,7 @@ Public Module Utility End Function - Public Function LocateConstituentNames(ByVal aUCI As HspfUci, ByVal aBalanceType As String) As List(Of ConstituentProperties) + Public Function LocateConstituentNames(ByVal aUCI As HspfUci, ByVal aBalanceType As String, Optional ByVal aGQALID As Integer = 0) As List(Of ConstituentProperties) Dim QUALs As New List(Of ConstituentProperties) Dim QUALNames As ConstituentProperties Dim QUALName As String = "" @@ -1907,6 +2005,47 @@ Public Module Utility Else QUALNames.ConstituentUnit = QUALs(0).ConstituentUnit End If + QUALNames.ReportType = aBalanceType + QUALs.Add(QUALNames) + Return QUALs + Case "BOD-Labile" + Return QUALs + + Case Else + QUALNames = New ConstituentProperties + QUALNames.ConstNameForEXPPlus = aBalanceType + QUALNames.ConstituentNameInUCI = aBalanceType + lTableName = "QUAL-PROPS" + 'If aGQALID > 1 Then lTableName = lTableName & ":" & aGQALID + Dim lTempQual As String = "" + Dim lUnits As String = "" + + If lOper.TableExists(lTableName) Then + lTempQual = Trim(lOper.Tables(lTableName).Parms("QUALID").Value) + If aBalanceType = lTempQual Then + 'found it + lUnits = Trim(lOper.Tables(lTableName).Parms("QTYID").Value) + End If + End If + Do While lUnits.Length = 0 + For lIndex As Integer = 2 To 10 + If lOper.TableExists(lTableName & ":" & lIndex.ToString) Then + lTempQual = Trim(lOper.Tables(lTableName & ":" & lIndex.ToString).Parms("QUALID").Value) + If aBalanceType = lTempQual Then + 'found it + lUnits = Trim(lOper.Tables(lTableName & ":" & lIndex.ToString).Parms("QTYID").Value) + Exit For + End If + End If + Next + Loop + + If aUCI.GlobalBlock.EmFg = 1 Then + QUALNames.ConstituentUnit = lUnits & "/ac" + Else + QUALNames.ConstituentUnit = lUnits & "/ha" + End If + QUALNames.ReportType = aBalanceType QUALs.Add(QUALNames) Return QUALs @@ -1931,7 +2070,8 @@ Public Module Utility End Function Public Function ConstituentList(ByVal aBalanceType As String, Optional ByVal QualityConstituent As String = "", - Optional ByVal EXPPlusName As String = "", Optional ByVal AgChemConst As Boolean = False) As Dictionary(Of String, String) + Optional ByVal EXPPlusName As String = "", Optional ByVal AgChemConst As Boolean = False, + Optional ByVal aOperName As String = "") As Dictionary(Of String, String) 'Design for AGCHEM Case as well. Dim lOutflowDataType As New Dictionary(Of String, String) Select Case aBalanceType @@ -1970,20 +2110,34 @@ Public Module Utility lOutflowDataType.Add("AOHT", "AOHT") lOutflowDataType.Add("TotalOutflow", "TotalOutflow") - Case Else + Case "TotalN", "TotalP" If EXPPlusName = "TAM" Then EXPPlusName = "NH3+NH4" - lOutflowDataType.Add("WASHQS" & "-" & EXPPlusName, "WASHQS" & "-" & QualityConstituent) - lOutflowDataType.Add("SCRQS" & "-" & EXPPlusName, "SCRQS" & "-" & QualityConstituent) - lOutflowDataType.Add("SOQO" & "-" & EXPPlusName, "SOQO" & "-" & QualityConstituent) - lOutflowDataType.Add("IOQUAL" & "-" & EXPPlusName, "IOQUAL" & "-" & QualityConstituent) - lOutflowDataType.Add("AOQUAL" & "-" & EXPPlusName, "AOQUAL" & "-" & QualityConstituent) + If aOperName = "PERLND" Then + lOutflowDataType.Add("WASHQS" & "-" & EXPPlusName, "WASHQS" & "-" & QualityConstituent) + lOutflowDataType.Add("SCRQS" & "-" & EXPPlusName, "SCRQS" & "-" & QualityConstituent) + lOutflowDataType.Add("SOQO" & "-" & EXPPlusName, "SOQO" & "-" & QualityConstituent) + lOutflowDataType.Add("IOQUAL" & "-" & EXPPlusName, "IOQUAL" & "-" & QualityConstituent) + lOutflowDataType.Add("AOQUAL" & "-" & EXPPlusName, "AOQUAL" & "-" & QualityConstituent) + ElseIf aOperName = "IMPLND" Then + lOutflowDataType.Add("SOQS" & "-" & EXPPlusName, "SOQS" & "-" & QualityConstituent) + lOutflowDataType.Add("SOQO" & "-" & EXPPlusName, "SOQO" & "-" & QualityConstituent) + End If + lOutflowDataType.Add("TotalOutflow" & "-" & EXPPlusName, "TotalOutflow" & "-" & QualityConstituent) + Case Else + 'case for GQuals + If aOperName = "PERLND" Then + lOutflowDataType.Add("WASHQS" & "-" & EXPPlusName, "WASHQS" & "-" & QualityConstituent) + lOutflowDataType.Add("SCRQS" & "-" & EXPPlusName, "SCRQS" & "-" & QualityConstituent) + lOutflowDataType.Add("SOQO" & "-" & EXPPlusName, "SOQO" & "-" & QualityConstituent) + lOutflowDataType.Add("IOQUAL" & "-" & EXPPlusName, "IOQUAL" & "-" & QualityConstituent) + lOutflowDataType.Add("AOQUAL" & "-" & EXPPlusName, "AOQUAL" & "-" & QualityConstituent) + ElseIf aOperName = "IMPLND" Then + lOutflowDataType.Add("SOQS" & "-" & EXPPlusName, "SOQS" & "-" & QualityConstituent) + lOutflowDataType.Add("SOQO" & "-" & EXPPlusName, "SOQO" & "-" & QualityConstituent) + End If lOutflowDataType.Add("TotalOutflow" & "-" & EXPPlusName, "TotalOutflow" & "-" & QualityConstituent) End Select - - - - Return lOutflowDataType End Function @@ -2009,34 +2163,45 @@ Public Module Utility Next Return aExitNumber End Function - Public Function GetGENERSum(ByVal aUCI As HspfUci, ByVal aSource As HspfConnection, ByVal aSDateJ As Double, ByVal aEDateJ As Double) As Tuple(Of Double, Boolean) - Dim aGenerSum As Double = 0 - Dim aGENERID As Integer = aSource.Source.VolId - Dim aGENEROperationisOutputtoWDM As Boolean = False - Dim aGENEROperation As HspfOperation = aSource.Source.Opn - For Each EXTTarget As HspfConnection In aGENEROperation.Targets - If EXTTarget.Target.VolName.Contains("WDM") Then - aGENEROperationisOutputtoWDM = True - Dim lWDMFile As String = EXTTarget.Target.VolName.ToString - Dim lDSN As Integer = EXTTarget.Target.VolId - For i As Integer = 0 To aUCI.FilesBlock.Count - If aUCI.FilesBlock.Value(i).Typ = lWDMFile Then - Dim lFileName As String = AbsolutePath(aUCI.FilesBlock.Value(i).Name.Trim, CurDir()) - Dim lDataSource As atcDataSource = atcDataManager.DataSourceBySpecification(lFileName) - If lDataSource Is Nothing Then - If atcDataManager.OpenDataSource(lFileName) Then - lDataSource = atcDataManager.DataSourceBySpecification(lFileName) - End If - End If - Dim ltimeseries As atcTimeseries = lDataSource.DataSets.FindData("ID", lDSN)(0) - ltimeseries = SubsetByDate(ltimeseries, aSDateJ, aEDateJ, Nothing) - aGenerSum = ltimeseries.Attributes.GetDefinedValue("Sum").Value / YearCount(aSDateJ, aEDateJ) + Public Function GQualUnits(ByVal aUCI As HspfUci, ByVal aGQualName As String) As String + 'given a uci and gqualname, return the units of the gqual + Dim lUnits As String = "" + 'Dim GQALID As Integer = Right(aGQualName, 1) + Dim lOper As New HspfOperation + For Each Oper As HspfOperation In aUCI.OpnBlks("RCHRES").Ids + If Oper.Tables("ACTIVITY").Parms("GQALFG").Value = "1" Then + lOper = Oper + 'Find First operation with active GQALFG + Exit For + End If + Next + + If lOper IsNot Nothing Then + Dim lTableName As String = "GQ-QALDATA" + 'If GQALID > 1 Then lTableName = lTableName & ":" & GQALID + Dim lTempQual As String = "" + If lOper.TableExists(lTableName) Then + lTempQual = Trim(lOper.Tables(lTableName).Parms("GQID").Value) + If aGQualName = lTempQual Then + 'found it + lUnits = Trim(lOper.Tables(lTableName).Parms("QTYID").Value) + End If + End If + 'Do While lUnits.Length = 0 + For lIndex As Integer = 2 To 10 + If lOper.TableExists(lTableName & ":" & lIndex.ToString) Then + lTempQual = Trim(lOper.Tables(lTableName & ":" & lIndex.ToString).Parms("GQID").Value) + If aGQualName = lTempQual Then + 'found it + lUnits = Trim(lOper.Tables(lTableName & ":" & lIndex.ToString).Parms("QTYID").Value) + Exit For + End If End If Next - End If - Next EXTTarget + 'Loop + End If - Return New Tuple(Of Double, Boolean)(aGenerSum, aGENEROperationisOutputtoWDM) + Return lUnits End Function End Module diff --git a/atcTimeseriesHDF5/atcDataSourceTimeseriesHDF5.vb b/atcTimeseriesHDF5/atcDataSourceTimeseriesHDF5.vb index 242abe80f..6cd5c7ff1 100644 --- a/atcTimeseriesHDF5/atcDataSourceTimeseriesHDF5.vb +++ b/atcTimeseriesHDF5/atcDataSourceTimeseriesHDF5.vb @@ -49,18 +49,29 @@ Public Class atcDataSourceTimeseriesHSF5 End Get End Property - Public ReadOnly Property Label() As String Get Return "HDF5" End Get End Property + ''' + ''' timeseries class for HDF5 files produced by HSP2, read only for now + ''' + ''' name of existing hdf5 file, if missing or blank - query user for name + ''' optional options + ''' Public Overrides Function Open(ByVal aFileName As String, Optional ByVal aAttributes As atcData.atcDataAttributes = Nothing) As Boolean Dim lAttributes As atcData.atcDataAttributes = aAttributes - If lAttributes Is Nothing Then + If lAttributes Is Nothing Then 'no options provided, provide empty class to avoid problems lAttributes = New atcData.atcDataAttributes + Else 'summarize options + Debug.Print("OpenHDF5 File:'" & aFileName & "' Options:") + For Each lAttribue As atcData.atcDefinedValue In lAttributes + Debug.Print(lAttribue.Definition.Name & ":" & lAttribue.Value) + Next End If + If MyBase.Open(aFileName, lAttributes) Then H5.Open() Debug.Print("H5Version " & H5.Version.Major & ":" & H5.Version.Minor) @@ -71,8 +82,7 @@ Public Class atcDataSourceTimeseriesHSF5 Dim lGrpId As H5GroupId Dim lAtCnt As Integer - If lAttributes.GetValue("ProcessInputTS", True) Then - 'input timeseries + If lAttributes.GetValue("ProcessInputTS", True) Then 'input timeseries lGrpName = "/TIMESERIES" lGrpId = H5G.open(lFileId, lGrpName) lAtCnt = H5A.getNumberOfAttributes(lGrpId) @@ -82,6 +92,7 @@ Public Class atcDataSourceTimeseriesHSF5 For lTsID As Integer = 0 To lCnt - 1 Dim lTsName As String = H5G.getObjectNameByIndex(lGrpId, lTsID) If lTsName.StartsWith("TS") Then + 'cant use dates from earlier thimeseries because each one is independent! AddDataSet(BuildTimeSeries(lGrpId, lTsName, "OBSERVED")) End If Next @@ -90,11 +101,17 @@ Public Class atcDataSourceTimeseriesHSF5 Debug.Print("Input Timeseries Skipped " & DataSets.Count) End If - If lAttributes.GetValue("ProcessOutputTS", True) Then - 'output timeseries + If lAttributes.GetValue("ProcessOutputTS", True) Then 'output timeseries Dim lOutputConstituent As String = lAttributes.GetValue("OutputConstituent", "") Dim lOutputLocation As String = lAttributes.GetValue("OutputLocation", "") + Dim lOutputSection As New atcAttributeDefinition + lOutputSection.Name = "OutputSection" + lOutputSection.DefaultValue = Nothing + Dim lOutputColumn As New atcAttributeDefinition + lOutputColumn.Name = "OutputColumn" + lOutputColumn.DefaultValue = Nothing + lGrpName = "/RESULTS" lGrpId = H5G.open(lFileId, lGrpName) lAtCnt = H5A.getNumberOfAttributes(lGrpId) @@ -132,13 +149,20 @@ Public Class atcDataSourceTimeseriesHSF5 lTimeSeries.Attributes.Add("Constituent", lConsName) lTimeSeries.Attributes.Add("Location", lOpnName) lTimeSeries.Attributes.Add("Scenario", "Simulated") - If lConsDateDatasetIndex < 200 Then 'too many datasets run out of memory, need to just build headers then read data as needed - If DataSets.Count <> lConsDateDatasetIndex Then 'use dates from first dataset in this group - lTimeSeries.Dates = DataSets(lConsDateDatasetIndex).Dates.Clone - End If - ReadDatesAndData(lTimeSeries, lSecId, "axis1", "block0_values", lConInd) - AddDataSet(lTimeSeries) + If DataSets.Count <> lConsDateDatasetIndex Then 'use dates from first dataset in this group + lTimeSeries.Dates = DataSets(lConsDateDatasetIndex).Dates 'reference, don't want copy/clone! + Else + ReadDates(lTimeSeries, lSecId, "axis1") End If + 'too many datasets run out of memory, need to just build headers then read data as needed + With lTimeSeries + .numValues = lTimeSeries.Dates.numValues + .Attributes.Add(New atcDefinedValue(lOutputSection, lSecId)) + .Attributes.Add(New atcDefinedValue(lOutputColumn, lConInd)) + lTimeSeries.Dates.Attributes.Add("Shared", True) + .ValuesNeedToBeRead = True + End With + AddDataSet(lTimeSeries) End If Next Next @@ -155,7 +179,7 @@ Public Class atcDataSourceTimeseriesHSF5 Filter = pFilter End Sub - Private Function BuildTimeSeries(aGrpID As H5LocId, aTsName As String, aScenario As String) As atcTimeseries + Private Function BuildTimeSeries(aGrpID As H5LocId, aTsName As String, aScenario As String, Optional aDatesTS As atcTimeseries = Nothing) As atcTimeseries Dim lTsGrpId As H5GroupId = H5G.open(aGrpID, aTsName) Dim lTsAtCnt As Integer = H5A.getNumberOfAttributes(lTsGrpId) @@ -203,13 +227,80 @@ Public Class atcDataSourceTimeseriesHSF5 Next lTimeSeries.Attributes.Add("Name", aTsName) + If IsNothing(aDatesTS) Then + ReadDates(lTimeSeries, lTsGrpId, "index") + Else + lTimeSeries.Dates = aDatesTS.Dates + End If + ReadDatesAndData(lTimeSeries, lTsGrpId, "index", "values") Return lTimeSeries End Function - Private Sub ReadDatesAndData(aTimeseries As atcTimeseries, aTsGrpId As H5GroupId, aDateTableName As String, aDataTableName As String, Optional aColumn As Integer = -1) + Private Sub ReadDates(aTimeseries As atcTimeseries, aTsGrpId As H5GroupId, aDateTableName As String) + Dim lNumValues As Integer + If IsNothing(aTimeseries.Dates) Then 'need dates + Dim lDateGrpId As H5DataSetId = H5D.open(aTsGrpId, aDateTableName) + Dim lDateStorageSize As Integer = H5D.getStorageSize(lDateGrpId) + lNumValues = lDateStorageSize / 8 + Dim lDates(lNumValues - 1) As Long + Dim lDateTypeId As H5DataTypeId = H5D.getType(lDateGrpId) + H5D.read(Of Int64)(lDateGrpId, lDateTypeId, New H5Array(Of Long)(lDates)) + Debug.Print(lDateStorageSize.ToString & ":" & lNumValues.ToString & ":" & lDates(0).ToString) + Dim lDateBase As New System.DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Local) + Dim lDateNow As System.DateTime = lDateBase.AddMilliseconds(lDates(0) / (10 ^ 6)) + Dim lDatesJ(lNumValues) As Double + For lIndex As Integer = 0 To lNumValues - 1 + lDateNow = lDateBase.AddMilliseconds(lDates(lIndex) / (10 ^ 6)) + With lDateNow + lDatesJ(lIndex) = Date2J(.Year, .Month, .Day, .Hour, .Minute, .Second) + End With + If lIndex < 3 Or lIndex > lNumValues - 2 Then + Debug.Print(lDateNow.ToString & ":" & DumpDate(lDatesJ(lIndex))) + End If + Next + lDatesJ(lNumValues) = (2 * (lDatesJ(lNumValues - 1))) - lDatesJ(lNumValues - 2) + Debug.Print(DumpDate(lDatesJ(lNumValues))) + aTimeseries.Dates = New atcTimeseries(Me) + aTimeseries.Dates.Values = lDatesJ + Else + Debug.Print("Why?") + End If + End Sub + + Public Overrides Sub ReadData(ByVal aData As atcDataSet) + If aData.Attributes.GetValue("OutputSection") Is Nothing Then + 'data has been read + Else + Debug.Print("Need to read data for " & aData.ToString) + Dim lTimeseries As atcTimeseries = aData + Dim lNumValues As Integer = lTimeseries.Dates.numValues + Dim lColumn As Integer = lTimeseries.Attributes.GetValue("OutputColumn") + Dim lGroupId As H5GroupId = lTimeseries.Attributes.GetValue("OutputSection") + Dim lValueGrpId As H5DataSetId = H5D.open(lGroupId, "block0_values") + + Dim lValuesArraySize As Integer = H5D.getStorageSize(lValueGrpId) / 4 + Dim lValueArraySize As Integer = lTimeseries.Dates.numValues + Dim lValueColumns As Integer = lValuesArraySize / lValueArraySize + Dim lValues(lValuesArraySize - 1) As Single + Dim lValueTypeId As H5DataTypeId = H5D.getType(lValueGrpId) + 'read all data (may be multiple ts) + H5D.read(Of Single)(lValueGrpId, lValueTypeId, New H5Array(Of Single)(lValues)) + Debug.Print(lValuesArraySize.ToString & ":" & lValueArraySize.ToString & ":" & lValues(0).ToString & ":" & lValues(1).ToString) + ReDim lTimeseries.Values(lNumValues) + For lIndex As Integer = 1 To lNumValues + Dim lArrayIndex As Integer = (lValueColumns * (lIndex - 1)) + lColumn + lTimeseries.Values(lIndex) = lValues(lArrayIndex) + Next lIndex + + lTimeseries.SetInterval() + lTimeseries.Attributes.CalculateAll() + End If + End Sub + + Private Sub ReadDatesAndData(aTimeseries As atcTimeseries, aTsGrpId As H5GroupId, aDateTableName As String, aDataTableName As String, Optional aColumn As Integer = -1) Dim lNumValues As Integer Dim lColumn As Integer = aColumn If lColumn < 0 Then lColumn = 0 diff --git a/atcTimeseriesWaterQualUS/My Project/Application.Designer.vb b/atcTimeseriesWaterQualUS/My Project/Application.Designer.vb new file mode 100644 index 000000000..88dd01c78 --- /dev/null +++ b/atcTimeseriesWaterQualUS/My Project/Application.Designer.vb @@ -0,0 +1,13 @@ +'------------------------------------------------------------------------------ +' +' This code was generated by a tool. +' Runtime Version:4.0.30319.42000 +' +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. +' +'------------------------------------------------------------------------------ + +Option Strict On +Option Explicit On + diff --git a/atcTimeseriesWaterQualUS/My Project/Application.myapp b/atcTimeseriesWaterQualUS/My Project/Application.myapp new file mode 100644 index 000000000..758895def --- /dev/null +++ b/atcTimeseriesWaterQualUS/My Project/Application.myapp @@ -0,0 +1,10 @@ + + + false + false + 0 + true + 0 + 1 + true + diff --git a/atcTimeseriesWaterQualUS/My Project/AssemblyInfo.vb b/atcTimeseriesWaterQualUS/My Project/AssemblyInfo.vb new file mode 100644 index 000000000..f2952224a --- /dev/null +++ b/atcTimeseriesWaterQualUS/My Project/AssemblyInfo.vb @@ -0,0 +1,35 @@ +Imports System +Imports System.Reflection +Imports System.Runtime.InteropServices + +' General Information about an assembly is controlled through the following +' set of attributes. Change these attribute values to modify the information +' associated with an assembly. + +' Review the values of the assembly attributes + + + + + + + + + + +'The following GUID is for the ID of the typelib if this project is exposed to COM + + +' Version information for an assembly consists of the following four values: +' +' Major Version +' Minor Version +' Build Number +' Revision +' +' You can specify all the values or you can default the Build and Revision Numbers +' by using the '*' as shown below: +' + + + diff --git a/atcTimeseriesWaterQualUS/My Project/Resources.Designer.vb b/atcTimeseriesWaterQualUS/My Project/Resources.Designer.vb new file mode 100644 index 000000000..4ab4d6a31 --- /dev/null +++ b/atcTimeseriesWaterQualUS/My Project/Resources.Designer.vb @@ -0,0 +1,63 @@ +'------------------------------------------------------------------------------ +' +' This code was generated by a tool. +' Runtime Version:4.0.30319.42000 +' +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. +' +'------------------------------------------------------------------------------ + +Option Strict On +Option Explicit On + +Imports System + +Namespace My.Resources + + 'This class was auto-generated by the StronglyTypedResourceBuilder + 'class via a tool like ResGen or Visual Studio. + 'To add or remove a member, edit your .ResX file then rerun ResGen + 'with the /str option, or rebuild your VS project. + ''' + ''' A strongly-typed resource class, for looking up localized strings, etc. + ''' + _ + Friend Module Resources + + Private resourceMan As Global.System.Resources.ResourceManager + + Private resourceCulture As Global.System.Globalization.CultureInfo + + ''' + ''' Returns the cached ResourceManager instance used by this class. + ''' + _ + Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager + Get + If Object.ReferenceEquals(resourceMan, Nothing) Then + Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("atcTimeseriesWaterQualUS.Resources", GetType(Resources).Assembly) + resourceMan = temp + End If + Return resourceMan + End Get + End Property + + ''' + ''' Overrides the current thread's CurrentUICulture property for all + ''' resource lookups using this strongly typed resource class. + ''' + _ + Friend Property Culture() As Global.System.Globalization.CultureInfo + Get + Return resourceCulture + End Get + Set + resourceCulture = value + End Set + End Property + End Module +End Namespace diff --git a/atcTimeseriesWaterQualUS/My Project/Resources.resx b/atcTimeseriesWaterQualUS/My Project/Resources.resx new file mode 100644 index 000000000..af7dbebba --- /dev/null +++ b/atcTimeseriesWaterQualUS/My Project/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/atcTimeseriesWaterQualUS/My Project/Settings.Designer.vb b/atcTimeseriesWaterQualUS/My Project/Settings.Designer.vb new file mode 100644 index 000000000..17dd1b974 --- /dev/null +++ b/atcTimeseriesWaterQualUS/My Project/Settings.Designer.vb @@ -0,0 +1,73 @@ +'------------------------------------------------------------------------------ +' +' This code was generated by a tool. +' Runtime Version:4.0.30319.42000 +' +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. +' +'------------------------------------------------------------------------------ + +Option Strict On +Option Explicit On + + +Namespace My + + _ + Partial Friend NotInheritable Class MySettings + Inherits Global.System.Configuration.ApplicationSettingsBase + + Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings()),MySettings) + +#Region "My.Settings Auto-Save Functionality" +#If _MyType = "WindowsForms" Then + Private Shared addedHandler As Boolean + + Private Shared addedHandlerLockObject As New Object + + _ + Private Shared Sub AutoSaveSettings(ByVal sender As Global.System.Object, ByVal e As Global.System.EventArgs) + If My.Application.SaveMySettingsOnExit Then + My.Settings.Save() + End If + End Sub +#End If +#End Region + + Public Shared ReadOnly Property [Default]() As MySettings + Get + +#If _MyType = "WindowsForms" Then + If Not addedHandler Then + SyncLock addedHandlerLockObject + If Not addedHandler Then + AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings + addedHandler = True + End If + End SyncLock + End If +#End If + Return defaultInstance + End Get + End Property + End Class +End Namespace + +Namespace My + + _ + Friend Module MySettingsProperty + + _ + Friend ReadOnly Property Settings() As Global.atcTimeseriesWaterQualUS.My.MySettings + Get + Return Global.atcTimeseriesWaterQualUS.My.MySettings.Default + End Get + End Property + End Module +End Namespace diff --git a/atcTimeseriesWaterQualUS/My Project/Settings.settings b/atcTimeseriesWaterQualUS/My Project/Settings.settings new file mode 100644 index 000000000..85b890b3c --- /dev/null +++ b/atcTimeseriesWaterQualUS/My Project/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + diff --git a/atcTimeseriesWaterQualUS/atcTimeseriesWaterQualUS.vb b/atcTimeseriesWaterQualUS/atcTimeseriesWaterQualUS.vb new file mode 100644 index 000000000..ee485c0c4 --- /dev/null +++ b/atcTimeseriesWaterQualUS/atcTimeseriesWaterQualUS.vb @@ -0,0 +1,191 @@ +Imports atcData +Imports atcUtility +Imports MapWinUtility +Imports System.Collections +Imports System.IO +Imports System.Text.RegularExpressions +Imports Microsoft.VisualBasic.FileIO.TextFieldParser + +Public Class atcTimeseriesWaterQualUS + Inherits atcTimeseriesSource + Private Shared pFilter As String = "WaterQualityData US Files (*.csv)|*.csv;|All Files (*.*)|*.*" + Private pJulianInterval As Double = 1 'Add one day for daily values to record date at end of interval + Public RawDataGroup As New clsWQDUSLocations() 'Dictionary(Of String, clsWQDUSLocation)() + Public SelectAllLocations As Boolean = False + Public SelectAllConstituents As Boolean = False + Public SelectedLocations As New List(Of String)() + Public SelectedConstituents As New List(Of String)() + Public AllConstituents As New List(Of String)() + + Public Overrides ReadOnly Property Description() As String + Get + Return "WaterQualityData US" + End Get + End Property + + Public Overrides ReadOnly Property Name() As String + Get + Return "Timeseries::WaterQualityData US" + End Get + End Property + + Public Overrides ReadOnly Property Category() As String + Get + Return "File" + End Get + End Property + + Public Overrides ReadOnly Property CanOpen() As Boolean + Get + Return True + End Get + End Property + + Public Overrides ReadOnly Property CanSave() As Boolean + Get + Return False + End Get + End Property + + Public Overrides Function Open(ByVal aFileName As String, + Optional ByVal aAttributes As atcData.atcDataAttributes = Nothing) As Boolean + If MyBase.Open(aFileName, aAttributes) Then + If Not IO.File.Exists(Specification) Then + Logger.Dbg("Opening new file " & Specification) + Return True + ElseIf IO.Path.GetFileName(Specification).ToLower.StartsWith("stations") Then + Throw New ApplicationException("Station file does not contain timeseries data: " & IO.Path.GetFileName(Specification)) + Else + Try + Dim lTimeStartOpen As Date = Now + Logger.Dbg("OpenStartFor " & Specification) + Dim CurrentRecord() As String + Dim lDataColumnsValid As Boolean = True + Dim lFileInfo As New FileInfo(Specification) + Dim lSr As New StreamReader(Specification, True) + Dim lEncoding As Text.Encoding = lSr.CurrentEncoding() + lSr.Close() + lSr = Nothing + Dim lFileSize As Long = lFileInfo.Length + Dim lRunningSize As Long = 0 + Using afile As New Microsoft.VisualBasic.FileIO.TextFieldParser(Specification) + afile.TextFieldType = FileIO.FieldType.Delimited + afile.Delimiters = New String() {","} + afile.HasFieldsEnclosedInQuotes = True + + Dim first As Boolean = True + ' parse the actual file + Dim loc_id As String + Dim loc As clsWQDUSLocation + While Not afile.EndOfData + Try + CurrentRecord = afile.ReadFields + lRunningSize += lEncoding.GetByteCount(String.Join(",", CurrentRecord)) + Logger.Progress(lRunningSize / lFileSize * 100.0, 100) + If first Then + first = False + If Not clsWQDUSColumns.SetColumns(CurrentRecord) Then + lDataColumnsValid = False + Exit While + End If + Continue While + Else + loc_id = CurrentRecord(clsWQDUSColumns.colMonitoringLocationIdentifier) + If RawDataGroup.ContainsKey(loc_id) Then + loc = RawDataGroup.Item(loc_id) + Else + loc = New clsWQDUSLocation(loc_id) + RawDataGroup.Add(loc_id, loc) + End If + loc.AddData(CurrentRecord) + End If + Catch ex As FileIO.MalformedLineException + MsgBox("Line " & ex.Message & "is not valid and will be skipped.") + End Try + End While + End Using + Logger.Progress(100, 100) + If lDataColumnsValid Then + SelectedConstituents.Clear() + SelectedLocations.Clear() + Dim lfrm As New frmSelect(RawDataGroup, SelectedLocations, SelectedConstituents) + If lfrm.ShowDialog() = Windows.Forms.DialogResult.OK Then + If SelectedLocations.Count > 0 AndAlso SelectedConstituents.Count > 0 Then + Return BuildTimeseries() + End If + End If + Else + Return False + End If + Return True + Catch lException As Exception + Logger.Progress(100, 100) + Throw New ApplicationException("Exception reading '" & Specification & "': " & lException.Message, lException) + End Try + End If + End If + Return True + End Function + + Public Sub New() + Filter = pFilter + End Sub + + Public Function BuildTimeseries() As Boolean + If RawDataGroup.Count = 0 Then + Return False + End If + Dim lBuildOk As Boolean = True + Try + Dim lGroupBuilder As New atcTimeseriesGroupBuilder(Me) + Dim lTSBuilder As atcTimeseriesBuilder + For Each loc As clsWQDUSLocation In RawDataGroup.Values + If Not SelectAllLocations AndAlso Not SelectedLocations.Contains(loc.Location) Then + Continue For + End If + For Each cons As clsWQDUSConstituent In loc.Constituents.Values + For Each lcon_unit As String In cons.RecordGroup.Keys + If Not SelectAllConstituents Then + If Not SelectedConstituents.Contains(cons.Name & "-" & lcon_unit) Then + Continue For + End If + End If + Dim ldata As List(Of clsWQDUSDataPoint) = cons.RecordGroup.Item(lcon_unit) + If ldata.Count > 0 Then + lTSBuilder = lGroupBuilder.Builder(loc.Location & ":" & cons.Name & ":" & lcon_unit) + With lTSBuilder.Attributes + 'Set attributes of newly created builder + If Not .ContainsAttribute("Location") Then + .SetValue("Scenario", "Observed") + .SetValue("Location", loc.Location) + .SetValue("Constituent", cons.Name) + .SetValue("Units", lcon_unit) + '.SetValue("CCode", lCcode) + .SetValue("Point", True) + .AddHistory("Read from " & Specification) + End If + End With + For I As Integer = 0 To ldata.Count - 1 + 'ldt = Date.Parse(lTable.Value(lDateCol)).ToOADate + If ldata(I).SetDataTime() Then + lTSBuilder.AddValue(ldata(I).atcDataTime, ldata(I).Value) + If Not String.IsNullOrEmpty(ldata(I).Attrib) Then + lTSBuilder.AddValueAttribute("RCode", ldata(I).Attrib) + End If + Else + Continue For + End If + Next 'data point + End If + Next 'lcon_unit + Next 'cons + Next 'loc + lGroupBuilder.CreateTimeseriesAddToGroup(DataSets) + lBuildOk = True + Catch ex As Exception + lBuildOk = False + Logger.Msg("Build datasets failed in " & Specification, "WaterQualityData US Build Dataset") + End Try + Return lBuildOk + End Function +End Class diff --git a/atcTimeseriesWaterQualUS/atcTimeseriesWaterQualUS15.vbproj b/atcTimeseriesWaterQualUS/atcTimeseriesWaterQualUS15.vbproj new file mode 100644 index 000000000..f69924a30 --- /dev/null +++ b/atcTimeseriesWaterQualUS/atcTimeseriesWaterQualUS15.vbproj @@ -0,0 +1,161 @@ + + + + + Debug + AnyCPU + {5645ECEF-CB9A-42F8-AE33-11ED10A452CC} + Library + atcTimeseriesWaterQualUS + atcTimeseriesWaterQualUS + 512 + Windows + v3.5 + + + + true + full + true + true + ..\Bin\Plugins\BASINS\ + atcTimeseriesWaterQualUS.xml + 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022 + x86 + + + pdbonly + false + true + true + bin\Release\ + atcTimeseriesWaterQualUS.xml + 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022 + + + On + + + Binary + + + Off + + + On + + + true + true + true + ..\Bin\Plugins\BASINS\ + atcTimeseriesWaterQualUS.xml + 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022 + full + x86 + MinimumRecommendedRules.ruleset + + + true + bin\x86\Release\ + atcTimeseriesWaterQualUS.xml + true + 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022 + pdbonly + x86 + MinimumRecommendedRules.ruleset + + + + + + + + + + + + + + + + + + + + + + + + + + + frmSelect.vb + + + Form + + + + True + Application.myapp + + + True + True + Resources.resx + + + True + Settings.settings + True + + + + + frmSelect.vb + + + VbMyResourcesResXFileCodeGenerator + Resources.Designer.vb + My.Resources + Designer + + + + + MyApplicationCodeGenerator + Application.Designer.vb + + + SettingsSingleFileGenerator + My + Settings.Designer.vb + + + + + {a9a00cad-9ead-4228-ab08-6dc3baf253aa} + atcData15 + False + + + {67027820-9036-481e-80f6-077e5085f59d} + atcUtility15 + False + + + {33e88992-742f-4d13-823f-35d6a07b1aa1} + BASINS-MapWinUtility15 + False + + + + + \ No newline at end of file diff --git a/atcTimeseriesWaterQualUS/clsWaterQualityDataUS.vb b/atcTimeseriesWaterQualUS/clsWaterQualityDataUS.vb new file mode 100644 index 000000000..31b56e423 --- /dev/null +++ b/atcTimeseriesWaterQualUS/clsWaterQualityDataUS.vb @@ -0,0 +1,712 @@ +Imports atcData +Imports atcUtility + +Public Class clsWQDUSColumns + Public Shared colOrganizationIdentifier As Integer = -1 + Public Shared colOrganizationFormalName As Integer = -1 + Public Shared colActivityIdentifier As Integer = -1 + Public Shared colActivityTypeCode As Integer = -1 + Public Shared colActivityMediaName As Integer = -1 + Public Shared colActivityMediaSubdivisionName As Integer = -1 + Public Shared colActivityStartDate As Integer = -1 + Public Shared colActivityStartTime As Integer = -1 + Public Shared colActivityStartTimeZoneCode As Integer = -1 + Public Shared colActivityEndDate As Integer = -1 + Public Shared colActivityEndTime As Integer = -1 + Public Shared colActivityEndTimeZoneCode As Integer = -1 + Public Shared colActivityDepthHeightMeasureValue As Integer = -1 + Public Shared colActivityDepthHeightMeasureUnitCode As Integer = -1 + Public Shared colActivityDepthAltitudeReferencePointText As Integer = -1 + Public Shared colActivityTopDepthHeightMeasureValue As Integer = -1 + Public Shared colActivityTopDepthHeightMeasureUnitCode As Integer = -1 + Public Shared colActivityBottomDepthHeightMeasureValue As Integer = -1 + Public Shared colActivityBottomDepthHeightMeasureUnitCode As Integer = -1 + Public Shared colProjectIdentifier As Integer = -1 + Public Shared colActivityConductingOrganizationText As Integer = -1 + Public Shared colMonitoringLocationIdentifier As Integer = -1 + Public Shared colActivityCommentText As Integer = -1 + Public Shared colSampleAquifer As Integer = -1 + Public Shared colHydrologicCondition As Integer = -1 + Public Shared colHydrologicEvent As Integer = -1 + Public Shared colSampleCollectionMethodIdentifier As Integer = -1 + Public Shared colSampleCollectionMethodIdentifierContext As Integer = -1 + Public Shared colSampleCollectionMethodName As Integer = -1 + Public Shared colSampleCollectionEquipmentName As Integer = -1 + Public Shared colResultDetectionConditionText As Integer = -1 + Public Shared colCharacteristicName As Integer = -1 + Public Shared colResultSampleFractionText As Integer = -1 + Public Shared colResultMeasureValue As Integer = -1 + Public Shared colResultMeasureUnitCode As Integer = -1 + Public Shared colMeasureQualifierCode As Integer = -1 + Public Shared colResultStatusIdentifier As Integer = -1 + Public Shared colStatisticalBaseCode As Integer = -1 + Public Shared colResultValueTypeName As Integer = -1 + Public Shared colResultWeightBasisText As Integer = -1 + Public Shared colResultTimeBasisText As Integer = -1 + Public Shared colResultTemperatureBasisText As Integer = -1 + Public Shared colResultParticleSizeBasisText As Integer = -1 + Public Shared colPrecisionValue As Integer = -1 + Public Shared colResultCommentText As Integer = -1 + Public Shared colUSGSPCode As Integer = -1 + Public Shared colResultDepthHeightMeasureValue As Integer = -1 + Public Shared colResultDepthHeightMeasureUnitCode As Integer = -1 + Public Shared colResultDepthAltitudeReferencePointText As Integer = -1 + Public Shared colSubjectTaxonomicName As Integer = -1 + Public Shared colSampleTissueAnatomyName As Integer = -1 + Public Shared colResultAnalyticalMethodIdentifier As Integer = -1 + Public Shared colResultAnalyticalMethodIdentifierContext As Integer = -1 + Public Shared colResultAnalyticalMethodName As Integer = -1 + Public Shared colMethodDescriptionText As Integer = -1 + Public Shared colLaboratoryName As Integer = -1 + Public Shared colAnalysisStartDate As Integer = -1 + Public Shared colResultLaboratoryCommentText As Integer = -1 + Public Shared colDetectionQuantitationLimitTypeName As Integer = -1 + Public Shared colDetectionQuantitationLimitMeasureValue As Integer = -1 + Public Shared colDetectionQuantitationLimitMeasureUnitCode As Integer = -1 + Public Shared colPreparationStartDate As Integer = -1 + Public Shared colProviderName As Integer = -1 + + Public Shared Function SetColumns(ByVal aRecord() As String) As Boolean + If aRecord Is Nothing OrElse aRecord.Length = 0 Then + Return False + End If + For I As Integer = 0 To aRecord.Length - 1 + If aRecord(I).StartsWith("OrganizationIdentifier") Then + colOrganizationIdentifier = I + ElseIf aRecord(I).StartsWith("OrganizationFormalName") Then + colOrganizationFormalName = I + ElseIf aRecord(I).StartsWith("ActivityIdentifier") Then + colActivityIdentifier = I + ElseIf aRecord(I).StartsWith("ActivityTypeCode") Then + colActivityTypeCode = I + ElseIf aRecord(I).StartsWith("ActivityMediaName") Then + colActivityMediaName = I + ElseIf aRecord(I).StartsWith("ActivityMediaSubdivisionName") Then + colActivityMediaSubdivisionName = I + ElseIf aRecord(I).StartsWith("ActivityStartDate") Then + colActivityStartDate = I + ElseIf aRecord(I).StartsWith("ActivityStartTime/TimeZoneCode") Then + colActivityStartTimeZoneCode = I + ElseIf aRecord(I).StartsWith("ActivityStartTime/Time") Then + colActivityStartTime = I + ElseIf aRecord(I).StartsWith("ActivityEndDate") Then + colActivityEndDate = I + ElseIf aRecord(I).StartsWith("ActivityEndTime/TimeZoneCode") Then + colActivityEndTimeZoneCode = I + ElseIf aRecord(I).StartsWith("ActivityEndTime/Time") Then + colActivityEndTime = I + ElseIf aRecord(I).StartsWith("ActivityDepthHeightMeasure/MeasureValue") Then + colActivityDepthHeightMeasureValue = I + ElseIf aRecord(I).StartsWith("ActivityDepthHeightMeasure/MeasureUnitCode") Then + colActivityDepthHeightMeasureUnitCode = I + ElseIf aRecord(I).StartsWith("ActivityDepthAltitudeReferencePointText") Then + colActivityDepthAltitudeReferencePointText = I + ElseIf aRecord(I).StartsWith("ActivityTopDepthHeightMeasure/MeasureValue") Then + colActivityTopDepthHeightMeasureValue = I + ElseIf aRecord(I).StartsWith("ActivityTopDepthHeightMeasure/MeasureUnitCode") Then + colActivityTopDepthHeightMeasureUnitCode = I + ElseIf aRecord(I).StartsWith("ActivityBottomDepthHeightMeasure/MeasureValue") Then + colActivityBottomDepthHeightMeasureValue = I + ElseIf aRecord(I).StartsWith("ActivityBottomDepthHeightMeasure/MeasureUnitCode") Then + colActivityBottomDepthHeightMeasureUnitCode = I + ElseIf aRecord(I).StartsWith("ProjectIdentifier") Then + colProjectIdentifier = I + ElseIf aRecord(I).StartsWith("ActivityConductingOrganizationText") Then + colActivityConductingOrganizationText = I + ElseIf aRecord(I).StartsWith("MonitoringLocationIdentifier") Then + colMonitoringLocationIdentifier = I + ElseIf aRecord(I).StartsWith("ActivityCommentText") Then + colActivityCommentText = I + ElseIf aRecord(I).StartsWith("SampleAquifer") Then + colSampleAquifer = I + ElseIf aRecord(I).StartsWith("HydrologicCondition") Then + colHydrologicCondition = I + ElseIf aRecord(I).StartsWith("HydrologicEvent") Then + colHydrologicEvent = I + ElseIf aRecord(I).StartsWith("SampleCollectionMethod/MethodIdentifierContext") Then + colSampleCollectionMethodIdentifierContext = I + ElseIf aRecord(I).StartsWith("SampleCollectionMethod/MethodIdentifier") Then + colSampleCollectionMethodIdentifier = I + ElseIf aRecord(I).StartsWith("SampleCollectionMethod/MethodName") Then + colSampleCollectionMethodName = I + ElseIf aRecord(I).StartsWith("SampleCollectionEquipmentName") Then + colSampleCollectionEquipmentName = I + ElseIf aRecord(I).StartsWith("ResultDetectionConditionText") Then + colResultDetectionConditionText = I + ElseIf aRecord(I).StartsWith("CharacteristicName") Then + colCharacteristicName = I + ElseIf aRecord(I).StartsWith("ResultSampleFractionText") Then + colResultSampleFractionText = I + ElseIf aRecord(I).StartsWith("ResultMeasureValue") Then + colResultMeasureValue = I + ElseIf aRecord(I).StartsWith("ResultMeasure/MeasureUnitCode") Then + colResultMeasureUnitCode = I + ElseIf aRecord(I).StartsWith("MeasureQualifierCode") Then + colMeasureQualifierCode = I + ElseIf aRecord(I).StartsWith("ResultStatusIdentifier") Then + colResultStatusIdentifier = I + ElseIf aRecord(I).StartsWith("StatisticalBaseCode") Then + colStatisticalBaseCode = I + ElseIf aRecord(I).StartsWith("ResultValueTypeName") Then + colResultValueTypeName = I + ElseIf aRecord(I).StartsWith("ResultWeightBasisText") Then + colResultWeightBasisText = I + ElseIf aRecord(I).StartsWith("ResultTimeBasisText") Then + colResultTimeBasisText = I + ElseIf aRecord(I).StartsWith("ResultTemperatureBasisText") Then + colResultTemperatureBasisText = I + ElseIf aRecord(I).StartsWith("ResultParticleSizeBasisText") Then + colResultParticleSizeBasisText = I + ElseIf aRecord(I).StartsWith("PrecisionValue") Then + colPrecisionValue = I + ElseIf aRecord(I).StartsWith("ResultCommentText") Then + colResultCommentText = I + ElseIf aRecord(I).StartsWith("USGSPCode") Then + colUSGSPCode = I + ElseIf aRecord(I).StartsWith("ResultDepthHeightMeasure/MeasureValue") Then + colResultDepthHeightMeasureValue = I + ElseIf aRecord(I).StartsWith("ResultDepthHeightMeasure/MeasureUnitCode") Then + colResultDepthHeightMeasureUnitCode = I + ElseIf aRecord(I).StartsWith("ResultDepthAltitudeReferencePointText") Then + colResultDepthAltitudeReferencePointText = I + ElseIf aRecord(I).StartsWith("SubjectTaxonomicName") Then + colSubjectTaxonomicName = I + ElseIf aRecord(I).StartsWith("SampleTissueAnatomyName") Then + colSampleTissueAnatomyName = I + ElseIf aRecord(I).StartsWith("ResultAnalyticalMethod/MethodIdentifierContext") Then + colResultAnalyticalMethodIdentifierContext = I + ElseIf aRecord(I).StartsWith("ResultAnalyticalMethod/MethodIdentifier") Then + colResultAnalyticalMethodIdentifier = I + ElseIf aRecord(I).StartsWith("ResultAnalyticalMethod/MethodName") Then + colResultAnalyticalMethodName = I + ElseIf aRecord(I).StartsWith("MethodDescriptionText") Then + colMethodDescriptionText = I + ElseIf aRecord(I).StartsWith("LaboratoryName") Then + colLaboratoryName = I + ElseIf aRecord(I).StartsWith("AnalysisStartDate") Then + colAnalysisStartDate = I + ElseIf aRecord(I).StartsWith("ResultLaboratoryCommentText") Then + colResultLaboratoryCommentText = I + ElseIf aRecord(I).StartsWith("DetectionQuantitationLimitTypeName") Then + colDetectionQuantitationLimitTypeName = I + ElseIf aRecord(I).StartsWith("DetectionQuantitationLimitMeasure/MeasureValue") Then + colDetectionQuantitationLimitMeasureValue = I + ElseIf aRecord(I).StartsWith("DetectionQuantitationLimitMeasure/MeasureUnitCode") Then + colDetectionQuantitationLimitMeasureUnitCode = I + ElseIf aRecord(I).StartsWith("PreparationStartDate") Then + colPreparationStartDate = I + ElseIf aRecord(I).StartsWith("ProviderName") Then + colProviderName = I + End If + Next + Return IsValidColumns() + End Function + + Public Shared Function IsValidColumns() As Boolean + If colOrganizationIdentifier < 0 Then Return False + If colOrganizationFormalName < 0 Then Return False + If colActivityIdentifier < 0 Then Return False + If colActivityTypeCode < 0 Then Return False + If colActivityMediaName < 0 Then Return False + If colActivityMediaSubdivisionName < 0 Then Return False + If colActivityStartDate < 0 Then Return False + If colActivityStartTime < 0 Then Return False + If colActivityStartTimeZoneCode < 0 Then Return False + If colActivityEndDate < 0 Then Return False + If colActivityEndTime < 0 Then Return False + If colActivityEndTimeZoneCode < 0 Then Return False + If colActivityDepthHeightMeasureValue < 0 Then Return False + If colActivityDepthHeightMeasureUnitCode < 0 Then Return False + If colActivityDepthAltitudeReferencePointText < 0 Then Return False + If colActivityTopDepthHeightMeasureValue < 0 Then Return False + If colActivityTopDepthHeightMeasureUnitCode < 0 Then Return False + If colActivityBottomDepthHeightMeasureValue < 0 Then Return False + If colActivityBottomDepthHeightMeasureUnitCode < 0 Then Return False + If colProjectIdentifier < 0 Then Return False + If colActivityConductingOrganizationText < 0 Then Return False + If colMonitoringLocationIdentifier < 0 Then Return False + If colActivityCommentText < 0 Then Return False + If colSampleAquifer < 0 Then Return False + If colHydrologicCondition < 0 Then Return False + If colHydrologicEvent < 0 Then Return False + If colSampleCollectionMethodIdentifier < 0 Then Return False + If colSampleCollectionMethodIdentifierContext < 0 Then Return False + If colSampleCollectionMethodName < 0 Then Return False + If colSampleCollectionEquipmentName < 0 Then Return False + If colResultDetectionConditionText < 0 Then Return False + If colCharacteristicName < 0 Then Return False + If colResultSampleFractionText < 0 Then Return False + If colResultMeasureValue < 0 Then Return False + If colResultMeasureUnitCode < 0 Then Return False + If colMeasureQualifierCode < 0 Then Return False + If colResultStatusIdentifier < 0 Then Return False + If colStatisticalBaseCode < 0 Then Return False + If colResultValueTypeName < 0 Then Return False + If colResultWeightBasisText < 0 Then Return False + If colResultTimeBasisText < 0 Then Return False + If colResultTemperatureBasisText < 0 Then Return False + If colResultParticleSizeBasisText < 0 Then Return False + If colPrecisionValue < 0 Then Return False + If colResultCommentText < 0 Then Return False + If colUSGSPCode < 0 Then Return False + If colResultDepthHeightMeasureValue < 0 Then Return False + If colResultDepthHeightMeasureUnitCode < 0 Then Return False + If colResultDepthAltitudeReferencePointText < 0 Then Return False + If colSubjectTaxonomicName < 0 Then Return False + If colSampleTissueAnatomyName < 0 Then Return False + If colResultAnalyticalMethodIdentifier < 0 Then Return False + If colResultAnalyticalMethodIdentifierContext < 0 Then Return False + If colResultAnalyticalMethodName < 0 Then Return False + If colMethodDescriptionText < 0 Then Return False + If colLaboratoryName < 0 Then Return False + If colAnalysisStartDate < 0 Then Return False + If colResultLaboratoryCommentText < 0 Then Return False + If colDetectionQuantitationLimitTypeName < 0 Then Return False + If colDetectionQuantitationLimitMeasureValue < 0 Then Return False + If colDetectionQuantitationLimitMeasureUnitCode < 0 Then Return False + If colPreparationStartDate < 0 Then Return False + If colProviderName < 0 Then Return False + Return True + End Function +End Class + +Public Class clsWaterQualityDataUSRecord + Public OrganizationIdentifier As String = "" + Public OrganizationFormalName As String = "" + Public ActivityIdentifier As String = "" + Public ActivityTypeCode As String = "" + Public ActivityMediaName As String = "" + Public ActivityMediaSubdivisionName As String = "" + Public ActivityStartDate As String = "" + Public ActivityStartTime As String = "" + Public ActivityStartTimeZoneCode As String = "" + Public ActivityEndDate As String = "" + Public ActivityEndTime As String = "" + Public ActivityEndTimeZoneCode As String = "" + Public ActivityDepthHeightMeasureValue As String = "" + Public ActivityDepthHeightMeasureUnitCode As String = "" + Public ActivityDepthAltitudeReferencePointText As String = "" + Public ActivityTopDepthHeightMeasureValue As String = "" + Public ActivityTopDepthHeightMeasureUnitCode As String = "" + Public ActivityBottomDepthHeightMeasureValue As String = "" + Public ActivityBottomDepthHeightMeasureUnitCode As String = "" + Public ProjectIdentifier As String = "" + Public ActivityConductingOrganizationText As String = "" + Public MonitoringLocationIdentifier As String = "" + Public ActivityCommentText As String = "" + Public SampleAquifer As String = "" + Public HydrologicCondition As String = "" + Public HydrologicEvent As String = "" + Public SampleCollectionMethodIdentifier As String = "" + Public SampleCollectionMethodIdentifierContext As String = "" + Public SampleCollectionMethodName As String = "" + Public SampleCollectionEquipmentName As String = "" + Public ResultDetectionConditionText As String = "" + Public CharacteristicName As String = "" + Public ResultSampleFractionText As String = "" + Public ResultMeasureValue As String = "" + Public ResultMeasureUnitCode As String = "" + Public MeasureQualifierCode As String = "" + Public ResultStatusIdentifier As String = "" + Public StatisticalBaseCode As String = "" + Public ResultValueTypeName As String = "" + Public ResultWeightBasisText As String = "" + Public ResultTimeBasisText As String = "" + Public ResultTemperatureBasisText As String = "" + Public ResultParticleSizeBasisText As String = "" + Public PrecisionValue As String = "" + Public ResultCommentText As String = "" + Public USGSPCode As String = "" + Public ResultDepthHeightMeasureValue As String = "" + Public ResultDepthHeightMeasureUnitCode As String = "" + Public ResultDepthAltitudeReferencePointText As String = "" + Public SubjectTaxonomicName As String = "" + Public SampleTissueAnatomyName As String = "" + Public ResultAnalyticalMethodIdentifier As String = "" + Public ResultAnalyticalMethodIdentifierContext As String = "" + Public ResultAnalyticalMethodName As String = "" + Public MethodDescriptionText As String = "" + Public LaboratoryName As String = "" + Public AnalysisStartDate As String = "" + Public ResultLaboratoryCommentText As String = "" + Public DetectionQuantitationLimitTypeName As String = "" + Public DetectionQuantitationLimitMeasureValue As String = "" + Public DetectionQuantitationLimitMeasureUnitCode As String = "" + Public PreparationStartDate As String = "" + Public ProviderName As String = "" + Public Sub New(ByVal aRecord() As String) + OrganizationIdentifier = aRecord(clsWQDUSColumns.colOrganizationIdentifier) + OrganizationFormalName = aRecord(clsWQDUSColumns.colOrganizationFormalName) + ActivityIdentifier = aRecord(clsWQDUSColumns.colActivityIdentifier) + ActivityTypeCode = aRecord(clsWQDUSColumns.colActivityTypeCode) + ActivityMediaName = aRecord(clsWQDUSColumns.colActivityMediaName) + ActivityMediaSubdivisionName = aRecord(clsWQDUSColumns.colActivityMediaSubdivisionName) + ActivityStartDate = aRecord(clsWQDUSColumns.colActivityStartDate) + ActivityStartTime = aRecord(clsWQDUSColumns.colActivityStartTime) + ActivityStartTimeZoneCode = aRecord(clsWQDUSColumns.colActivityStartTimeZoneCode) + ActivityEndDate = aRecord(clsWQDUSColumns.colActivityEndDate) + ActivityEndTime = aRecord(clsWQDUSColumns.colActivityEndTime) + ActivityEndTimeZoneCode = aRecord(clsWQDUSColumns.colActivityEndTimeZoneCode) + ActivityDepthHeightMeasureValue = aRecord(clsWQDUSColumns.colActivityDepthHeightMeasureValue) + ActivityDepthHeightMeasureUnitCode = aRecord(clsWQDUSColumns.colActivityDepthHeightMeasureUnitCode) + ActivityDepthAltitudeReferencePointText = aRecord(clsWQDUSColumns.colActivityDepthAltitudeReferencePointText) + ActivityTopDepthHeightMeasureValue = aRecord(clsWQDUSColumns.colActivityTopDepthHeightMeasureValue) + ActivityTopDepthHeightMeasureUnitCode = aRecord(clsWQDUSColumns.colActivityTopDepthHeightMeasureUnitCode) + ActivityBottomDepthHeightMeasureValue = aRecord(clsWQDUSColumns.colActivityBottomDepthHeightMeasureValue) + ActivityBottomDepthHeightMeasureUnitCode = aRecord(clsWQDUSColumns.colActivityBottomDepthHeightMeasureUnitCode) + ProjectIdentifier = aRecord(clsWQDUSColumns.colProjectIdentifier) + ActivityConductingOrganizationText = aRecord(clsWQDUSColumns.colActivityConductingOrganizationText) + MonitoringLocationIdentifier = aRecord(clsWQDUSColumns.colMonitoringLocationIdentifier) + ActivityCommentText = aRecord(clsWQDUSColumns.colActivityCommentText) + SampleAquifer = aRecord(clsWQDUSColumns.colSampleAquifer) + HydrologicCondition = aRecord(clsWQDUSColumns.colHydrologicCondition) + HydrologicEvent = aRecord(clsWQDUSColumns.colHydrologicEvent) + SampleCollectionMethodIdentifier = aRecord(clsWQDUSColumns.colSampleCollectionMethodIdentifier) + SampleCollectionMethodIdentifierContext = aRecord(clsWQDUSColumns.colSampleCollectionMethodIdentifierContext) + SampleCollectionMethodName = aRecord(clsWQDUSColumns.colSampleCollectionMethodName) + SampleCollectionEquipmentName = aRecord(clsWQDUSColumns.colSampleCollectionEquipmentName) + ResultDetectionConditionText = aRecord(clsWQDUSColumns.colResultDetectionConditionText) + CharacteristicName = aRecord(clsWQDUSColumns.colCharacteristicName) + ResultSampleFractionText = aRecord(clsWQDUSColumns.colResultSampleFractionText) + ResultMeasureValue = aRecord(clsWQDUSColumns.colResultMeasureValue) + ResultMeasureUnitCode = aRecord(clsWQDUSColumns.colResultMeasureUnitCode) + MeasureQualifierCode = aRecord(clsWQDUSColumns.colMeasureQualifierCode) + ResultStatusIdentifier = aRecord(clsWQDUSColumns.colResultStatusIdentifier) + StatisticalBaseCode = aRecord(clsWQDUSColumns.colStatisticalBaseCode) + ResultValueTypeName = aRecord(clsWQDUSColumns.colResultValueTypeName) + ResultWeightBasisText = aRecord(clsWQDUSColumns.colResultWeightBasisText) + ResultTimeBasisText = aRecord(clsWQDUSColumns.colResultTimeBasisText) + ResultTemperatureBasisText = aRecord(clsWQDUSColumns.colResultTemperatureBasisText) + ResultParticleSizeBasisText = aRecord(clsWQDUSColumns.colResultParticleSizeBasisText) + PrecisionValue = aRecord(clsWQDUSColumns.colPrecisionValue) + ResultCommentText = aRecord(clsWQDUSColumns.colResultCommentText) + USGSPCode = aRecord(clsWQDUSColumns.colUSGSPCode) + ResultDepthHeightMeasureValue = aRecord(clsWQDUSColumns.colResultDepthHeightMeasureValue) + ResultDepthHeightMeasureUnitCode = aRecord(clsWQDUSColumns.colResultDepthHeightMeasureUnitCode) + ResultDepthAltitudeReferencePointText = aRecord(clsWQDUSColumns.colResultDepthAltitudeReferencePointText) + SubjectTaxonomicName = aRecord(clsWQDUSColumns.colSubjectTaxonomicName) + SampleTissueAnatomyName = aRecord(clsWQDUSColumns.colSampleTissueAnatomyName) + ResultAnalyticalMethodIdentifier = aRecord(clsWQDUSColumns.colResultAnalyticalMethodIdentifier) + ResultAnalyticalMethodIdentifierContext = aRecord(clsWQDUSColumns.colResultAnalyticalMethodIdentifierContext) + ResultAnalyticalMethodName = aRecord(clsWQDUSColumns.colResultAnalyticalMethodName) + MethodDescriptionText = aRecord(clsWQDUSColumns.colMethodDescriptionText) + LaboratoryName = aRecord(clsWQDUSColumns.colLaboratoryName) + AnalysisStartDate = aRecord(clsWQDUSColumns.colAnalysisStartDate) + ResultLaboratoryCommentText = aRecord(clsWQDUSColumns.colResultLaboratoryCommentText) + DetectionQuantitationLimitTypeName = aRecord(clsWQDUSColumns.colDetectionQuantitationLimitTypeName) + DetectionQuantitationLimitMeasureValue = aRecord(clsWQDUSColumns.colDetectionQuantitationLimitMeasureValue) + DetectionQuantitationLimitMeasureUnitCode = aRecord(clsWQDUSColumns.colDetectionQuantitationLimitMeasureUnitCode) + PreparationStartDate = aRecord(clsWQDUSColumns.colPreparationStartDate) + ProviderName = aRecord(clsWQDUSColumns.colProviderName) + End Sub +End Class + +Public Class clsWQDUSLocations + Public Locations As New Dictionary(Of String, clsWQDUSLocation)() + Public ReadOnly Property GetUniqueConstituentList() As List(Of String) + Get + Dim lsortedPreferred As New SortedList(Of String, Integer)() + Dim lstNonPreferred As New SortedList(Of String, Integer)() + Dim lKey As String + For Each loc As clsWQDUSLocation In Locations.Values + For Each cons As clsWQDUSConstituent In loc.Constituents.Values + For Each ldata_unit As String In cons.RecordGroup.Keys + lKey = cons.Name & "-" & ldata_unit + If Not lstNonPreferred.ContainsKey(lKey) Then + lstNonPreferred.Add(lKey, 1) + End If + Next + Next + Next + Return lstNonPreferred.Keys.ToList() + End Get + End Property + + Public ReadOnly Property ContainsKey(ByVal aKey As String) As Boolean + Get + Return Locations.ContainsKey(aKey) + End Get + End Property + Public ReadOnly Property Count() As Integer + Get + Return Locations.Count + End Get + End Property + Public ReadOnly Property Keys() As List(Of String) + Get + Return Locations.Keys.ToList() + End Get + End Property + Public ReadOnly Property Values() As List(Of clsWQDUSLocation) + Get + Return Locations.Values.ToList() + End Get + End Property + Public ReadOnly Property Item(ByVal aLoc As String) As clsWQDUSLocation + Get + Return Locations.Item(aLoc) + End Get + End Property + Public Function Add(ByVal aLocID As String, ByVal aLoc As clsWQDUSLocation) As Boolean + Try + Locations.Add(aLocID, aLoc) + Return True + Catch ex As Exception + Return False + End Try + End Function +End Class +''' +''' A location group of records of different constituents and time/value pairs +''' +Public Class clsWQDUSLocation + Public Location As String = "" + Public Constituents As New Dictionary(Of String, clsWQDUSConstituent)() + Public Sub New(ByVal aLoc As String) + Location = aLoc + End Sub + Public ReadOnly Property DataKeys() As List(Of String) + Get + Dim lst As New List(Of String)() + For Each lcon As clsWQDUSConstituent In Constituents.Values + lst.AddRange(lcon.DataKeys()) + Next + Return lst + End Get + End Property + Public Sub AddData(ByVal aRecord() As String) + Dim lname As String = aRecord(clsWQDUSColumns.colCharacteristicName) + Dim lunit As String = aRecord(clsWQDUSColumns.colResultMeasureUnitCode) + Dim lfraction As String = aRecord(clsWQDUSColumns.colResultSampleFractionText) + + 'For I As Integer = 0 To aRecord.Length - 1 + ' If aRecord(I) = "Nitrate as N" Then + ' Dim lfound As String = "Found" + ' End If + 'Next + + Dim lcons_key As String = lname + If Not String.IsNullOrEmpty(lfraction) Then + lcons_key = lname & "-" & lfraction + End If + If Not String.IsNullOrEmpty(lname) AndAlso lname.ToLower() = "nitrate as n" Then + lname = "Nitrate" + lcons_key = lname & "-" & lfraction + aRecord(clsWQDUSColumns.colCharacteristicName) = lname + If lunit = "mg/l" Then + lunit = "mg/l as N" + aRecord(clsWQDUSColumns.colResultMeasureUnitCode) = lunit + End If + End If + If Not Constituents.ContainsKey(lcons_key) Then + Constituents.Add(lcons_key, New clsWQDUSConstituent(lcons_key)) + End If + Constituents.Item(lcons_key).AddData(aRecord) + End Sub +End Class + +Public Class clsWQDUSConstituent + Public Selected As Boolean = False + Public Name As String = "" + ' unit -> records of data points + Public RecordGroup As New Dictionary(Of String, List(Of clsWQDUSDataPoint))() + Public ReadOnly Property Unit() As String + Get + If RecordGroup.Count = 0 Then + Return "" + Else + Return RecordGroup(0).Item(0).Unit + End If + Return "" + End Get + End Property + Public ReadOnly Property Units() As List(Of String) + Get + Return RecordGroup.Keys().ToList() + End Get + End Property + Public ReadOnly Property DataKeys() As List(Of String) + Get + Dim lst As New List(Of String)() + For Each lunit As String In RecordGroup.Keys() + lst.Add(Name & "-" & lunit) + Next + Return lst + End Get + End Property + Public ReadOnly Property SampleFraction(ByVal aUnit As String) As List(Of String) + Get + Dim list As New List(Of String)() + For Each ldp As clsWQDUSDataPoint In RecordGroup.Item(aUnit) + If Not String.IsNullOrEmpty(ldp.ResultSampleFractionText) AndAlso Not list.Contains(ldp.ResultSampleFractionText) Then + list.Add(ldp.ResultSampleFractionText) + End If + Next + Return list + End Get + End Property + Public Sub New(ByVal aName As String) + Name = aName + End Sub + Public Function AddData(ByVal aRecord() As String) As Boolean + Dim lFoundValue As Boolean = False + Dim lDataPoint As New clsWQDUSDataPoint() + With lDataPoint + .sDate = aRecord(clsWQDUSColumns.colActivityStartDate) + .sTime = aRecord(clsWQDUSColumns.colActivityStartTime) + .ResultSampleFractionText = aRecord(clsWQDUSColumns.colResultSampleFractionText) + .ResultStatusIdentifier = aRecord(clsWQDUSColumns.colResultStatusIdentifier) + If Not String.IsNullOrEmpty(aRecord(clsWQDUSColumns.colResultMeasureValue)) Then + .Value = aRecord(clsWQDUSColumns.colResultMeasureValue) + .Unit = aRecord(clsWQDUSColumns.colResultMeasureUnitCode) + lFoundValue = True + ElseIf Not String.IsNullOrEmpty(aRecord(clsWQDUSColumns.colResultDepthHeightMeasureValue)) Then + .Value = aRecord(clsWQDUSColumns.colResultDepthHeightMeasureValue) + .Unit = aRecord(clsWQDUSColumns.colResultDepthHeightMeasureUnitCode) + lFoundValue = True + ElseIf Not String.IsNullOrEmpty(aRecord(clsWQDUSColumns.colDetectionQuantitationLimitMeasureValue)) Then + .Value = aRecord(clsWQDUSColumns.colDetectionQuantitationLimitMeasureValue) + .Unit = aRecord(clsWQDUSColumns.colDetectionQuantitationLimitMeasureUnitCode) + lFoundValue = True + End If + .Attrib = aRecord(clsWQDUSColumns.colMeasureQualifierCode) + If String.IsNullOrEmpty(.Attrib) Then + .Attrib = aRecord(clsWQDUSColumns.colResultStatusIdentifier) + End If + .Resulttype = aRecord(clsWQDUSColumns.colResultValueTypeName) + If lFoundValue Then + If Not RecordGroup.ContainsKey(.Unit) Then + RecordGroup.Add(.Unit, New List(Of clsWQDUSDataPoint)()) + End If + End If + End With + If lFoundValue Then + RecordGroup.Item(lDataPoint.Unit).Add(lDataPoint) + End If + Return lFoundValue + End Function +End Class + +Public Class clsWQDUSDataPoint + Public sDate As String + Public sTime As String + Public Value As String + Public Unit As String + Public Attrib As String + Public ResultSampleFractionText As String + Public ResultStatusIdentifier As String + Public Resulttype As String + Public atcDataTime As Double = -1 + Public vbDataTime As DateTime + Public Selected As Boolean = False + Public Function SetDataTime() As Boolean + Try + Dim ldates(5) As Integer + If DateTime.TryParse(sDate & "," & sTime, vbDataTime) Then + ldates(0) = vbDataTime.Year + ldates(1) = vbDataTime.Month + ldates(2) = vbDataTime.Day + If String.IsNullOrEmpty(sTime) OrElse sTime.IndexOf(":") < 0 Then + ldates(3) = 24 + Else + ldates(3) = vbDataTime.Hour + ldates(4) = vbDataTime.Minute + ldates(5) = vbDataTime.Second + End If + ElseIf DateTime.TryParse(sDate, vbDataTime) Then + ldates(0) = vbDataTime.Year + ldates(1) = vbDataTime.Month + ldates(2) = vbDataTime.Day + ldates(3) = 24 + End If + atcDataTime = Date2J(ldates) + Catch ex As Exception + Return False + End Try + Return True + End Function +End Class + +Public Class clsWQDUSPreferred + Public Shared WaterQuality As New List(Of String)() + Public Shared WaterQualitySpecies As New List(Of String)() + Shared Sub New() + With WaterQuality + .Add("Ammonia-Nitrogen as N") + .Add("Biochemical Oxygen Demand") + .Add("Carbonaceous biochemical oxygen demand") + .Add("Dissolved Oxygen") + .Add("Total Suspended Solids") + .Add("Temperature, Water") + .Add("Chlorophyll a") + .Add("Escherichia Coli") + .Add("Fecal Coliform") + .Add("Flow") + .Add("Gage height") + .Add("Inorganic Nitrogen (nitrate and nitrite) as N") + .Add("Kjeldahl Nitrogen") + .Add("Nitrate as N") + .Add("Nitrite as N") + .Add("Nitrogen, mixed forms (NH3), (NH44), organic, (NO2), and (NO3)") + .Add("Organic carbon") + .Add("Organic Nitrogen") + .Add("Orthophosphate as P") + .Add("pH") + .Add("Phosphate-phosphorus as P") + .Add("Phosphorus") + .Add("Stream flow, instantaneous") + .Add("Sulfate") + .Add("Total Phosphorus, mixed forms") + End With + With WaterQualitySpecies + .Add("Ammonia") + .Add("Biochemical Oxygen Demand") + .Add("Carbonaceous biochemical oxygen demand") + .Add("Dissolved Oxygen") + .Add("Total Suspended Solids") + .Add("Temperature, Water") + .Add("Chlorophyll a") + .Add("Escherichia Coli") + .Add("Fecal Coliform") + .Add("Flow") + .Add("Gage height") + .Add("Inorganic Nitrogen (nitrate and nitrite)") + .Add("Kjeldahl Nitrogen") + .Add("Nitrate") + .Add("Nitrite") + .Add("Nitrogen, mixed forms (NH3), (NH44), organic, (NO2), and (NO3)") + .Add("Organic carbon") + .Add("Organic Nitrogen") + .Add("Orthophosphate") + .Add("pH") + .Add("Phosphate") + .Add("Phosphate-phosphorus") + .Add("Phosphorus") + .Add("Stream flow, instantaneous") + .Add("Sulfate") + .Add("Total Phosphorus, mixed forms") + End With + End Sub + Public Shared Function IsPreferredWaterQuality(ByVal aSpecies As String) As Boolean + If String.IsNullOrEmpty(aSpecies) Then + Return False + End If + Dim lIsPreferred As Boolean = False + For Each species As String In WaterQualitySpecies + If aSpecies.ToLower().StartsWith(species.ToLower()) Then + If species = "pH" Then + If aSpecies.StartsWith(species) Then + lIsPreferred = True + End If + Else + lIsPreferred = True + End If + If lIsPreferred Then + Exit For + End If + End If + Next + Return lIsPreferred + End Function +End Class + diff --git a/atcTimeseriesWaterQualUS/frmSelect.Designer.vb b/atcTimeseriesWaterQualUS/frmSelect.Designer.vb new file mode 100644 index 000000000..8b1897df1 --- /dev/null +++ b/atcTimeseriesWaterQualUS/frmSelect.Designer.vb @@ -0,0 +1,184 @@ + _ +Partial Class frmSelect + Inherits System.Windows.Forms.Form + + 'Form overrides dispose to clean up the component list. + _ + Protected Overrides Sub Dispose(ByVal disposing As Boolean) + Try + If disposing AndAlso components IsNot Nothing Then + components.Dispose() + End If + Finally + MyBase.Dispose(disposing) + End Try + End Sub + + 'Required by the Windows Form Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Windows Form Designer + 'It can be modified using the Windows Form Designer. + 'Do not modify it using the code editor. + _ + Private Sub InitializeComponent() + Me.lstLocations = New System.Windows.Forms.CheckedListBox() + Me.lstConstituents = New System.Windows.Forms.CheckedListBox() + Me.Label1 = New System.Windows.Forms.Label() + Me.Label2 = New System.Windows.Forms.Label() + Me.spaneMain = New System.Windows.Forms.SplitContainer() + Me.btnClearLoc = New System.Windows.Forms.Button() + Me.txtMsgCons = New System.Windows.Forms.TextBox() + Me.btnClearCons = New System.Windows.Forms.Button() + Me.btnDoTser = New System.Windows.Forms.Button() + Me.btnCancel = New System.Windows.Forms.Button() + Me.spaneMain.Panel1.SuspendLayout() + Me.spaneMain.Panel2.SuspendLayout() + Me.spaneMain.SuspendLayout() + Me.SuspendLayout() + ' + 'lstLocations + ' + Me.lstLocations.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _ + Or System.Windows.Forms.AnchorStyles.Left) _ + Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) + Me.lstLocations.FormattingEnabled = True + Me.lstLocations.Location = New System.Drawing.Point(6, 20) + Me.lstLocations.Name = "lstLocations" + Me.lstLocations.Size = New System.Drawing.Size(313, 259) + Me.lstLocations.TabIndex = 0 + ' + 'lstConstituents + ' + Me.lstConstituents.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _ + Or System.Windows.Forms.AnchorStyles.Left) _ + Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) + Me.lstConstituents.FormattingEnabled = True + Me.lstConstituents.Location = New System.Drawing.Point(3, 19) + Me.lstConstituents.Name = "lstConstituents" + Me.lstConstituents.Size = New System.Drawing.Size(317, 259) + Me.lstConstituents.TabIndex = 1 + ' + 'Label1 + ' + Me.Label1.AutoSize = True + Me.Label1.Location = New System.Drawing.Point(3, 4) + Me.Label1.Name = "Label1" + Me.Label1.Size = New System.Drawing.Size(53, 13) + Me.Label1.TabIndex = 2 + Me.Label1.Text = "Locations" + ' + 'Label2 + ' + Me.Label2.AutoSize = True + Me.Label2.Location = New System.Drawing.Point(3, 3) + Me.Label2.Name = "Label2" + Me.Label2.Size = New System.Drawing.Size(65, 13) + Me.Label2.TabIndex = 3 + Me.Label2.Text = "Constituents" + ' + 'spaneMain + ' + Me.spaneMain.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) _ + Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) + Me.spaneMain.Location = New System.Drawing.Point(12, 12) + Me.spaneMain.Name = "spaneMain" + ' + 'spaneMain.Panel1 + ' + Me.spaneMain.Panel1.Controls.Add(Me.lstConstituents) + Me.spaneMain.Panel1.Controls.Add(Me.Label2) + Me.spaneMain.Panel1.Controls.Add(Me.btnClearCons) + ' + 'spaneMain.Panel2 + ' + Me.spaneMain.Panel2.Controls.Add(Me.btnClearLoc) + Me.spaneMain.Panel2.Controls.Add(Me.txtMsgCons) + Me.spaneMain.Panel2.Controls.Add(Me.Label1) + Me.spaneMain.Panel2.Controls.Add(Me.lstLocations) + Me.spaneMain.Size = New System.Drawing.Size(658, 398) + Me.spaneMain.SplitterDistance = 325 + Me.spaneMain.TabIndex = 4 + ' + 'btnClearLoc + ' + Me.btnClearLoc.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) + Me.btnClearLoc.Location = New System.Drawing.Point(6, 285) + Me.btnClearLoc.Name = "btnClearLoc" + Me.btnClearLoc.Size = New System.Drawing.Size(50, 23) + Me.btnClearLoc.TabIndex = 3 + Me.btnClearLoc.Text = "Clear" + Me.btnClearLoc.UseVisualStyleBackColor = True + ' + 'txtMsgCons + ' + Me.txtMsgCons.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _ + Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) + Me.txtMsgCons.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle + Me.txtMsgCons.Location = New System.Drawing.Point(59, 285) + Me.txtMsgCons.Multiline = True + Me.txtMsgCons.Name = "txtMsgCons" + Me.txtMsgCons.ReadOnly = True + Me.txtMsgCons.ScrollBars = System.Windows.Forms.ScrollBars.Vertical + Me.txtMsgCons.Size = New System.Drawing.Size(264, 110) + Me.txtMsgCons.TabIndex = 5 + ' + 'btnClearCons + ' + Me.btnClearCons.Location = New System.Drawing.Point(6, 282) + Me.btnClearCons.Name = "btnClearCons" + Me.btnClearCons.Size = New System.Drawing.Size(50, 23) + Me.btnClearCons.TabIndex = 4 + Me.btnClearCons.Text = "Clear" + Me.btnClearCons.UseVisualStyleBackColor = True + ' + 'btnDoTser + ' + Me.btnDoTser.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) + Me.btnDoTser.Location = New System.Drawing.Point(491, 416) + Me.btnDoTser.Name = "btnDoTser" + Me.btnDoTser.Size = New System.Drawing.Size(98, 23) + Me.btnDoTser.TabIndex = 5 + Me.btnDoTser.Text = "Make Timeseries" + Me.btnDoTser.UseVisualStyleBackColor = True + ' + 'btnCancel + ' + Me.btnCancel.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) + Me.btnCancel.Location = New System.Drawing.Point(595, 416) + Me.btnCancel.Name = "btnCancel" + Me.btnCancel.Size = New System.Drawing.Size(75, 23) + Me.btnCancel.TabIndex = 6 + Me.btnCancel.Text = "Cancel" + Me.btnCancel.UseVisualStyleBackColor = True + ' + 'frmSelect + ' + Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) + Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font + Me.ClientSize = New System.Drawing.Size(682, 451) + Me.Controls.Add(Me.btnCancel) + Me.Controls.Add(Me.btnDoTser) + Me.Controls.Add(Me.spaneMain) + Me.Name = "frmSelect" + Me.Text = "Select Water Quality Data" + Me.spaneMain.Panel1.ResumeLayout(False) + Me.spaneMain.Panel1.PerformLayout() + Me.spaneMain.Panel2.ResumeLayout(False) + Me.spaneMain.Panel2.PerformLayout() + Me.spaneMain.ResumeLayout(False) + Me.ResumeLayout(False) + + End Sub + + Friend WithEvents lstConstituents As Windows.Forms.CheckedListBox + Friend WithEvents lstLocations As Windows.Forms.CheckedListBox + Friend WithEvents Label1 As Windows.Forms.Label + Friend WithEvents Label2 As Windows.Forms.Label + Friend WithEvents spaneMain As Windows.Forms.SplitContainer + Friend WithEvents btnClearLoc As Windows.Forms.Button + Friend WithEvents btnClearCons As Windows.Forms.Button + Friend WithEvents btnDoTser As Windows.Forms.Button + Friend WithEvents btnCancel As Windows.Forms.Button + Friend WithEvents txtMsgCons As Windows.Forms.TextBox +End Class diff --git a/atcTimeseriesWaterQualUS/frmSelect.resx b/atcTimeseriesWaterQualUS/frmSelect.resx new file mode 100644 index 000000000..7080a7d11 --- /dev/null +++ b/atcTimeseriesWaterQualUS/frmSelect.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/atcTimeseriesWaterQualUS/frmSelect.vb b/atcTimeseriesWaterQualUS/frmSelect.vb new file mode 100644 index 000000000..80f280178 --- /dev/null +++ b/atcTimeseriesWaterQualUS/frmSelect.vb @@ -0,0 +1,116 @@ +Imports System.Windows.Forms + +Public Class frmSelect + Private pRawDataGroup As clsWQDUSLocations + Private pSelectedLocations As List(Of String) + Private pSelectedConstituents As List(Of String) + + Public Sub New(ByVal aRawDataGroup As clsWQDUSLocations, + ByRef aSelectedLocations As List(Of String), + ByRef aSelectedConstituents As List(Of String)) + + ' This call is required by the designer. + InitializeComponent() + + ' Add any initialization after the InitializeComponent() call. + pRawDataGroup = aRawDataGroup + pSelectedLocations = aSelectedLocations + pSelectedConstituents = aSelectedConstituents + PopulateData(pRawDataGroup) + End Sub + + Public Sub PopulateData(ByVal aRawDataGroup As clsWQDUSLocations) + Dim lSortedList As New SortedList(Of String, Integer)() + For Each loc As String In aRawDataGroup.Keys() + lSortedList.Add(loc, 0) + Next + For Each loc As String In lSortedList.Keys + lstLocations.Items().Add(loc) + Next + lSortedList.Clear() + Dim lSortedListPreferred As New SortedList(Of String, Integer)() + For Each cons As String In aRawDataGroup.GetUniqueConstituentList() + If clsWQDUSPreferred.IsPreferredWaterQuality(cons) Then + If Not lSortedListPreferred.ContainsKey(cons) Then + lSortedListPreferred.Add(cons, 0) + End If + Else + If Not lSortedList.ContainsKey(cons) Then + lSortedList.Add(cons, 0) + End If + End If + Next + For Each cons As String In lSortedListPreferred.Keys() + lstConstituents.Items().Add(cons) + Next + For Each cons As String In lSortedList.Keys() + lstConstituents.Items().Add(cons) + Next + End Sub + + Private Sub btnClearLoc_Click(sender As Object, e As EventArgs) Handles btnClearLoc.Click + For Each ind As Integer In lstLocations.CheckedIndices + lstLocations.SetItemChecked(ind, False) + Next + End Sub + + Private Sub btnClearCons_Click(sender As Object, e As EventArgs) Handles btnClearCons.Click + For Each ind As Integer In lstConstituents.CheckedIndices + lstConstituents.SetItemChecked(ind, False) + Next + End Sub + + Private Sub lstConstituents_ItemCheck(sender As Object, e As ItemCheckEventArgs) Handles lstConstituents.ItemCheck + If e.NewValue = CheckState.Checked Then + If Not pSelectedConstituents.Contains(lstConstituents.SelectedItem.ToString()) Then + pSelectedConstituents.Add(lstConstituents.SelectedItem.ToString()) + End If + Else + If pSelectedConstituents.Contains(lstConstituents.SelectedItem.ToString()) Then + pSelectedConstituents.Remove(lstConstituents.SelectedItem.ToString()) + End If + End If + End Sub + Private Sub lstLocations_ItemCheck(sender As Object, e As ItemCheckEventArgs) Handles lstLocations.ItemCheck + txtMsgCons.Text = "" + If e.NewValue = CheckState.Checked Then + If Not pSelectedLocations.Contains(lstLocations.SelectedItem.ToString()) Then + pSelectedLocations.Add(lstLocations.SelectedItem.ToString()) + End If + Dim loc As clsWQDUSLocation = pRawDataGroup.Item(lstLocations.SelectedItem) + Dim cons As List(Of String) = loc.DataKeys() + Dim lnalist As New List(Of String)() + For Each Item As String In lstConstituents.CheckedItems + If Not cons.Contains(Item) Then + lnalist.Add(Item) + End If + Next + Dim lmsg As String = loc.Location & " has none of the following:" & vbCrLf + If lnalist.Count > 0 Then + For Each itm As String In lnalist + lmsg &= itm & vbCrLf + Next + txtMsgCons.Text = lmsg + End If + Else + If pSelectedLocations.Contains(lstLocations.SelectedItem.ToString()) Then + pSelectedLocations.Remove(lstLocations.SelectedItem.ToString()) + End If + End If + End Sub + + Private Sub btnCancel_Click(sender As Object, e As EventArgs) Handles btnCancel.Click + lstLocations.ClearSelected() + lstConstituents.ClearSelected() + lstLocations.Items.Clear() + lstConstituents.Items.Clear() + Me.DialogResult = DialogResult.Cancel + Close() + End Sub + + Private Sub btnDoTser_Click(sender As Object, e As EventArgs) Handles btnDoTser.Click + Me.DialogResult = DialogResult.OK + Close() + End Sub + +End Class \ No newline at end of file diff --git a/atcTimeseriesWaterQualUS/obj/x86/Debug/atcTimeseriesWaterQualUS15.vbproj.FileListAbsolute.txt b/atcTimeseriesWaterQualUS/obj/x86/Debug/atcTimeseriesWaterQualUS15.vbproj.FileListAbsolute.txt new file mode 100644 index 000000000..c682ae7e8 --- /dev/null +++ b/atcTimeseriesWaterQualUS/obj/x86/Debug/atcTimeseriesWaterQualUS15.vbproj.FileListAbsolute.txt @@ -0,0 +1,10 @@ +C:\Dev\BASINS\BASINS\atcTimeseriesWaterQualUS\obj\x86\Debug\atcTimeseriesWaterQualUS15.vbprojResolveAssemblyReference.cache +C:\Dev\BASINS\BASINS\atcTimeseriesWaterQualUS\obj\x86\Debug\atcTimeseriesWaterQualUS.frmSelect.resources +C:\Dev\BASINS\BASINS\atcTimeseriesWaterQualUS\obj\x86\Debug\atcTimeseriesWaterQualUS.Resources.resources +C:\Dev\BASINS\BASINS\atcTimeseriesWaterQualUS\obj\x86\Debug\atcTimeseriesWaterQualUS15.vbproj.GenerateResource.Cache +C:\Dev\BASINS\BASINS\Bin\Plugins\BASINS\atcTimeseriesWaterQualUS.dll +C:\Dev\BASINS\BASINS\Bin\Plugins\BASINS\atcTimeseriesWaterQualUS.pdb +C:\Dev\BASINS\BASINS\Bin\Plugins\BASINS\atcTimeseriesWaterQualUS.xml +C:\Dev\BASINS\BASINS\atcTimeseriesWaterQualUS\obj\x86\Debug\atcTimeseriesWaterQualUS.dll +C:\Dev\BASINS\BASINS\atcTimeseriesWaterQualUS\obj\x86\Debug\atcTimeseriesWaterQualUS.xml +C:\Dev\BASINS\BASINS\atcTimeseriesWaterQualUS\obj\x86\Debug\atcTimeseriesWaterQualUS.pdb