Skip to content

Commit 04dff2d

Browse files
author
William Downs
committed
comments and little renaming of classes
1 parent a53d465 commit 04dff2d

File tree

5 files changed

+59
-23
lines changed

5 files changed

+59
-23
lines changed

innovation_work/GUI_innov_initial.py

+10-4
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,17 @@ def __init__(self, window, grid_col, grid_row, initial, final):
5252

5353
#No convention for z coordinate among different files. Whatever is found is stored here
5454
self.level_type = None
55-
55+
56+
#resizing
5657
self.window = window
5758
self.window.grid_columnconfigure(0, weight = 1)
5859
self.window.grid_rowconfigure(0, weight = 1)
5960

6061
#a mainframe
6162
self.main_frame = ttk.Frame(self.window, padding = "8")
62-
self.main_frame.grid(column = grid_col, row = grid_row, sticky = "N, S, E, W")
63+
self.main_frame.grid(column = grid_col, row = grid_row, sticky = "N, S, E, W")
64+
65+
#resizing
6366
self.main_frame.grid_columnconfigure(0, weight = 1) #weights for whole grid
6467
self.main_frame.grid_rowconfigure(0, weight = 1) #weights for whole grid
6568
self.main_frame.grid_columnconfigure(1, weight = 20)
@@ -97,7 +100,8 @@ def __init__(self, window, grid_col, grid_row, initial, final):
97100
self.data_bar = ttk.Scrollbar(self.data_frame, orient = VERTICAL, command = self.data_menu.yview)
98101
self.data_menu.configure(yscrollcommand = self.data_bar.set)
99102
self.data_bar.grid(column = 2, row = 2, sticky = "N, S, W")
100-
103+
104+
#resizing
101105
self.data_frame.grid_columnconfigure(1, weight = 1)
102106
self.data_frame.grid_columnconfigure(2, weight = 1)
103107
self.data_frame.grid_rowconfigure(1, weight = 1)
@@ -120,6 +124,7 @@ def __init__(self, window, grid_col, grid_row, initial, final):
120124
self.level_menu.selection_set(0)
121125
self.level_menu.bind('<Return>', self.plot)
122126

127+
#resizing
123128
self.level_frame.grid_columnconfigure(1, weight = 1)
124129
self.level_frame.grid_columnconfigure(2, weight = 1)
125130
self.level_frame.grid_rowconfigure(1, weight = 1)
@@ -215,7 +220,8 @@ def plot(self, event = None):
215220
self.toolbar = NavigationToolbar2TkAgg(canvas, self.toolbar_frame)
216221
self.toolbar_frame.grid(column = 1, row = 3, sticky = "N, S, E, W")
217222
self.toolbar.grid(column = 1, row = 1, sticky = "N, S ,E , W")
218-
223+
224+
#resizing
219225
self.toolbar_frame.grid_columnconfigure(1, weight = 1)
220226
self.toolbar_frame.grid_rowconfigure(1, weight = 1)
221227

nCDF_initial_GUI/GUI_2D_obs_initial.py

+14-6
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
np.set_printoptions(threshold=np.nan) #without this setting, self.levels will be incomplete
2323

2424

