Beispiel #1
0
def calc_hodograph_stats(_z, _u, _v):

  ucb = dyn.storm_motion_bunkers(_u,_v,_z)

  # SRH
  srh01 = dyn.srh(_u, _v, _z, 0., 1000., ucb[0], ucb[1])
  srh03 = dyn.srh(_u, _v, _z, 0., 3000., ucb[0], ucb[1])
  erh01 = dyn.srh(_u, _v, _z, 0., 1000., 0., 0.)
  erh03 = dyn.srh(_u, _v, _z, 0., 3000., 0., 0.)
 
  shear01 = dyn.uv_to_deg(*dyn.shear(_u, _v, _z, 0., 1000.))
  shear03 = dyn.uv_to_deg(*dyn.shear(_u, _v, _z, 0., 3000.))
  shear06 = dyn.uv_to_deg(*dyn.shear(_u, _v, _z, 0., 6000.))
  shear12 = dyn.uv_to_deg(*dyn.shear(_u, _v, _z, 1000., 2000.))
  shear23 = dyn.uv_to_deg(*dyn.shear(_u, _v, _z, 2000., 3000.))
  shear34 = dyn.uv_to_deg(*dyn.shear(_u, _v, _z, 3000., 4000.))
  shear45 = dyn.uv_to_deg(*dyn.shear(_u, _v, _z, 4000., 5000.))
  shear56 = dyn.uv_to_deg(*dyn.shear(_u, _v, _z, 5000., 6000.))

  dict = { 'bunkers' : ucb,
           'srh01'   : srh01,
           'srh03'   : srh03,
           'erh01'   : erh01,
           'erh03'   : erh03,
           's01'     : shear01,
           's03'     : shear03,
           's06'     : shear06,
           's12'     : shear12,
           's23'     : shear23,
           's34'     : shear34,
           's45'     : shear45,
           's56'     : shear56
         }

  return dict
Beispiel #2
0
  def calcStats(self):
    self.statsBox.clear()
    if (self.SStats == 0):
      self.statsBox.append("No Sounding Plotted")  
    else:
      pcl, mupcl, mlpcl = skewt.calc_sounding_stats(self.z, self.th, self.p, self.qv)
      self.statsBox.append("Var\t\tSFC\tML\tMU")
      self.statsBox.append("CAPE\tJ/kg\t{0:.0f}\t{1:.0f}\t{2:.0f}".format(pcl['cape'],mlpcl['cape'],mupcl['cape']))
      self.statsBox.append("CIN\tJ/kg\t{0:.1f}\t{1:.1f}\t{2:.1f}".format(pcl['cin'],mlpcl['cin'],mupcl['cin']))
      self.statsBox.append("LI_max\t\t{0:.1f}\t{1:.1f}\t{2:.1f}".format(pcl['max_li'],mlpcl['max_li'],mupcl['max_li']))
      self.statsBox.append("LI_500\t\t{0:.1f}\t{1:.1f}\t{2:.1f}".format(pcl['li500'],mlpcl['li500'],mupcl['li500']))
      self.statsBox.append("LI_300\t\t{0:.1f}\t{1:.1f}\t{2:.1f}".format(pcl['li300'],mlpcl['li300'],mupcl['li300']))
      self.statsBox.append("TOPS\tm\t{0:.0f}\t{1:.0f}\t{2:.0f}".format(pcl['ztops'],mlpcl['ztops'],mupcl['ztops']))

      self.statsBox.append("LCL\tmb (m)\t{0:.0f} ({1:.0f})\t{2:.0f} ({3:.0f})\t{4:.0f} ({5:.0f})".format(pcl['lclprs']/100.,pcl['lcl'],mlpcl['lclprs']/100.,mlpcl['lcl'],mupcl['lclprs']/100.,mupcl['lcl']))
      self.statsBox.append("LCL\tmb (m)\t{0:.0f} ({1:.0f})\t{2:.0f} ({3:.0f})\t{4:.0f} ({5:.0f})".format(pcl['lfcprs']/100.,pcl['lfc'],mlpcl['lfcprs']/100.,mlpcl['lfc'],mupcl['lfcprs']/100.,mupcl['lfc']))

      self.statsBox.append("PRS\tmb\t{0:.0f}\t{1:.0f}\t{2:.0f}".format(pcl['prs']/100.,mlpcl['prs']/100.,mupcl['prs']/100.))
      self.statsBox.append("")
      shear = skewt.calc_hodograph_stats(self.z, self.u, self.v)
      cth,cr = dynamics.uv_to_deg(shear['bunkers'][0],shear['bunkers'][1])
      self.statsBox.append("Storm motion (left mover): {0:.0f} deg {1:5.2f} m/s".format(cth,cr))
      self.statsBox.append("Storm motion (left mover): u={0:5.2f} v={1:5.2f} m/s".format(shear['bunkers'][0],shear['bunkers'][1]))
      self.statsBox.append("")
      self.statsBox.append("Layer\tSRH\tERH")
      self.statsBox.append("0-1 km\t{0:.0f}\t{1:.0f}".format(shear['srh01'],shear['erh01']))
      self.statsBox.append("0-3 km\t{0:.0f}\t{1:.0f}".format(shear['srh03'],shear['erh03']))
      self.statsBox.append("")
      self.statsBox.append("Layer\tShear Vector")
      self.statsBox.append("0-1 km\t{0:.0f} deg, {1:5.2f} m/s".format(*shear['s01']))
      self.statsBox.append("0-3 km\t{0:.0f} deg, {1:5.2f} m/s".format(*shear['s03']))
      self.statsBox.append("0-6 km\t{0:.0f} deg, {1:5.2f} m/s".format(*shear['s06']))

      self.statsdone.emit()
