Ejemplo n.º 1
0
def plot_thsections(dbz,vvel,ht,dayt,**kwargs):

	fig,ax = plt.subplots(2,1,sharex=True)

	'colormap for vvel'
	orig_cmap = cm.bwr
	shifted_cmap = shiftedColorMap(orig_cmap, midpoint=0.7, name='shifted')

	' add images and colorbar'
	im0=ax[0].imshow(dbz,interpolation='none',cmap='nipy_spectral',vmin=-20,vmax=60,aspect='auto',origin='lower')
	im1=ax[1].imshow(vvel,interpolation='none',cmap=shifted_cmap,vmin=-10,vmax=4,aspect='auto',origin='lower')
	divider0 = make_axes_locatable(ax[0])
	cax0 = divider0.append_axes("right", size="2%", pad=0.05)
	cbar0 = plt.colorbar(im0, cax=cax0)
	divider1 = make_axes_locatable(ax[1])
	cax1 = divider1.append_axes("right", size="2%", pad=0.05)
	cbar1 = plt.colorbar(im1, cax=cax1)

	if 'echotop' in kwargs:
		echot=kwargs['echotop']
		ax[0].plot(echot,color='k')

	format_yaxis(ax[0],ht)
	format_yaxis(ax[1],ht)

	format_xaxis(ax[1], dayt, minutes_tick=30, labels=True)
	ax[1].invert_xaxis()

	ax[0].set_ylabel('Hgt MSL [km]')
	ax[1].set_ylabel('Hgt MSL [km]')
	ax[1].set_xlabel(r'$\Leftarrow$'+' Time [UTC]')

	plt.subplots_adjust(hspace=0.05)
	plt.suptitle('SPROF observations. Date: '+dayt[0].strftime('%Y-%b'))
	plt.draw()
Ejemplo n.º 2
0
def plot_thsections_single(ht, dayt, **kwargs):

    matplotlib.rcParams.update({'font.size': 20})
    fig, ax = plt.subplots()
    str_etop = ''
    if 'dbz' in kwargs:
        im = ax.imshow(kwargs['dbz'],
                       interpolation='none',
                       cmap='nipy_spectral',
                       vmin=-30,
                       vmax=60,
                       aspect='auto',
                       origin='lower')
    elif 'vvel' in kwargs:
        orig_cmap = cm.bwr
        shifted_cmap = shiftedColorMap(orig_cmap, midpoint=0.7, name='shifted')
        im = ax.imshow(kwargs['vvel'],
                       interpolation='none',
                       cmap=shifted_cmap,
                       vmin=-10,
                       vmax=4,
                       aspect='auto',
                       origin='lower')

    if 'echotop' in kwargs:
        ax.plot(kwargs['echotop'][0], color='black')
        units = r'$\mathregular{km^{-2}}$'
        str_etop = 'etop_var: {:2.1f}'.format(np.nanvar(kwargs['echotop'][1]))
        str_etop += units

    if 'bband' in kwargs:
        bbht = kwargs['bband'][0]
        idx_bbht = kwargs['bband'][1]
        f = interp1d(ht, range(len(ht)))
        ax.plot(idx_bbht, f(bbht), marker='o', linestyle='--', color='black')

    if kwargs['colorbar']:
        divider = make_axes_locatable(ax)
        cax = divider.append_axes("right", size="2%", pad=0.)
        cbar = plt.colorbar(im, cax=cax)

    format_yaxis(ax, ht, toplimit=11)
    format_xaxis(ax, dayt, labels=True, format='%H')
    ax.invert_xaxis()

    str_date = dayt[0].strftime('%Y-%b')
    str_tbeg = dayt[0].strftime(' %dT%H:00') + '-'
    str_tend = (dayt[-1]).strftime('%dT%H:00')
    c = kwargs['case']
    annot = 'Case ' + str(
        c) + ' ' + str_date + str_tbeg + str_tend + ' UTC' + ' ' + str_etop
    ax.text(0.02, 0.02, annot, transform=ax.transAxes, fontsize=14)
    plt.subplots_adjust(top=0.98, bottom=0.05, left=0.04, right=0.91)
    plt.draw()
