Skip to content

Commit

Permalink
Bug fix for advanceTime and SARS analogs
Browse files Browse the repository at this point in the history
  • Loading branch information
Greg Blumberg committed Jan 9, 2019
1 parent 715c1f1 commit 1ea4d9f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 13 deletions.
3 changes: 0 additions & 3 deletions sharppy/viz/SPCWindow.py
Original file line number Diff line number Diff line change
Expand Up @@ -616,7 +616,6 @@ def advanceTime(self, direction):
if prof_col.hasMeta('analogfile'):
match = prof_col.getMeta('analogfile')
dt = prof_col.getCurrentDate()
print("\n\nIN IF:", dt, match)
if dt in match:
self.insets['SARS'].setSelection(match[dt])
else:
Expand Down Expand Up @@ -644,7 +643,6 @@ def swapProfCollections(self):
if self.prof_collections[self.pc_idx].hasMeta('analogfile'):
match = self.prof_collections[self.pc_idx].getMeta('analogfile')
dt = prof_col.getCurrentDate()
print(dt, match)
if dt in match:
self.insets['SARS'].setSelection(match[dt])
else:
Expand Down Expand Up @@ -754,7 +752,6 @@ class SPCWindow(QMainWindow):
def __init__(self, **kwargs):
parent = kwargs.get('parent', None)
super(SPCWindow, self).__init__(parent=parent)
print("SPCWINDOW PARENT:", parent)
logging.debug("Initialize SPCWindow...")
self.menu_items = []
self.picker_window = parent
Expand Down
19 changes: 9 additions & 10 deletions sharppy/viz/analogues.py
Original file line number Diff line number Diff line change
Expand Up @@ -468,10 +468,6 @@ def drawSARS(self, qp, **kwargs):
self.ylast = self.tpad

def mousePressEvent(self, e):
try:
print("PARENT1:", self.parentWidget())
except:
print("Parent widget print failed")
if self.prof is None or (len(self.sup_matches[0]) == 0 and len(self.hail_matches[0]) == 0):
return

Expand Down Expand Up @@ -508,7 +504,6 @@ def mousePressEvent(self, e):
self.plotBackground()
self.plotData()
self.update()
print("PARENT2:", self.parentWidget())
#logging.debug("Calling plotAnaloges.parentWidget().setFocus()")
self.parentWidget().setFocus()

Expand All @@ -517,13 +512,16 @@ def setSelection(self, filematch):
Load in the SARS analog you've clicked.
"""
match_name = os.path.basename(filematch)
print("\n\nSETSELECION:", match_name, filematch)
if match_name in self.sup_matches[0]:
idx = np.where(self.sup_matches[0] == match_name)[0][0]
# print("\n\nSETSELECION:", match_name, filematch, self.sup_matches[0], self.hail_matches[0])
sup_matches = [sars.getSounding(f, 'supercell').split('/')[-1] for f in self.sup_matches[0]]
hail_matches = [sars.getSounding(f, 'hail').split('/')[-1] for f in self.hail_matches[0]]
# print(sup_matches, hail_matches)
if match_name in sup_matches:
idx = np.where(np.asarray(sup_matches, dtype=str) == match_name)[0][0]
lbx = 0.
ybounds = self.ybounds_sup
if match_name in self.hail_matches[0]:
idx = np.where(self.hail_matches[0] == match_name)[0][0]
if match_name in hail_matches:
idx = np.where(np.asarray(hail_matches, dtype=str) == match_name)[0][0]
lbx = self.brx / 2.
ybounds = self.ybounds_hail

Expand All @@ -533,6 +531,7 @@ def setSelection(self, filematch):
self.plotBackground()
self.plotData()
self.update()
self.parentWidget().setFocus()

def clearSelection(self):
self.selectRect = None
Expand Down

0 comments on commit 1ea4d9f

Please sign in to comment.