Beispiel #3
0
def calc_hodograph_stats(_z, _u, _v):

    try:
        ucb = dyn.storm_motion_bunkers(_u, _v, _z)

        # SRH
        srh01 = dyn.srh(_u, _v, _z, 0., 1000., ucb[0], ucb[1])
        srh03 = dyn.srh(_u, _v, _z, 0., 3000., ucb[0], ucb[1])

    except:
        print("Error calculating storm motion")
        ucb = [0., 0., 0., 0.]
        srh01 = 0.
        srh03 = 0.

    try:
        erh01 = dyn.srh(_u, _v, _z, 0., 1000., 0., 0.)
        erh03 = dyn.srh(_u, _v, _z, 0., 3000., 0., 0.)

    except:
        print("Error calculating erh")
        erh01 = 0.
        erh03 = 0.

    shear01 = dyn.uv_to_deg(*dyn.shear(_u, _v, _z, 0., 1000.))
    shear03 = dyn.uv_to_deg(*dyn.shear(_u, _v, _z, 0., 3000.))
    shear06 = dyn.uv_to_deg(*dyn.shear(_u, _v, _z, 0., 6000.))
    shear12 = dyn.uv_to_deg(*dyn.shear(_u, _v, _z, 1000., 2000.))
    shear23 = dyn.uv_to_deg(*dyn.shear(_u, _v, _z, 2000., 3000.))
    shear34 = dyn.uv_to_deg(*dyn.shear(_u, _v, _z, 3000., 4000.))
    shear45 = dyn.uv_to_deg(*dyn.shear(_u, _v, _z, 4000., 5000.))
    shear56 = dyn.uv_to_deg(*dyn.shear(_u, _v, _z, 5000., 6000.))

    dict = {
        'bunkers': ucb,
        'srh01': srh01,
        'srh03': srh03,
        'erh01': erh01,
        'erh03': erh03,
        's01': shear01,
        's03': shear03,
        's06': shear06,
        's12': shear12,
        's23': shear23,
        's34': shear34,
        's45': shear45,
        's56': shear56
    }

    return dict
