Skip to content

Commit

Permalink
Automated Graph Edits and More Error Check
Browse files Browse the repository at this point in the history
1.  If the time steps do not match for the mathematical operation, then
users gets an error message, and EXP+ moves to the next graph.
2. If an error is encountered, then the movement to the next graph is
calculated in a separate function.
3. Now subtract and divide option are also available.
4. 1.32 User's Manual Added
5.  Code was cleaned, unnecessary variables were removed. Outdated
comments were removed.
6. Install Text was updated with the information about Version 1.32.
7. Assembly info was updated with the new version of EXP+.
  • Loading branch information
mishranurag committed May 9, 2017
1 parent b91ecae commit 39128a9
Show file tree
Hide file tree
Showing 7 changed files with 88 additions and 85 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -393,3 +393,4 @@ atcGraphFromJSON/obj/x86/Debug/atcGraphFromJSON15-4.0.vbproj.FileListAbsolute.tx
*.cache
atcGraphFromJSON/obj/x86/Debug/atcGraphFromJSON15.vbproj.FileListAbsolute.txt
*.force
HSPEXP/Output/HSPEXP+1.32SetUp.exe
Binary file modified HSPEXP/HSPEXP+.chm
Binary file not shown.
55 changes: 17 additions & 38 deletions HSPEXP/HSPFOutputReports.vb
Original file line number Diff line number Diff line change
@@ -1,27 +1,15 @@
Imports System
Imports atcUtility
Imports atcData
Imports atcGraph
Imports atcTimeseriesStatistics
Imports atcWDM
Imports atcHspfBinOut
Imports HspfSupport
Imports atcUCI
Imports atcBasinsObsWQ
Imports atcList
Imports MapWinUtility 'this has to be downloaded separately from http://svn.mapwindow.org/svnroot/MapWindow4Dev/Bin/
Imports ZedGraph 'this is coming from a DLL as the original project was a C# project and not a VB project
Imports System.Collections.Specialized
Imports System.IO 'added by Becky to get directory exists function



Module HSPFOutputReports
Private pBaseFolders As New ArrayList
Private pTestPath As String
Private pRootPath As String 'if the user is using the VT run number folder naming conventions (Run01, Run02, etc.), this is the root path that holds all the run folders
Private pBaseName As String 'this is the base part of the file name (i.e., without .uci, .wdm, .exs) - it MUST be used to name everything
Private pRunNo As Integer = -1 'the current run number - may or may not be provided, if it is then use it to copy to a new folder
Private pOutputLocations As New atcCollection

Private pGraphSaveFormat As String
Expand All @@ -30,13 +18,7 @@ Module HSPFOutputReports
Private pGraphAnnual As Boolean = True
Private pCurveStepType As String = "NonStep"
Private pConstituents As New atcCollection
Private pPerlndSegmentStarts() As Integer
Private pImplndSegmentStarts() As Integer
Private pGraphWQOnly As Boolean = False 'indicates whether ONLY graphing water quality
Private pGraphWQ As Boolean = False 'indicates whether to graph only water quality
Private pWaterYears As Boolean = False
Private pExpertPrec As Boolean = False
Private pIdsPerSeg As Integer = 50
'following were added by Becky:
'Private pProgressBar As New RWZProgress
Private pMakeStdGraphs As Boolean 'flag to indicate user wants standard graphs (monthly, daily, storms, flow duration)
Expand All @@ -51,14 +33,12 @@ Module HSPFOutputReports
Private pListModelParameters As Boolean = False
Private ASDate, AEDate As Date