Ejemplo n.º 3
0
def plot_thsections(dbz, vvel, ht, dayt, **kwargs):

    fig, ax = plt.subplots(2, 1, sharex=True)

    'colormap for vvel'
    orig_cmap = cm.bwr
    shifted_cmap = shiftedColorMap(orig_cmap, midpoint=0.7, name='shifted')

    ' add images and colorbar'
    im0 = ax[0].imshow(dbz,
                       interpolation='none',
                       cmap='nipy_spectral',
                       vmin=-20,
                       vmax=60,
                       aspect='auto',
                       origin='lower')
    im1 = ax[1].imshow(vvel,
                       interpolation='none',
                       cmap=shifted_cmap,
                       vmin=-10,
                       vmax=4,
                       aspect='auto',
                       origin='lower')
    divider0 = make_axes_locatable(ax[0])
    cax0 = divider0.append_axes("right", size="2%", pad=0.05)
    cbar0 = plt.colorbar(im0, cax=cax0)
    divider1 = make_axes_locatable(ax[1])
    cax1 = divider1.append_axes("right", size="2%", pad=0.05)
    cbar1 = plt.colorbar(im1, cax=cax1)

    if 'echotop' in kwargs:
        echot = kwargs['echotop']
        ax[0].plot(echot, color='k')

    format_yaxis(ax[0], ht)
    format_yaxis(ax[1], ht)

    format_xaxis(ax[1], dayt, minutes_tick=30, labels=True)
    ax[1].invert_xaxis()

    ax[0].set_ylabel('Hgt MSL [km]')
    ax[1].set_ylabel('Hgt MSL [km]')
    ax[1].set_xlabel(r'$\Leftarrow$' + ' Time [UTC]')

    plt.subplots_adjust(hspace=0.05)
    plt.suptitle('SPROF observations. Date: ' + dayt[0].strftime('%Y-%b'))
    plt.draw()
Ejemplo n.º 4
0
def plot_thsections_single(ht,dayt,**kwargs):

	matplotlib.rcParams.update({'font.size':20})
	fig,ax = plt.subplots()
	str_etop=''
	if 'dbz' in kwargs:
		im=ax.imshow(kwargs['dbz'],interpolation='none',cmap='nipy_spectral',vmin=-30,vmax=60,aspect='auto',origin='lower')
	elif 'vvel' in kwargs:
		orig_cmap = cm.bwr
		shifted_cmap = shiftedColorMap(orig_cmap, midpoint=0.7, name='shifted')
		im=ax.imshow(kwargs['vvel'],interpolation='none',cmap=shifted_cmap,vmin=-10,vmax=4,aspect='auto',origin='lower')

	if 'echotop' in kwargs:
		ax.plot(kwargs['echotop'][0],color='black')
		units=r'$\mathregular{km^{-2}}$'
		str_etop='etop_var: {:2.1f}'.format(np.nanvar(kwargs['echotop'][1]))
		str_etop+=units

	if 'bband' in kwargs:
		bbht=kwargs['bband'][0]
		idx_bbht=kwargs['bband'][1]
		f = interp1d(ht, range(len(ht)))
		ax.plot(idx_bbht, f(bbht),marker='o',linestyle='--',color='black')

	if kwargs['colorbar']:
		divider = make_axes_locatable(ax)
		cax = divider.append_axes("right", size="2%", pad=0.)
		cbar = plt.colorbar(im, cax=cax)

	format_yaxis(ax,ht,toplimit=11)
	format_xaxis(ax, dayt, labels=True,format='%H')
	ax.invert_xaxis()

	str_date=dayt[0].strftime('%Y-%b')
	str_tbeg=dayt[0].strftime(' %dT%H:00')+'-'
	str_tend=(dayt[-1]).strftime('%dT%H:00')
	c=kwargs['case']
	annot='Case '+str(c)+' '+str_date+str_tbeg+str_tend+' UTC'+' '+str_etop
	ax.text(0.02,0.02,annot,transform=ax.transAxes,fontsize=14)
	plt.subplots_adjust(top=0.98, bottom=0.05,left=0.04, right=0.91)
	plt.draw()