25-
class GUI_2D_obs_initial:
25+
class GUI2DObs:
2626
'''
2727
2828
Incorporates plot_2D_obs_initial.py into a GUI for plotting observation QC values in 2D.
@@ -50,11 +50,13 @@ def __init__(self, window, grid_col, grid_row, obs_sequence):
5050

5151
#a mainframe
5252
self.main_frame = ttk.Frame(self.window, padding = "8")
53-
self.main_frame.grid(column = grid_col, row = grid_row, sticky = "N, S, E, W")
54-
self.main_frame.grid_columnconfigure(1, weight = 20) #weights for whole grid
53+
self.main_frame.grid(column = grid_col, row = grid_row, sticky = "N, S, E, W")
54+
55+
#resizing
56+
self.main_frame.grid_columnconfigure(1, weight = 20)
5557
self.main_frame.grid_columnconfigure(2, weight = 1)
5658
self.main_frame.grid_rowconfigure(0, weight = 1)
57-
self.main_frame.grid_rowconfigure(1, weight = 1) #weights for whole grid
59+
self.main_frame.grid_rowconfigure(1, weight = 1)
5860
self.main_frame.grid_rowconfigure(2, weight = 1)
5961
self.main_frame.grid_rowconfigure(3, weight = 1)
6062
self.main_frame.grid_rowconfigure(4, weight = 1)
@@ -97,6 +99,7 @@ def __init__(self, window, grid_col, grid_row, obs_sequence):
9799
self.obs_menu.configure(yscrollcommand = self.obs_bar.set)
98100
self.obs_bar.grid(column = 2, row = 2, rowspan = 2, sticky = "N, S, W")
99101

102+
#resizing
100103
self.obs_frame.grid_columnconfigure(1, weight = 1)
101104
self.obs_frame.grid_columnconfigure(2, weight = 1)
102105
self.obs_frame.grid_rowconfigure(1, weight = 1)
@@ -122,6 +125,7 @@ def __init__(self, window, grid_col, grid_row, obs_sequence):
122125
self.level_menu.configure(yscrollcommand = self.level_bar.set)
123126
self.level_bar.grid(column = 2, row = 2, rowspan = 2, sticky = "N, S, W")
124127

128+
#resizing
125129
self.level_frame.grid_rowconfigure(1, weight = 1)
126130
self.level_frame.grid_rowconfigure(2, weight = 1)
127131
self.level_frame.grid_columnconfigure(1, weight = 1)
@@ -185,7 +189,8 @@ def __init__(self, window, grid_col, grid_row, obs_sequence):
185189
self.qc_bar = ttk.Scrollbar(self.qc_frame, orient = HORIZONTAL, command = self.qc_menu.xview)
186190
self.qc_menu.configure(xscrollcommand = self.qc_bar.set)
187191
self.qc_bar.grid(column = 1, row = 3, rowspan = 1, sticky = "N, S, E, W")
188-
192+
193+
#resizing
189194
self.qc_frame.grid_rowconfigure(1, weight = 1)
190195
self.qc_frame.grid_rowconfigure(2, weight = 1)
191196
self.qc_frame.grid_columnconfigure(1, weight = 1)
@@ -283,8 +288,11 @@ def plot_2D(self, event = None):
283288
self.toolbar = NavigationToolbar2TkAgg(canvas, self.toolbar_frame)
284289
self.toolbar.grid(column = 1, row = 1, sticky = "S, E, W")
285290
self.toolbar_frame.grid(column = 1, row = 3, sticky = "S, E, W")
291+
292+
#resizing
286293
self.toolbar_frame.grid_columnconfigure(1, weight = 1)
287294
self.toolbar_frame.grid_rowconfigure(1, weight = 1)
295+
288296
#disable part of the coordinate display functionality, else everything flickers
289297
#ax.format_coord = lambda x, y: ''
290298

@@ -352,7 +360,7 @@ def main(obs_sequence):
352360

353361
root = Tk()
354362
root.title("2D Observation Plotter")
355-
widg = GUI_2D_obs_initial(root, 0, 0, obs_sequence)
363+
widg = GUI2DObs(root, 0, 0, obs_sequence)
356364
#widg.plot_2D()
357365
root.style = ttk.Style()
358366
root.style.theme_use('clam')

nCDF_initial_GUI/GUI_3D_obs_initial.py

+12-6
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
import itertools
2727

2828

29-
class GUI_3D_obs_initial:
29+
class GUI3DObs:
3030

3131
'''
3232
@@ -56,7 +56,9 @@ def __init__(self, window, grid_col, grid_row, obs_sequence):
5656

5757
#a mainframe
5858
self.main_frame = ttk.Frame(self.window, padding = "8")
59-
self.main_frame.grid(column = grid_col, row = grid_row, sticky = "N, S, E, W")
59+
self.main_frame.grid(column = grid_col, row = grid_row, sticky = "N, S, E, W")
60+
61+
#resizing
6062
self.main_frame.grid_columnconfigure(0, weight = 1) #weights for whole grid
6163
self.main_frame.grid_rowconfigure(0, weight = 1) #weights for whole grid
6264
self.main_frame.grid_columnconfigure(1, weight = 20)
@@ -105,13 +107,12 @@ def __init__(self, window, grid_col, grid_row, obs_sequence):
105107
self.obs_menu.configure(yscrollcommand = self.obs_bar.set)
106108
self.obs_bar.grid(column = 2, row = 2, rowspan = 2, sticky = "N, S, W")
107109

110+
#resizing
108111
self.obs_frame.grid_columnconfigure(1, weight = 1)
109112
self.obs_frame.grid_columnconfigure(2, weight = 1)
110113
self.obs_frame.grid_rowconfigure(1, weight = 1)
111114
self.obs_frame.grid_rowconfigure(2, weight = 1)
112115

113-
114-
115116
#time selection
116117
self.times = StringVar()
117118

@@ -126,7 +127,8 @@ def __init__(self, window, grid_col, grid_row, obs_sequence):
126127
self.times_bar = ttk.Scrollbar(self.times_frame, orient = VERTICAL, command = self.times_menu.yview)
127128
self.times_menu.configure(yscrollcommand = self.times_bar.set)
128129
self.times_bar.grid(column = 2, row = 2, rowspan = 2, sticky = "N, S, W")
129-
130+
131+
#resizing
130132
self.times_frame.grid_columnconfigure(1, weight = 1)
131133
self.times_frame.grid_columnconfigure(2, weight = 1)
132134
self.times_frame.grid_rowconfigure(1, weight = 1)
@@ -148,6 +150,7 @@ def __init__(self, window, grid_col, grid_row, obs_sequence):
148150
self.qc_menu.configure(xscrollcommand = self.qc_bar.set)
149151
self.qc_bar.grid(column = 1, row = 3, rowspan = 1, sticky ="N, S, E, W")
150152

