Пример #1
0
 def mousePressEvent(self, e):
     pos = e.pos()
     ## is this a supercell match?
     if pos.x() < (self.brx / 2.):
         ## loop over supercells
         for i, bound in enumerate(self.ybounds_sup):
             if bound[0] < pos.y() and bound[1] > pos.y():
                 filematch = sars.getSounding(self.sup_matches[0][i],
                                              "supercell")
                 self.updatematch.emit(filematch)
                 ## set the rectangle used for showing
                 ## a selected match
                 self.selectRect = QtCore.QRect(
                     0, self.ybounds_sup[i, 0], self.brx / 2.,
                     self.ybounds_sup[i, 1] - self.ybounds_sup[i, 0])
                 break
     ## is this a hail match?
     elif pos.x() > (self.brx / 2.):
         ## loop over hail
         for i, bound in enumerate(self.ybounds_hail):
             if bound[0] < pos.y() and bound[1] > pos.y():
                 filematch = sars.getSounding(self.hail_matches[0][i],
                                              "hail")
                 self.updatematch.emit(filematch)
                 ## set the rectangle used for showing
                 ## a selected match
                 self.selectRect = QtCore.QRect(
                     self.brx / 2., self.ybounds_hail[i, 0], self.brx / 2.,
                     self.ybounds_hail[i, 1] - self.ybounds_hail[i, 0])
                 break
     self.clearData()
     self.plotBackground()
     self.plotData()
     self.update()
     self.parentWidget().setFocus()
Пример #2
0
    def setSelection(self, filematch):
        """
            Load in the SARS analog you've clicked.
        """
        match_name = os.path.basename(filematch)
#        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 hail_matches:
            idx = np.where(np.asarray(hail_matches, dtype=str) == match_name)[0][0]
            lbx = self.brx / 2.
            ybounds = self.ybounds_hail

        self.selectRect = QtCore.QRect(lbx, ybounds[idx, 0],
                        self.brx / 2., ybounds[idx, 1] - ybounds[idx, 0])
        self.clearData()
        self.plotBackground()
        self.plotData()
        self.update()
        self.parentWidget().setFocus()
Пример #3
0
 def mousePressEvent(self, e):
     pos = e.pos()
     ## is this a supercell match?
     if pos.x() < (self.brx / 2.):
         ## loop over supercells
         for i, bound in enumerate(self.ybounds_sup):
             if bound[0] < pos.y() and bound[1] > pos.y():
                 filematch = sars.getSounding(self.sup_matches[0][i], "supercell")
                 self.updatematch.emit(filematch)
                 ## set the rectangle used for showing
                 ## a selected match
                 self.selectRect = QtCore.QRect(0, self.ybounds_sup[i, 0],
                                 self.brx / 2.,
                                 self.ybounds_sup[i, 1] - self.ybounds_sup[i, 0])
                 break
     ## is this a hail match?
     elif pos.x() > (self.brx / 2.):
         ## loop over hail
         for i, bound in enumerate(self.ybounds_hail):
             if bound[0] < pos.y() and bound[1] > pos.y():
                 filematch = sars.getSounding(self.hail_matches[0][i], "hail")
                 self.updatematch.emit(filematch)
                 ## set the rectangle used for showing
                 ## a selected match
                 self.selectRect = QtCore.QRect(self.brx / 2., self.ybounds_hail[i, 0],
                                 self.brx / 2.,
                                 self.ybounds_hail[i, 1] - self.ybounds_hail[i, 0])
                 break
     self.clearData()
     self.plotBackground()
     self.plotData()
     self.update()
     self.parentWidget().setFocus()
Пример #4
0
def get_profile(fname, sars_type):
    # Create a convective profile object
    # fname - filename/SARS sounding string to load in
    # sars_type - string showing what SARS database (hail/supercell) to look for the raw file
    # Load in the data
    try:
        sars_fname = sars.getSounding(fname[0].decode('utf-8'), sars_type)
    except:
        print("Unable to find data file for:", fname[0])
        return None
    dec = SPCDecoder(sars_fname)
    profs = dec.getProfiles()
    prof = profs._profs[''][0]
    dates = profs._dates
    prof.strictQC = True
    try:
        new_prof = tab.profile.ConvectiveProfile.copy(prof)
    except Exception as e:
        print(
            "There was a problem with the generation of the ConvectiveProfile:",
            str(e))
        return None

    return new_prof