Private Sub Initialize()
If Logger.ProgressStatus Is Nothing OrElse Not (TypeOf (Logger.ProgressStatus) Is MonitorProgressStatus) Then
'Start running status monitor to give better progress and status indication during long-running processes
Dim pStatusMonitor As New MonitorProgressStatus
If pStatusMonitor.StartMonitor(FindFile("Find Status Monitor", "StatusMonitor.exe"), _
IO.Directory.GetCurrentDirectory, _
If pStatusMonitor.StartMonitor(FindFile("Find Status Monitor", "StatusMonitor.exe"),
IO.Directory.GetCurrentDirectory,
System.Diagnostics.Process.GetCurrentProcess.Id) Then
'put our status monitor (StatusMonitor.exe) between the Logger and the default MW status monitor
pStatusMonitor.InnerProgressStatus = Logger.ProgressStatus
Expand All @@ -76,7 +56,6 @@ Module HSPFOutputReports
pOutputLocations.Clear()

pGraphSaveFormat = ".png"
'pGraphSaveFormat = ".emf"
pGraphSaveWidth = 1300
pGraphSaveHeight = 768
pMakeStdGraphs = True
Expand Down Expand Up @@ -114,7 +93,7 @@ Module HSPFOutputReports
End If
'set up the timeseries attributes for statistics
atcTimeseriesStatistics.atcTimeseriesStatistics.InitializeShared()

pTestPath = StartUp.cmbUCIPath.Text
pBaseName = lTestName
pTestPath = Mid(pTestPath, 1, Len(pTestPath) - Len(pBaseName) - 4)
Expand All @@ -125,7 +104,7 @@ Module HSPFOutputReports
End If
Next
StartUp.Hide()
Logger.StartToFile(pTestPath & "LogFile.txt")
Logger.StartToFile(pTestPath & "LogFile.txt", , False)
Logger.Status("Run characteristics read", True)
End Sub

Expand Down Expand Up @@ -220,14 +199,13 @@ Module HSPFOutputReports

loutfoldername = pTestPath



Dim lDateString As String = Format(Year(lRunMade), "00") & Format(Month(lRunMade), "00") & _
Dim lDateString As String = Format(Year(lRunMade), "00") & Format(Month(lRunMade), "00") &
Format(Microsoft.VisualBasic.DateAndTime.Day(lRunMade), "00") & Format(Hour(lRunMade), "00") & Format(Minute(lRunMade), "00")
loutfoldername = pTestPath & "Reports_" & lDateString & "\"
System.IO.Directory.CreateDirectory(loutfoldername)
System.IO.File.Copy(pTestPath & pBaseName & ".uci", loutfoldername & pBaseName & ".uci", overwrite:=True)
Directory.CreateDirectory(loutfoldername)
File.Copy(pTestPath & pBaseName & ".uci", loutfoldername & pBaseName & ".uci", overwrite:=True)
'A folder name is given that has the basename and the time when the run was made.

pListModelParameters = False
If pListModelParameters Then
ListReachParametersForAllUCIFiles(loutfoldername)
Expand Down Expand Up @@ -256,7 +234,7 @@ Module HSPFOutputReports
Next
Logger.Status(Now & " Producing Area Reports.", True)
Logger.Dbg(Now & " Producing land use and area reports")
'Now the area repotrs are generated for all the reaches in the UCI file.
'Now the area reports are generated for all the reaches in the UCI file.
Dim lReport As atcReport.ReportText = HspfSupport.AreaReport(aHspfUci, lRunMade, lOperationTypes, alocations, True, loutfoldername & "/AreaReports/")
lReport.MetaData.Insert(lReport.MetaData.ToString.IndexOf("Assembly"), lReport.AssemblyMetadata(System.Reflection.Assembly.GetExecutingAssembly) & vbCrLf)
SaveFileString(loutfoldername & "/AreaReports/AreaReport.txt", lReport.ToString)
Expand All @@ -267,11 +245,12 @@ Module HSPFOutputReports
Dim lExpertSystemFileNames As New NameValueCollection
AddFilesInDir(lExpertSystemFileNames, IO.Directory.GetCurrentDirectory, False, "*.exs")
If lExpertSystemFileNames.Count < 1 Then 'Becky added this if-then to warn the user if no EXS files exist
'In future, at this point, user should get an option if they want to make teir own exs file and this program should
'help the user do it.
MsgBox("No basins specifications file (*.exs) file found in directory " & IO.Directory.GetCurrentDirectory & "! Statistics, summaries, and graphs cannot be computed.", vbOKOnly, "No Specification File!")
MsgBox("No basins specifications file (*.exs) file found in directory " & IO.Directory.GetCurrentDirectory &
"! Statistics, summaries, and graphs cannot be computed. EXS file can be generated using WinHSPF3.1 or later.",
vbOKOnly, "No Specification File!")
Logger.Dbg(Now & " No basins specifications file found, no statistics computed")
End If

Dim lExpertSystem As HspfSupport.atcExpertSystem

For Each lExpertSystemFileName As String In lExpertSystemFileNames
Expand Down Expand Up @@ -483,7 +462,7 @@ Module HSPFOutputReports
Dim QUALActivity As Integer = aHspfUci.OpnSeqBlock.Opn(i).Tables("ACTIVITY").Parms(QUAL).Value
If QUALActivity = 0 Then 'Make sure to double check code for AGCHEM cases.

Logger.Dbg("The operation " & lOperationType & " " & aHspfUci.OpnSeqBlock.Opns(i).Id & _
Logger.Dbg("The operation " & lOperationType & " " & aHspfUci.OpnSeqBlock.Opns(i).Id &
"does not have PQUAL section active. Please check output for consistency!")
Else
NQUALS = aHspfUci.OpnSeqBlock.Opn(i).Tables("QUAL-PROPS").OccurCount
Expand All @@ -506,7 +485,7 @@ Module HSPFOutputReports
For Each QUALIDItem In AcceptableQUALNames
If Not QUALIDS.Contains(QUALIDItem) Then
Dim ans As Integer
ans = MsgBox("The QUALID " & QUALIDItem & "has not been used for all the operations. The nutrient balance reports will not continue" & _
ans = MsgBox("The QUALID " & QUALIDItem & "has not been used for all the operations. The nutrient balance reports will not continue" &
" and the program will exit!")
End

Expand Down Expand Up @@ -642,10 +621,10 @@ Module HSPFOutputReports
' lOutFolderName, True, True)
End If
Else
Logger.Dbg("The HBN file didn't have any data for the constituent " & lConstituent & " therefore the balance reports for " & _
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. " & _
ans = MsgBox("HBN files do not have any data. Constituent Balance reports will not be generated. " &
"Did uci file run properly last time?")
End If
For Each lTimeSeries As atcTimeseries In lScenarioResults.DataSets
Expand Down
4 changes: 2 additions & 2 deletions HSPEXP/My Project/AssemblyInfo.vb
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,6 @@ Imports System.Runtime.InteropServices
' by using the '*' as shown below:
' <Assembly: AssemblyVersion("1.0.*")>

<Assembly: AssemblyVersion("1.31.0.0")>
<Assembly: AssemblyFileVersion("1.31.0.0")>
<Assembly: AssemblyVersion("1.32.0.0")>
<Assembly: AssemblyFileVersion("1.32.0.0")>
<Assembly: NeutralResourcesLanguage("en-US")>
2 changes: 1 addition & 1 deletion HSPEXP/SetUpScript.iss
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={reg:HKLM\SOFTWARE\RESPEC\BASINS41,Base Directory|{pf}\HSPEXP+}
DefaultGroupName={#MyAppName}
OutputBaseFilename=HSPEXP+1.31SetUp
OutputBaseFilename=HSPEXP+1.32SetUp
Compression=lzma
SolidCompression=yes
InfoBeforeFile=install.txt
Expand Down
9 changes: 9 additions & 0 deletions HSPEXP/install.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
Dated: 5/9/2017
HSPEXP+1.32
Features:
1. A user can now add, subtract, multiply, or divide a timeseries to an existing time series before plotting. Keywords "add", "subtract", "multiply", or "divide" will ensure that the timeseries in the current row will get added, subtracted, multiplied, or divided to the timeseries in the previous row.

Bugs Fixed:
1. Error checking has been improved. If HSPEXP+ cannot find a timeseries, it provides a proper error message and moves to the next graph, and generates rest of the graphs.
2. Code has been cleaned by removing unneeded variables and references.

Dated: 4/14/2017
HSPEXP+1.31
Bugs Fixed
Expand Down
Loading

0 comments on commit 39128a9

Please sign in to comment.