153+
#resizing
151154
self.qc_frame.grid_rowconfigure(1, weight = 1)
152155
self.qc_frame.grid_rowconfigure(2, weight = 1)
153156
self.qc_frame.grid_rowconfigure(3, weight = 1)
@@ -208,6 +211,7 @@ def __init__(self, window, grid_col, grid_row, obs_sequence):
208211
value = "Observation value")
209212
self.val_button.grid(column = 1, row = 3, sticky = "N, S, E, W")
210213

214+
#resizing
211215
self.fill_frame.rowconfigure(1, weight = 1)
212216
self.fill_frame.rowconfigure(2, weight = 1)
213217
self.fill_frame.rowconfigure(3, weight = 1)
@@ -312,8 +316,10 @@ def plot_3D(self, event = None):
312316
self.toolbar = NavigationToolbar2TkAgg(canvas, self.toolbar_frame)
313317
self.toolbar_frame.grid(column = 1, row = 5, sticky = "N, S, E, W")
314318
self.toolbar.grid(column = 1, row = 1, sticky = "N, S, E, W")
319+
#resizing
315320
self.toolbar_frame.grid_columnconfigure(1, weight = 1)
316321
self.toolbar_frame.grid_rowconfigure(1, weight = 1)
322+
317323
#disable part of the coordinate display functionality, else everything flickers (may need for smaller window)
318324
#ax.format_coord = lambda x, y: ''
319325

@@ -415,7 +421,7 @@ def main(obs_sequence):
415421

416422
root = Tk()
417423
root.title("3D Observation Plotter")
418-
widg = GUI_3D_obs_initial(root, 0, 0, obs_sequence)
424+
widg = GUI3DObs(root, 0, 0, obs_sequence)
419425
widg.plot_3D()
420426
root.style = ttk.Style()
421427
root.style.theme_use('clam')

obs_diag_work/GUI_obs_diag_initial.py

+14-5
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
np.set_printoptions(threshold = np.nan) #without this setting, self.levels will be incomplete
1717

1818

19-
class GUIObsDiagInitial:
19+
class GUIObsDiag:
2020