Ejemplo n.º 5
0
def plot_turbulence_spectra(dbz,vvel,ts,ts2,ht,dayt):

	' setup new figure '	
	fig = plt.figure(figsize=(8,10))

	' images axes'
	gs = gridspec.GridSpec(4,1)
	gs.update(top=0.95, bottom=0.46, hspace=.05)
	ax0 = plt.subplot(gs[0])
	ax1 = plt.subplot(gs[1])

	' vvel axis'
	gs = gridspec.GridSpec(1,1)
	gs.update(top=0.7, bottom=0.48,right=0.88)
	ax2 = plt.subplot(gs[0])

	' power spectrum axis'
	gs = gridspec.GridSpec(1,1)
	gs.update(top=0.4, bottom=0.05,right=0.88)
	ax3 = plt.subplot(gs[0])

	'colormap for vvel'
	orig_cmap = cm.bwr
	shifted_cmap = shiftedColorMap(orig_cmap, midpoint=0.7, name='shifted')

	' add images and colorbar'
	im0= ax0.imshow(dbz,interpolation='none',cmap='nipy_spectral',vmin=-20,vmax=60,aspect='auto',origin='lower')
	im1= ax1.imshow(vvel,interpolation='none',cmap=shifted_cmap,vmin=-10,vmax=4,aspect='auto',origin='lower')
	divider0 = make_axes_locatable(ax0)
	cax0 = divider0.append_axes("right", size="2%", pad=0.05)
	cbar0 = plt.colorbar(im0, cax=cax0)
	divider1 = make_axes_locatable(ax1)
	cax1 = divider1.append_axes("right", size="2%", pad=0.05)
	cbar1 = plt.colorbar(im1, cax=cax1)

	' add levels, Doppler velocity, and power spectrum'
	levels=[10, 20,30,40]
	colors=['y', 'k', 'g', 'r']
	variance_y=[0.7, 0.78, 0.86, 0.94]	
	for n,x in enumerate(levels):
		' add levels '
		ax0.plot([x]*len(vvel[x,:]),color=colors[n])
		ax1.plot([x]*len(vvel[x,:]),color=colors[n])

		' get traces at level x'
		trace_doppler=vvel[x,:]
		trace_dbz=dbz[x,:]	

		' extract hydrometeor vvel from Doppler vvel'
		trace_z = 10.**(trace_dbz/10.)
		vvel_hydrometeor = 0.817*trace_z**0.063 # Atlas et al. 1973
		trace_wind = trace_doppler - (-vvel_hydrometeor)

		' plot Doppler velocity at given levels '
		ax2.plot(trace_doppler,color=colors[n])
		ax2.plot(vvel_hydrometeor,color=colors[n])
		ax2.plot(trace_wind,color=colors[n], linestyle=':',linewidth=1)
		ax2.set_ylim([-10,8])

		' add variance annotation '
		variance=np.nanvar(trace_doppler)
		ax2.text(0.2, variance_y[n], 'Variance: '+'{:3.2f}'.format(variance), 
					color=colors[n], transform=ax2.transAxes)

		' create interpolant with regular time grid of 40 seconds'
		asd = check_trace(trace_doppler)
		f=interp1d(ts,asd)
		trace_doppler2= f(ts2)

		' plot power spectrum density'
		if ~np.any(np.isnan(trace_doppler2)):
			print 'level: '+str(x)
			asd = check_trace(trace_wind)
			power_spectrum(ax3, asd,colors[n],linestyle=':',marker=None)
			power_spectrum(ax3,trace_doppler2,colors[n],linestyle='-',marker=None)

	format_yaxis(ax0,ht)
	format_yaxis(ax1,ht)

	format_xaxis(ax0, dayt, freqMinutes=60,labels=False )
	format_xaxis(ax1, dayt, freqMinutes=60,labels=False )
	format_xaxis(ax2, dayt, freqMinutes=60,labels=True )

	ax0.set_ylabel('Hgt MSL [km]')
	ax1.set_ylabel('Hgt MSL [km]')
	ax2.set_ylabel('VVel [ms^-1]')
	ax2.set_xlabel(r'$\Leftarrow$'+' Time [UTC]')

	ax0.set_xlim([0, len(vvel[0,:])])
	ax0.invert_xaxis()
	ax0.set_xticklabels([])
	ax1.set_xlim([0, len(vvel[0,:])])
	# ax1.set_ylim([0, 20])
	ax1.invert_xaxis()
	ax1.set_xticklabels([])	
	ax2.set_xlim([0, len(vvel[0,:])])
	ax2.invert_xaxis()

	plt.suptitle('SPROF observations. Date: '+dayt[0].strftime('%Y-%b'))
	plt.draw()