Beispiel #4
0
def calc_hodograph_stats(_z, _u, _v):

    ucb = dyn.storm_motion_bunkers(_u, _v, _z)

    # SRH
    srh01 = dyn.srh(_u, _v, _z, 0., 1000., ucb[0], ucb[1])
    srh03 = dyn.srh(_u, _v, _z, 0., 3000., ucb[0], ucb[1])
    erh01 = dyn.srh(_u, _v, _z, 0., 1000., 0., 0.)
    erh03 = dyn.srh(_u, _v, _z, 0., 3000., 0., 0.)

    shear01 = dyn.uv_to_deg(*dyn.shear(_u, _v, _z, 0., 1000.))
    shear03 = dyn.uv_to_deg(*dyn.shear(_u, _v, _z, 0., 3000.))
    shear06 = dyn.uv_to_deg(*dyn.shear(_u, _v, _z, 0., 6000.))
    shear12 = dyn.uv_to_deg(*dyn.shear(_u, _v, _z, 1000., 2000.))
    shear23 = dyn.uv_to_deg(*dyn.shear(_u, _v, _z, 2000., 3000.))
    shear34 = dyn.uv_to_deg(*dyn.shear(_u, _v, _z, 3000., 4000.))
    shear45 = dyn.uv_to_deg(*dyn.shear(_u, _v, _z, 4000., 5000.))
    shear56 = dyn.uv_to_deg(*dyn.shear(_u, _v, _z, 5000., 6000.))

    dict = {
        'bunkers': ucb,
        'srh01': srh01,
        'srh03': srh03,
        'erh01': erh01,
        'erh03': erh03,
        's01': shear01,
        's03': shear03,
        's06': shear06,
        's12': shear12,
        's23': shear23,
        's34': shear34,
        's45': shear45,
        's56': shear56
    }

    return dict
