import numpy as N import matplotlib.pyplot as P import scattering, dsd d = N.linspace(0.01, 2.0, 200).reshape(200,1) l = N.linspace(0.01, 25.0, 100).reshape(1,100) mp = dsd.mp_from_lwc(d*10.0, l) sband = 10.0 s_ray = scattering.scatterer(sband, 10.0, 'water', diameters = d) s_ray.set_scattering_model('rayleigh') s_ray_ref = 10.0 * N.log10(s_ray.get_reflectivity(mp)) s_ray_atten = s_ray.get_attenuation(mp) * (10.0 * N.log10(N.e)) m = scattering.refractive_index('water', sband, 10.0) Kw = (m**2 - 1)/(m**2 + 2) lam = dsd.mp_slope_3rd(l) s_ray_atten_mp = ((2/3.) * (N.pi**5 * N.abs(Kw)**2 / (sband**4) * 720./lam**7 * dsd.mp_N0) + 6 * N.pi / (1e6 * sband) * N.imag(Kw) * l).squeeze() d = d.squeeze() l = l.squeeze() f = P.figure() ax = f.add_subplot(1,2,2) ax.semilogy(l, s_ray_atten_mp, 'b--') ax.semilogy(l, s_ray_atten, 'b-') ax.set_xlabel('LWC (g/kg)') ax.set_ylabel('Attenuation') ax.set_title('Comparison of Attenuation') ax.grid()
import matplotlib.pyplot as plt import numpy as np import scattering, dsd import scipy.constants as consts d = np.linspace(0.01, 1.0, 200).reshape(200, 1) * consts.centi l = np.linspace(0.01, 25.0, 100).reshape(1, 100) / consts.kilo dist = dsd.mp_from_lwc(d, l) #lam = 0.1 lam = 0.0321 temp = 10.0 db_factor = 10.0 * np.log10(np.e) ref_adjust = 180 mie = scattering.scatterer(lam, temp, 'water', diameters=d) mie.set_scattering_model('mie') ray = scattering.scatterer(lam, temp, 'water', diameters=d) ray.set_scattering_model('rayleigh') oblate_rg = scattering.scatterer( lam, temp, 'water', diameters=d, shape='oblate') oblate_rg.set_scattering_model('gans') sphere_rg = scattering.scatterer( lam, temp, 'water', diameters=d, shape='sphere') sphere_rg.set_scattering_model('gans') oblate = scattering.scatterer(lam, temp, 'water', diameters=d, shape='oblate') oblate.set_scattering_model('tmatrix')
def plot_csec(scatterer, l, var, name): plt.plot(l, var, label = '%.1f cm' % (scatterer.wavelength / consts.centi)) plt.xlabel('Rain Content (g m^-3)') plt.ylabel(name) def plot_csecs(l, scatterers): for s in scatterers: plt.subplot(1,2,1) plot_csec(s, l, s.get_copolar_cross_correlation(mp), 'rho(1)') plt.subplot(1,2,2) plot_csec(s, l, np.rad2deg(np.unwrap( s.get_backscatter_differential_phase(mp))), 'delta') d = np.linspace(0.01, 2.0, 200).reshape(200, 1) * consts.centi l = np.linspace(0.01, 25.0, 100).reshape(1,100) / consts.kilo mp = dsd.mp_from_lwc(d, l) sband = 0.1 cband = 0.05 xband = 0.0321 temp = 10.0 angleWidth = 10 x_fixed = scattering.scatterer(xband, temp, 'water', diameters=d, shape='oblate') x_fixed.set_scattering_model('tmatrix') x_spread = scattering.scatterer(xband, temp, 'water', diameters=d, shape='oblate') x_spread.angle_width = angleWidth x_spread.set_scattering_model('tmatrix') c_fixed = scattering.scatterer(cband, temp, 'water', diameters=d, shape='oblate')