Ejemplo n.º 6
0
def plot_turbulence_spectra(dbz, vvel, ts, ts2, ht, dayt):

    ' setup new figure '
    fig = plt.figure(figsize=(8, 10))

    ' images axes'
    gs = gridspec.GridSpec(4, 1)
    gs.update(top=0.95, bottom=0.46, hspace=.05)
    ax0 = plt.subplot(gs[0])
    ax1 = plt.subplot(gs[1])

    ' vvel axis'
    gs = gridspec.GridSpec(1, 1)
    gs.update(top=0.7, bottom=0.48, right=0.88)
    ax2 = plt.subplot(gs[0])

    ' power spectrum axis'
    gs = gridspec.GridSpec(1, 1)
    gs.update(top=0.4, bottom=0.05, right=0.88)
    ax3 = plt.subplot(gs[0])

    'colormap for vvel'
    orig_cmap = cm.bwr
    shifted_cmap = shiftedColorMap(orig_cmap, midpoint=0.7, name='shifted')

    ' add images and colorbar'
    im0 = ax0.imshow(dbz,
                     interpolation='none',
                     cmap='nipy_spectral',
                     vmin=-20,
                     vmax=60,
                     aspect='auto',
                     origin='lower')
    im1 = ax1.imshow(vvel,
                     interpolation='none',
                     cmap=shifted_cmap,
                     vmin=-10,
                     vmax=4,
                     aspect='auto',
                     origin='lower')
    divider0 = make_axes_locatable(ax0)
    cax0 = divider0.append_axes("right", size="2%", pad=0.05)
    cbar0 = plt.colorbar(im0, cax=cax0)
    divider1 = make_axes_locatable(ax1)
    cax1 = divider1.append_axes("right", size="2%", pad=0.05)
    cbar1 = plt.colorbar(im1, cax=cax1)

    ' add levels, Doppler velocity, and power spectrum'
    levels = [10, 20, 30, 40]
    colors = ['y', 'k', 'g', 'r']
    variance_y = [0.7, 0.78, 0.86, 0.94]
    for n, x in enumerate(levels):
        ' add levels '
        ax0.plot([x] * len(vvel[x, :]), color=colors[n])
        ax1.plot([x] * len(vvel[x, :]), color=colors[n])

        ' get traces at level x'
        trace_doppler = vvel[x, :]
        trace_dbz = dbz[x, :]

        ' extract hydrometeor vvel from Doppler vvel'
        trace_z = 10.**(trace_dbz / 10.)
        vvel_hydrometeor = 0.817 * trace_z**0.063  # Atlas et al. 1973
        trace_wind = trace_doppler - (-vvel_hydrometeor)

        ' plot Doppler velocity at given levels '
        ax2.plot(trace_doppler, color=colors[n])
        ax2.plot(vvel_hydrometeor, color=colors[n])
        ax2.plot(trace_wind, color=colors[n], linestyle=':', linewidth=1)
        ax2.set_ylim([-10, 8])

        ' add variance annotation '
        variance = np.nanvar(trace_doppler)
        ax2.text(0.2,
                 variance_y[n],
                 'Variance: ' + '{:3.2f}'.format(variance),
                 color=colors[n],
                 transform=ax2.transAxes)

        ' create interpolant with regular time grid of 40 seconds'
        asd = check_trace(trace_doppler)
        f = interp1d(ts, asd)
        trace_doppler2 = f(ts2)

        ' plot power spectrum density'
        if ~np.any(np.isnan(trace_doppler2)):
            print 'level: ' + str(x)
            asd = check_trace(trace_wind)
            power_spectrum(ax3, asd, colors[n], linestyle=':', marker=None)
            power_spectrum(ax3,
                           trace_doppler2,
                           colors[n],
                           linestyle='-',
                           marker=None)

    format_yaxis(ax0, ht)
    format_yaxis(ax1, ht)

    format_xaxis(ax0, dayt, freqMinutes=60, labels=False)
    format_xaxis(ax1, dayt, freqMinutes=60, labels=False)
    format_xaxis(ax2, dayt, freqMinutes=60, labels=True)

    ax0.set_ylabel('Hgt MSL [km]')
    ax1.set_ylabel('Hgt MSL [km]')
    ax2.set_ylabel('VVel [ms^-1]')
    ax2.set_xlabel(r'$\Leftarrow$' + ' Time [UTC]')

    ax0.set_xlim([0, len(vvel[0, :])])
    ax0.invert_xaxis()
    ax0.set_xticklabels([])
    ax1.set_xlim([0, len(vvel[0, :])])
    # ax1.set_ylim([0, 20])
    ax1.invert_xaxis()
    ax1.set_xticklabels([])
    ax2.set_xlim([0, len(vvel[0, :])])
    ax2.invert_xaxis()

    plt.suptitle('SPROF observations. Date: ' + dayt[0].strftime('%Y-%b'))
    plt.draw()