Beispiel #5
0
def plot_datablock(ax4, _x, _z, _t, _th, _p, _qv, _u, _v, _title):
    pcl, mupcl, mlpcl = calc_sounding_stats(_z, _th, _p, _qv)
    shear = calc_hodograph_stats(_z, _u, _v)

    brn = dyn.brn(_u, _v, _z, pcl['cape'])

    # draw datablock
    ax4.set_axis_off()
    plt.axis([-1, 1, -1, 1])
    plt.text(0,
             1,
             _title,
             verticalalignment='top',
             horizontalalignment='center',
             weight='bold',
             fontsize=10 * fontscalefactor)
    line = ""
    if (_x != None):
        line += "Sounding at location " + str(_x) + "."
    if (_t != None):
        line += " Time = " + str(_t) + "."
    line += " " + str(len(_z)) + ' vertical levels'
    plt.text(0,
             .85,
             line,
             verticalalignment='center',
             horizontalalignment='center',
             fontsize=5 * fontscalefactor)

    cth, cr = dyn.uv_to_deg(shear['bunkers'][0], shear['bunkers'][1])
    line = 'Estimated storm motion (supercell right mover) -> {0:3d}$^\circ$ {1:3.1f} m/s'.format(
        int(cth), cr)
    plt.text(-1,
             .75,
             line,
             verticalalignment='center',
             horizontalalignment='left',
             fontsize=5 * fontscalefactor)

    print_parcel_info('Surface Parcel', pcl, -1., .65)
    print_parcel_info('Most Unstable Parcel', mupcl, -0.3, .65)
    print_parcel_info('500 m Mixed Layer Parcel', mlpcl, 0.4, .65)

    # LCL, CCL, EL, convective temp?
    # other data?

    x = 0.4
    y = 0
    line = 'Hodograph'
    plt.text(x,
             y,
             line,
             verticalalignment='center',
             horizontalalignment='left',
             fontsize=5 * fontscalefactor)
    x += 0.02
    y -= 0.065
    line = '0-1 km shear {0:3d}$^\circ$ {1:3.1f} m/s'.format(
        int(shear['s01'][0]), shear['s01'][1])
    plt.text(x,
             y,
             line,
             verticalalignment='center',
             horizontalalignment='left',
             fontsize=5 * fontscalefactor)
    y -= 0.06
    line = '0-3 km shear {0:3d}$^\circ$ {1:3.1f} m/s'.format(
        int(shear['s03'][0]), shear['s03'][1])
    plt.text(x,
             y,
             line,
             verticalalignment='center',
             horizontalalignment='left',
             fontsize=5 * fontscalefactor)
    y -= 0.06
    line = '0-6 km shear {0:3d}$^\circ$ {1:3.1f} m/s'.format(
        int(shear['s06'][0]), shear['s06'][1])
    plt.text(x,
             y,
             line,
             verticalalignment='center',
             horizontalalignment='left',
             fontsize=5 * fontscalefactor)
    y -= 0.06
    line = 'SRH 0-1 : {0:d} m2/s2'.format(int(shear['srh01']))
    plt.text(x,
             y,
             line,
             verticalalignment='center',
             horizontalalignment='left',
             fontsize=5 * fontscalefactor)
    y -= 0.06
    line = 'SRH 0-3 : {0:d} m2/s2'.format(int(shear['srh03']))
    plt.text(x,
             y,
             line,
             verticalalignment='center',
             horizontalalignment='left',
             fontsize=5 * fontscalefactor)
    y -= 0.06
    line = 'ERH 0-1 : {0:d} m2/s2'.format(int(shear['erh01']))
    plt.text(x,
             y,
             line,
             verticalalignment='center',
             horizontalalignment='left',
             fontsize=5 * fontscalefactor)
    y -= 0.06
    line = 'ERH 0-3 : {0:d} m2/s2'.format(int(shear['erh03']))
    plt.text(x,
             y,
             line,
             verticalalignment='center',
             horizontalalignment='left',
             fontsize=5 * fontscalefactor)
    y -= 0.06
    line = 'BRN : {0:d}'.format(int(brn))
    plt.text(x,
             y,
             line,
             verticalalignment='center',
             horizontalalignment='left',
             fontsize=5 * fontscalefactor)
    y -= 0.06
    line = '0-1 km shear {0:3d}$^\circ$ {1:3.1f} m/s'.format(
        int(shear['s01'][0]), shear['s01'][1])
    plt.text(x,
             y,
             line,
             verticalalignment='center',
             horizontalalignment='left',
             fontsize=5 * fontscalefactor)
    y -= 0.06
    line = '1-2 km shear {0:3d}$^\circ$ {1:3.1f} m/s'.format(
        int(shear['s12'][0]), shear['s12'][1])
    plt.text(x,
             y,
             line,
             verticalalignment='center',
             horizontalalignment='left',
             fontsize=5 * fontscalefactor)
    y -= 0.06
    line = '2-3 km shear {0:3d}$^\circ$ {1:3.1f} m/s'.format(
        int(shear['s23'][0]), shear['s23'][1])
    plt.text(x,
             y,
             line,
             verticalalignment='center',
             horizontalalignment='left',
             fontsize=5 * fontscalefactor)
    y -= 0.06
    line = '3-4 km shear {0:3d}$^\circ$ {1:3.1f} m/s'.format(
        int(shear['s34'][0]), shear['s34'][1])
    plt.text(x,
             y,
             line,
             verticalalignment='center',
             horizontalalignment='left',
             fontsize=5 * fontscalefactor)
    y -= 0.06
    line = '4-5 km shear {0:3d}$^\circ$ {1:3.1f} m/s'.format(
        int(shear['s45'][0]), shear['s45'][1])
    plt.text(x,
             y,
             line,
             verticalalignment='center',
             horizontalalignment='left',
             fontsize=5 * fontscalefactor)
    y -= 0.06
    line = '5-6 km shear {0:3d}$^\circ$ {1:3.1f} m/s'.format(
        int(shear['s56'][0]), shear['s56'][1])
    plt.text(x,
             y,
             line,
             verticalalignment='center',
             horizontalalignment='left',
             fontsize=5 * fontscalefactor)
