Pseudo-code structure of program thresh.
1	Program thresh
2	Reference modules
3	Declare variables
4	subroutine date_and_time
5		function imid
6			Extract current date and time
7	subroutine titl
8		Print banner on terminal
9	Open ThreshLog.txt and log current date and time
10	subroutine read_init
11		Read thresh_in.txt and save copy to log file
12		subroutine error 1
13			Provide error statements if input data is entered incorrectly
14		subroutine check_antMonth_antDay
15			Check reset dates for antecedent precipitation totals
16		Determine desired plot format (gnp1, gnp2, dgrs)
17		subroutine check_switches
18			if  [power law function] then
19				subroutine set_power_limits
20					Upper and lower duration limit for power-law intensity-duration threshold
21			else if [polynomial interpolation] then
22				subroutine set_poly_limits
23					Upper and lower duration limit for polynomial intensity-duration threshold
24			else if [linearly interpolated threshold] then
25				subroutine read_interpolating_points
26					Upper and lower duration limit for polynomial intensity-duration threshold
27		function check_AWI
28		function check_SAT
29	Write input variables into log file
30	Convert AWI and average intensity to correct units, if needed
31	Allocate and initialize data arrays
32	subroutine read_thlast
33		Get time of last data processed previously
34		if [time-stamps are at the end of each hour] then
35			subroutine ir24
36				Adjust for leap year and midnight = 24:00
37				Correct date if offset straddles midnight
38	Read data files and compute precipitation totals, intensity, & duration
39	subroutine read_station_file
40		Obtain date and time of latest data in file
41	subroutine s1904t
42		Convert time and date to serial numbers
43		Initialize variables to track storms at each station
44	subroutine track_storm
45		Compute AWI, track beginning, end and duration of storms
46	Compute intensity and duration at beginning of record
47	subroutine track_intensity
48		Step through cumulative precipitation and intensity computations for each file
49	if [stats was chosen] then
50		subroutine count_events
51			Count number of threshold exceedance
52		Convert time-series arrays to 1D station series array for plotter output
53	subroutine gnpts
54		Create time-series plot file for each station
55		Create short-term time-series plot file for each station
56	if [NOT forecast] then
57		subroutine arcsav
58			Create time-series archive file for each station
59	if [stats was chosen] then
60		subroutine gnpts1
61			Create time-series listings of threshold exceedance values
62		subroutine tindm
63			Creates time-series plots of daily maxima for each station
64	if [realtime (continuous mode) was chosen] then
65		if [plot format gnp1 was chosen] then
66			subroutine gnp1
67				Tab text; recent totals and intensities by station; in one file 
68		else if [plot format gnp2 was chosen] then
69			subroutine gnp2
70				Tab text; recent totals and intensities by station; separate file for each station
71		else if [plot format dgrs was chosen] then
72			subroutine dgrs
73				Tab text; paired current values of antecedent and recent cumulative precipitation for making x-y scatter plot with a different symbol for each station
74		subroutine alert
75			Construct a plain text table that is color-coded based on alert level
76		subroutine alerthtm
77			Construct a color-coded alert table in HTML format
78		subroutine tabl
79			Construct a plain text table of current values that is not color-coded
80		subroutine tablhtm
81			Construct an HTML table of current values, color-coded based on current rainfall intensity
82	Write status files
83	End the program; record time and date

