def bulk_scatter(wavelength, temp, dist, diameters, canting_width=None): csec_units = 'mm**2' scatt = scattering.scatterer(wavelength, temp, 'water', diameters=diameters, shape='oblate') if canting_width is not None: scatt.angle_width = canting_width scatt.set_scattering_model('tmatrix') z = to_dBz(scatt.get_reflectivity_factor(dist, polar='h')) zdr = (z - to_dBz(scatt.get_reflectivity_factor(dist, polar='v'))).rescale('dB') atten = (scatt.get_attenuation(dist, polar='h').rescale('1/km') * exp_to_dB) diff_atten = (atten - scatt.get_attenuation(dist, polar='v').rescale('1/km') * exp_to_dB) kdp = ((scatt.get_propagation_wavenumber(dist, polar='h') - scatt.get_propagation_wavenumber(dist, polar='v')) * pq.rad).rescale( 'deg/km') delta = (scatt.get_backscatter_differential_phase(dist) * pq.rad).rescale('deg') return ScatterResults(z, zdr, atten, diff_atten, kdp, delta)
delta_d = -angle(-scatt.S_bkwd[0,0].conj() * scatt.S_bkwd[1,1], deg=True).squeeze() ax[0,2].plot(d_plot, delta_d, temp_color, label=plot_label) diff_sig_b = to_dB(scatt.sigma_bh / scatt.sigma_bv).squeeze() ax[1,0].plot(d_plot, diff_sig_b, temp_color, label=plot_label) diff_sig_e = to_dB(scatt.sigma_eh / scatt.sigma_ev).squeeze() ax[1,1].plot(d_plot, diff_sig_e, temp_color, label=plot_label) diff_phase = (scatt.S_frwd[0, 0] - scatt.S_frwd[1, 1]).real.squeeze().rescale('mm') ax[1,2].plot(d_plot, diff_phase, temp_color, label=plot_label) z = to_dBz(scatt.get_reflectivity_factor(dist, polar='h')) zdr = (z - to_dBz(scatt.get_reflectivity_factor(dist, polar='v'))).rescale('dB') atten = (scatt.get_attenuation(dist, polar='h').rescale('1/km') * exp_to_dB) diff_atten = (atten - scatt.get_attenuation(dist, polar='v').rescale('1/km') * exp_to_dB) kdp = ((scatt.get_propagation_wavenumber(dist, polar='h') - scatt.get_propagation_wavenumber(dist, polar='v')) * pq.rad).rescale( 'deg/km') delta = (scatt.get_backscatter_differential_phase(dist) * pq.rad).rescale('deg') # temp_color = plt.get_cmap('RdBu')(plt.Normalize(0,30)(t)) scatter_kwargs = dict(c=temp_color, edgecolor='none', alpha=0.4) ax2[0,0].scatter(qr, z, **scatter_kwargs) ax2[0,1].scatter(qr, atten, **scatter_kwargs) ax2[0,2].scatter(qr, delta, **scatter_kwargs) ax2[1,0].scatter(qr, zdr, **scatter_kwargs)