2121
'''
2222
@@ -40,17 +40,21 @@ def __init__(self, window, grid_col, grid_row, diag):
4040
self.original_data = self.reader.full_data
4141

4242
self.window = window
43+
44+
#resizing
4345
self.window.grid_columnconfigure(0, weight = 1)
4446
self.window.grid_rowconfigure(0, weight = 1)
4547

4648
#a mainframe
4749
self.main_frame = ttk.Frame(self.window, padding = "8")
48-
self.main_frame.grid(column = grid_col, row = grid_row, sticky = "N, S, E, W")
50+
self.main_frame.grid(column = grid_col, row = grid_row, sticky = "N, S, E, W")
51+
52+
#resizing
4953
self.main_frame.grid_columnconfigure(0, weight = 1) #weights for whole grid
5054
self.main_frame.grid_rowconfigure(0, weight = 1) #weights for whole grid
5155
self.main_frame.grid_columnconfigure(1, weight = 20)
5256
self.main_frame.grid_columnconfigure(2, weight = 1)
53-
self.main_frame.grid_rowconfigure(1, weight = 1) #weights for whole grid
57+
self.main_frame.grid_rowconfigure(1, weight = 1)
5458
self.main_frame.grid_rowconfigure(2, weight = 1)
5559
self.main_frame.grid_rowconfigure(3, weight = 1)
5660
self.main_frame.grid_rowconfigure(4, weight = 1)
@@ -104,7 +108,7 @@ def __init__(self, window, grid_col, grid_row, diag):
104108
self.obs_menu.configure(yscrollcommand = self.obs_bar.set)
105109
self.obs_bar.grid(column = 2, row = 2, rowspan = 2, sticky = "N, S, W")
106110

107-
111+
#resizing
108112
self.obs_frame.grid_columnconfigure(1, weight = 1)
109113
self.obs_frame.grid_columnconfigure(2, weight = 1)
110114
self.obs_frame.grid_rowconfigure(1, weight = 1)
@@ -130,6 +134,7 @@ def __init__(self, window, grid_col, grid_row, diag):
130134
self.level_menu.configure(yscrollcommand = self.level_bar.set)
131135
self.level_bar.grid(column = 2, row = 2, rowspan = 2, sticky = "N, S, W")
132136

137+
#resizing
133138
self.level_frame.grid_columnconfigure(1, weight = 1)
134139
self.level_frame.grid_columnconfigure(2, weight = 1)
135140
self.level_frame.grid_rowconfigure(1, weight = 1)
@@ -152,6 +157,7 @@ def __init__(self, window, grid_col, grid_row, diag):
152157
self.region_menu.configure(yscrollcommand = self.region_bar.set)
153158
self.region_bar.grid(column = 2, row = 2, rowspan = 2, sticky = "N, S, E, W")
154159

160+
#resizing
155161
self.region_frame.grid_rowconfigure(1, weight = 1)
156162
self.region_frame.grid_rowconfigure(2, weight = 1)
157163
self.region_frame.grid_columnconfigure(1, weight = 1)
@@ -271,8 +277,11 @@ def plot(self, event = None):
271277
self.toolbar = NavigationToolbar2TkAgg(canvas, self.toolbar_frame)
272278
self.toolbar_frame.grid(column = 1, row = 5, sticky = "N, S, E, W")
273279
self.toolbar.grid(column = 1, row = 1, sticky = "N, S, E, W")
280+
281+
#resizing
274282
self.toolbar_frame.grid_columnconfigure(1, weight = 1)
275283
self.toolbar_frame.grid_rowconfigure(1, weight = 1)
284+
276285
#get rid of nan values by getting masks of only valid values, then indexing into them during plotting
277286

278287
forecast_mask = np.array(list(filter(lambda v: v == v, forecast_region.values)))
@@ -372,7 +381,7 @@ def main(diag):
372381

373382
root = Tk()
374383
root.title("RMSE Time Evolution Plotter")
375-
widg = GUIObsDiagInitial(root, 0, 0, diag)
384+
widg = GUIObsDiag(root, 0, 0, diag)
376385
root.mainloop()
377386

378387
if __name__ == '__main__':

vert_prof_work/GUI_vert_prof_initial.py

+9-2
Original file line numberDiff line numberDiff line change
@@ -38,17 +38,21 @@ def __init__(self, window, grid_col, grid_row, diag):
3838
self.original_data = self.reader.full_data
3939

4040
self.window = window
41+
42+
#resizing
4143
self.window.grid_columnconfigure(0, weight = 1)
4244
self.window.grid_rowconfigure(0, weight = 1)
4345

4446
#a mainframe
4547
self.main_frame = ttk.Frame(self.window, padding = "8")
46-
self.main_frame.grid(column = grid_col, row = grid_row, sticky = "N, S, E, W")
48+
self.main_frame.grid(column = grid_col, row = grid_row, sticky = "N, S, E, W")
49+
50+
#resizing
4751
self.main_frame.grid_columnconfigure(0, weight = 1) #weights for whole grid
4852
self.main_frame.grid_rowconfigure(0, weight = 1) #weights for whole grid
4953
self.main_frame.grid_columnconfigure(1, weight = 20)
5054
self.main_frame.grid_columnconfigure(2, weight = 1)
51-
self.main_frame.grid_rowconfigure(1, weight = 1) #weights for whole grid
55+
self.main_frame.grid_rowconfigure(1, weight = 1)
5256
self.main_frame.grid_rowconfigure(2, weight = 1)
5357
self.main_frame.grid_rowconfigure(3, weight = 1)
5458
self.main_frame.grid_rowconfigure(4, weight = 1)
@@ -107,6 +111,7 @@ def __init__(self, window, grid_col, grid_row, diag):
107111
self.obs_menu.selection_set(0)
108112
self.obs_menu.event_generate('<<ListboxSelect>>')
109113

114+
#resizing
110115
self.obs_frame.grid_columnconfigure(1, weight = 1)
111116
self.obs_frame.grid_columnconfigure(2, weight = 1)
112117
self.obs_frame.grid_rowconfigure(1, weight = 1)
@@ -130,6 +135,7 @@ def __init__(self, window, grid_col, grid_row, diag):
130135
self.region_menu.selection_set(0)
131136
self.region_menu.bind('<Return>', self.plot)
132137

138+
#resizing
133139
self.region_frame.grid_columnconfigure(1, weight = 1)
134140
self.region_frame.grid_columnconfigure(2, weight = 1)
135141
self.region_frame.grid_rowconfigure(1, weight = 1)
@@ -193,6 +199,7 @@ def plot(self, event = None):
193199
self.toolbar_frame.grid(column = 1, row = 5, sticky = "N, S, E, W")
194200
self.toolbar.grid(column = 1, row = 1, sticky = "N, S ,E , W")
195201

202+
#resizing
196203
self.toolbar_frame.grid_columnconfigure(1, weight = 1)
197204
self.toolbar_frame.grid_rowconfigure(1, weight = 1)
198205

0 commit comments

Comments
 (0)