Beispiel #6
0
    def calcStats(self):
        self.statsBox.clear()
        if (self.SStats == 0):
            self.statsBox.append("No Sounding Plotted")
        else:
            pcl, mupcl, mlpcl = skewt.calc_sounding_stats(
                self.z, self.th, self.p, self.qv)
            self.statsBox.append("Var\t\tSFC\tML\tMU")
            self.statsBox.append(
                "CAPE\tJ/kg\t{0:.0f}\t{1:.0f}\t{2:.0f}".format(
                    pcl['cape'], mlpcl['cape'], mupcl['cape']))
            self.statsBox.append("CIN\tJ/kg\t{0:.1f}\t{1:.1f}\t{2:.1f}".format(
                pcl['cin'], mlpcl['cin'], mupcl['cin']))
            self.statsBox.append("LI_max\t\t{0:.1f}\t{1:.1f}\t{2:.1f}".format(
                pcl['max_li'], mlpcl['max_li'], mupcl['max_li']))
            self.statsBox.append("LI_500\t\t{0:.1f}\t{1:.1f}\t{2:.1f}".format(
                pcl['li500'], mlpcl['li500'], mupcl['li500']))
            self.statsBox.append("LI_300\t\t{0:.1f}\t{1:.1f}\t{2:.1f}".format(
                pcl['li300'], mlpcl['li300'], mupcl['li300']))
            self.statsBox.append("TOPS\tm\t{0:.0f}\t{1:.0f}\t{2:.0f}".format(
                pcl['ztops'], mlpcl['ztops'], mupcl['ztops']))

            self.statsBox.append(
                "LCL\tmb (m)\t{0:.0f} ({1:.0f})\t{2:.0f} ({3:.0f})\t{4:.0f} ({5:.0f})"
                .format(pcl['lclprs'] / 100., pcl['lcl'],
                        mlpcl['lclprs'] / 100., mlpcl['lcl'],
                        mupcl['lclprs'] / 100., mupcl['lcl']))
            self.statsBox.append(
                "LCL\tmb (m)\t{0:.0f} ({1:.0f})\t{2:.0f} ({3:.0f})\t{4:.0f} ({5:.0f})"
                .format(pcl['lfcprs'] / 100., pcl['lfc'],
                        mlpcl['lfcprs'] / 100., mlpcl['lfc'],
                        mupcl['lfcprs'] / 100., mupcl['lfc']))

            self.statsBox.append("PRS\tmb\t{0:.0f}\t{1:.0f}\t{2:.0f}".format(
                pcl['prs'] / 100., mlpcl['prs'] / 100., mupcl['prs'] / 100.))
            self.statsBox.append("")
            shear = skewt.calc_hodograph_stats(self.z, self.u, self.v)
            cth, cr = dynamics.uv_to_deg(shear['bunkers'][0],
                                         shear['bunkers'][1])
            self.statsBox.append(
                "Storm motion (left mover): {0:.0f} deg {1:5.2f} m/s".format(
                    cth, cr))
            self.statsBox.append(
                "Storm motion (left mover): u={0:5.2f} v={1:5.2f} m/s".format(
                    shear['bunkers'][0], shear['bunkers'][1]))
            self.statsBox.append("")
            self.statsBox.append("Layer\tSRH\tERH")
            self.statsBox.append("0-1 km\t{0:.0f}\t{1:.0f}".format(
                shear['srh01'], shear['erh01']))
            self.statsBox.append("0-3 km\t{0:.0f}\t{1:.0f}".format(
                shear['srh03'], shear['erh03']))
            self.statsBox.append("")
            self.statsBox.append("Layer\tShear Vector")
            self.statsBox.append(
                "0-1 km\t{0:.0f} deg, {1:5.2f} m/s".format(*shear['s01']))
            self.statsBox.append(
                "0-3 km\t{0:.0f} deg, {1:5.2f} m/s".format(*shear['s03']))
            self.statsBox.append(
                "0-6 km\t{0:.0f} deg, {1:5.2f} m/s".format(*shear['s06']))

            self.statsdone.emit()
