Exemplo n.º 1
0
    def draw_vrot(self, qp):
        qp.begin(self.plotBitMap)
        qp.setRenderHint(qp.Antialiasing)
        qp.setRenderHint(qp.TextAntialiasing)
        vrot_pix = self.vrot_to_pix(self.vrot)
        # plot the white dashed line
        pen = QtGui.QPen(self.fg_color, 1.5, QtCore.Qt.DotLine)
        qp.setPen(pen)
        qp.drawLine(vrot_pix, self.prob_to_pix(0), vrot_pix, self.prob_to_pix(70))
        
        # Draw the probabilties.
        color = QtGui.QColor(self.EF01_color)
        pen = QtGui.QPen(color, 1, QtCore.Qt.SolidLine)
        qp.setPen(pen)
        rect = QtCore.QRectF(self.vrot_to_pix(self.vrot-7), self.prob_to_pix(self.probef01), 4, 7)
        qp.drawText(rect, QtCore.Qt.TextDontClip | QtCore.Qt.AlignLeft, utils.INT2STR(self.probef01))

        color = QtGui.QColor(self.EF23_color)
        pen = QtGui.QPen(color, 1, QtCore.Qt.SolidLine)
        qp.setPen(pen)
        rect = QtCore.QRectF(self.vrot_to_pix(self.vrot), self.prob_to_pix(self.probef23), 4, 7)
        qp.drawText(rect, QtCore.Qt.TextDontClip | QtCore.Qt.AlignLeft, utils.INT2STR(self.probef23))

        color = QtGui.QColor(self.EF45_color)
        pen = QtGui.QPen(color, 1, QtCore.Qt.SolidLine)
        qp.setPen(pen)
        rect = QtCore.QRectF(self.vrot_to_pix(self.vrot), self.prob_to_pix(self.probef45), 4, 7)
        qp.drawText(rect, QtCore.Qt.TextDontClip | QtCore.Qt.AlignLeft, utils.INT2STR(self.probef45))
        qp.end()
Exemplo n.º 2
0
 def draw_thetae(self, t, qp):
     '''
     Draw background Theta-E ticks.
     
     Parameters
     ----------
     t: Theta-E in degrees Kelvin
     qp: QtGui.QPainter object
     
     '''
     ## set a new pen with a white color, thickness one, solid line
     pen = QtGui.QPen(self.fg_color, 1, QtCore.Qt.SolidLine)
     qp.setPen(pen)
     qp.setFont(self.label_font)
     ## convert theta-E to pixel values
     x1 = self.theta_to_pix(t)
     ## length of tick to draw
     offset = 5
     ## draw the tick and label it with a value
     qp.drawLine(x1, 0, x1, 0 + offset)
     qp.drawLine(x1, self.bry + self.tpad - offset, x1,
                 self.bry + self.rpad)
     qp.drawText(x1 - 15, self.bry - 22, 30,
                 20, QtCore.Qt.AlignTop | QtCore.Qt.AlignCenter,
                 utils.INT2STR(t))
Exemplo n.º 3
0
 def draw_isobar(self, p, qp):
     '''
     Draw background isobar ticks.
     
     Parameters
     ----------
     p: pressure in hPa or mb
     qp: QtGui.QPainter object
     
     '''
     ## set a new pen with a white color and solid line of thickness 1
     pen = QtGui.QPen(self.fg_color, 1, QtCore.Qt.SolidLine)
     qp.setPen(pen)
     qp.setFont(self.label_font)
     ## convert the pressure to pixel coordinates
     y1 = self.pres_to_pix(p)
     ## length of line to draw
     offset = 5
     ## draw the isobar line and text
     qp.drawLine(self.lpad, y1, self.lpad + offset, y1)
     qp.drawLine(self.brx + self.rpad - offset, y1, self.brx + self.rpad,
                 y1)
     qp.drawText(5, y1 - 20, 30, 40,
                 QtCore.Qt.AlignVCenter | QtCore.Qt.AlignLeft,
                 utils.INT2STR(p))
Exemplo n.º 4
0
 def draw_height(self, h, qp):
     '''
     Draw background height ticks in km.
     
     Parameters
     ----------
     h: height in km
     qp: QtGui.QPainter object
     
     '''
     ## initialize a pen with color white, thickness 1, solid line
     pen = QtGui.QPen(self.fg_color, 1, QtCore.Qt.SolidLine)
     qp.setPen(pen)
     qp.setFont(self.label_font)
     ## convert the height value to pixel coordinates
     y1 = self.hgt_to_pix(h)
     ## length of tick to be drawn
     offset = 5
     ## draw the tick and then label the tick with the value
     qp.drawLine(self.lpad, y1, self.lpad + offset, y1)
     qp.drawLine(self.brx + self.rpad - offset, y1, self.brx + self.rpad,
                 y1)
     qp.drawText(0, y1 - 20, 20, 40,
                 QtCore.Qt.AlignVCenter | QtCore.Qt.AlignRight,
                 utils.INT2STR(h))
Exemplo n.º 5
0
    #### Adding a Parcel Trace
    sfcpcl = params.parcelx(prof, flag=1)  # Surface Parcel
    #fcstpcl = params.parcelx( prof, flag=2 ) # Forecast Parcel
    mupcl = params.parcelx(prof, flag=3)  # Most-Unstable Parcel
    mlpcl = params.parcelx(prof, flag=4)  # 100 mb Mean Layer Parcel
    # Set the parcel trace to be plotted as the Most-Unstable parcel.
    pcl = mupcl

    # Temperature, dewpoint, virtual temperature, wetbulb, parcel profiles
    temperature_trace, = skew.plot(prof.pres, prof.tmpc, 'r',
                                   linewidth=2)  # temperature profile
    # annotate temperature in F at bottom of T profile
    temperatureF = skew.ax.text(prof.tmpc[0],
                                prof.pres[0] + 10,
                                utils.INT2STR(thermo.ctof(prof.tmpc[0])),
                                verticalalignment='top',
                                horizontalalignment='center',
                                size=7,
                                color=temperature_trace.get_color())
    vtemp_trace, = skew.plot(prof.pres, prof.vtmp, 'r',
                             linewidth=0.5)  # Virtual temperature profile
    wetbulb_trace, = skew.plot(prof.pres, prof.wetbulb,
                               'c-')  # wetbulb profile
    dewpoint_trace, = skew.plot(prof.pres, prof.dwpc, 'g',
                                linewidth=2)  # dewpoint profile
    # annotate dewpoint in F at bottom of dewpoint profile
    dewpointF = skew.ax.text(prof.dwpc[0],
                             prof.pres[0] + 10,
                             utils.INT2STR(thermo.ctof(prof.dwpc[0])),
                             verticalalignment='top',