Beispiel #7
0
def plot_datablock(ax4, _x,_z,_t,_th,_p,_qv,_u,_v, _title):
  pcl, mupcl, mlpcl = calc_sounding_stats(_z, _th, _p, _qv)
  shear = calc_hodograph_stats(_z, _u, _v)

  brn = dyn.brn(_u, _v, _z, pcl['cape'])

  # draw datablock
  ax4.set_axis_off()
  plt.axis([-1,1,-1,1])
  plt.text(0,1,_title, verticalalignment='top', horizontalalignment='center', weight='bold', fontsize=10)
  line = ""
  if (_x != None):
    line += "Sounding at location " + str(_x) + "."
  if (_t != None):
    line += " Time = " + str(_t) + "."
  line += " " + str(len(_z)) + ' vertical levels'
  plt.text(0,.85, line, verticalalignment='center', horizontalalignment='center', fontsize=5)

  cth,cr = dyn.uv_to_deg(shear['bunkers'][0],shear['bunkers'][1])
  line = 'Estimated storm motion (supercell right mover) -> {0:3d}$^\circ$ {1:3.1f} m/s'.format(int(cth),cr)
  plt.text(-1,.75, line, verticalalignment='center', horizontalalignment='left', fontsize=5)

  print_parcel_info('Surface Parcel', pcl, -1., .65)
  print_parcel_info('Most Unstable Parcel', mupcl, -0.3, .65)
  print_parcel_info('500 m Mixed Layer Parcel', mlpcl, 0.4, .65)

	# LCL, CCL, EL, convective temp?
	# other data?
	
  x = 0.4
  y = 0
  line = 'Hodograph'
  plt.text(x,y, line, verticalalignment='center', horizontalalignment='left', fontsize=5)
  x += 0.02
  y -= 0.065
  line = '0-1 km shear {0:3d}$^\circ$ {1:3.1f} m/s'.format(int(shear['s01'][0]),shear['s01'][1])
  plt.text(x,y, line, verticalalignment='center', horizontalalignment='left', fontsize=5)
  y -= 0.05
  line = '0-3 km shear {0:3d}$^\circ$ {1:3.1f} m/s'.format(int(shear['s03'][0]),shear['s03'][1])
  plt.text(x,y, line, verticalalignment='center', horizontalalignment='left', fontsize=5)
  y -= 0.05
  line = '0-6 km shear {0:3d}$^\circ$ {1:3.1f} m/s'.format(int(shear['s06'][0]),shear['s06'][1])
  plt.text(x,y, line, verticalalignment='center', horizontalalignment='left', fontsize=5)
  y -= 0.05
  line = 'SRH 0-1 : {0:d} m2/s2'.format(int(shear['srh01']))
  plt.text(x,y, line, verticalalignment='center', horizontalalignment='left', fontsize=5)
  y -= 0.05
  line = 'SRH 0-3 : {0:d} m2/s2'.format(int(shear['srh03']))
  plt.text(x,y, line, verticalalignment='center', horizontalalignment='left', fontsize=5)
  y -= 0.05
  line = 'ERH 0-1 : {0:d} m2/s2'.format(int(shear['erh01']))
  plt.text(x,y, line, verticalalignment='center', horizontalalignment='left', fontsize=5)
  y -= 0.05
  line = 'ERH 0-3 : {0:d} m2/s2'.format(int(shear['erh03']))
  plt.text(x,y, line, verticalalignment='center', horizontalalignment='left', fontsize=5)
  y -= 0.05
  line = 'BRN : {0:d}'.format(int(brn))
  plt.text(x,y, line, verticalalignment='center', horizontalalignment='left', fontsize=5)
  y -= 0.05
  line = '0-1 km shear {0:3d}$^\circ$ {1:3.1f} m/s'.format(int(shear['s01'][0]),shear['s01'][1])
  plt.text(x,y, line, verticalalignment='center', horizontalalignment='left', fontsize=5)
  y -= 0.05
  line = '1-2 km shear {0:3d}$^\circ$ {1:3.1f} m/s'.format(int(shear['s12'][0]),shear['s12'][1])
  plt.text(x,y, line, verticalalignment='center', horizontalalignment='left', fontsize=5)
  y -= 0.05
  line = '2-3 km shear {0:3d}$^\circ$ {1:3.1f} m/s'.format(int(shear['s23'][0]),shear['s23'][1])
  plt.text(x,y, line, verticalalignment='center', horizontalalignment='left', fontsize=5)
  y -= 0.05
  line = '3-4 km shear {0:3d}$^\circ$ {1:3.1f} m/s'.format(int(shear['s34'][0]),shear['s34'][1])
  plt.text(x,y, line, verticalalignment='center', horizontalalignment='left', fontsize=5)
  y -= 0.05
  line = '4-5 km shear {0:3d}$^\circ$ {1:3.1f} m/s'.format(int(shear['s45'][0]),shear['s45'][1])
  plt.text(x,y, line, verticalalignment='center', horizontalalignment='left', fontsize=5)
  y -= 0.05
  line = '5-6 km shear {0:3d}$^\circ$ {1:3.1f} m/s'.format(int(shear['s56'][0]),shear['s56'][1])
  plt.text(x,y, line, verticalalignment='center', horizontalalignment='left', fontsize=5)