#angmom = ort.angmom_fixed(ang_mode, phi) angmom = ort.angmom_beta_phi(a, b, phi) #print angmom # calculate radar variables alpha_cov = ort.avg_polcov(angmom, alpha_a, alpha_c) avar_hh = alpha_cov[0] avar_vv = alpha_cov[1] avar_hv = alpha_cov[2] acov_hh_vv = alpha_cov[3] acov_hh_hv = alpha_cov[4] acov_vv_hv = alpha_cov[5] adp = alpha_cov[6] zdr, ldr, kdp, rhohv, zh, rhoxh = ort.radar(wavl, avar_hh, avar_vv, avar_hv, acov_hh_vv, acov_hh_hv, acov_vv_hv, adp) # compare to simultaneous tr psi_dp = 0.5 * np.pi svar_h, svar_v, scov_hv = ort.cov_sim(alpha_cov, psi_dp) zdr_str, ldrj, kdpj, rhohv_str, zh_str, rhoxhj = ort.radar( wavl, svar_h, svar_v, avar_hv, scov_hv, acov_hh_hv, acov_vv_hv, adp) phi_dp = 180. / np.pi * np.angle(scov_hv) # plot distribution plt.figure(0) v = np.linspace(0., 1., 1000) theta = np.arccos(1. - 2. * v) beta = ort.beta_dist(v, a, b) plt.plot(theta * 180. / np.pi, beta, 'b-', lw=3.)
#a = 7. #b = 7. sig_deg = 180. * np.sqrt(2. / (b1 - 1.)) / np.pi #sig_deg = 35. print sig_deg angmom1 = ort.angmom_beta(a1, b1) angmom2 = ort.angmom_beta(a2, b2) angmom = (w1 * np.array(angmom1) + w2 * np.array(angmom2)) angmom_g = ort.angmom_gauss(sig_deg) print angmom_g print angmom1 # calculate radar variables avar_hh, avar_vv, avar_hv, acov_hh_vv, adp = ort.avg_polcov( angmom, alpha_a, alpha_c) zdr, ldr, kdp, rhohv, zh = ort.radar(wavl, avar_hh, avar_vv, avar_hv, acov_hh_vv, adp) print zdr, ldr, kdp, rhohv, zh avar_hh, avar_vv, avar_hv, acov_hh_vv, adp = ort.avg_polcov( angmom_g, alpha_a, alpha_c) zdr, ldr, kdp, rhohv, zh = ort.radar(wavl, avar_hh, avar_vv, avar_hv, acov_hh_vv, adp) print zdr, ldr, kdp, rhohv, zh # plot beta distribution x = (1. - np.cos(np.linspace(fc(0.), fc(1.), 201))) / 2. ang = np.arccos(1. - 2. * x) * 180. / np.pi beta_av = (w1 * ort.beta_dist(x, a1, b1) + w2 * ort.beta_dist(x, a2, b2)) #plt.plot(x, beta_av, 'r--', lw=3.) plt.plot(ang, beta_av, 'r--', lw=3.) ax = plt.gca()
eps_mix = maxwell_garnett(eps_ice, vfrac_inc) alpha_a_sp, alpha_a_sp, alpha_c_sp = sp.oblate_polz(eps_mix, dmax / 2., thick / 2.) # set orientation distribution amp = 18. mod = 0. a = (amp - 2) * mod + 1 b = amp * (1 - mod) + 2 * mod - 1 angmom = ort.angmom_beta(a, b) # calculate radar variables alp_cov_arr = ort.avg_polcov(angmom, alpha_a, alpha_c) alp_cov_arr_sp = ort.avg_polcov(angmom, alpha_a_sp, alpha_c_sp) zdr, ldr, kdp, rhohv, zh, rhoxh = ort.radar(wavl, alp_cov_arr) zdr_sp, ldr_sp, kdp_sp, rhohv_sp, zh_sp, rhoxh = ort.radar( wavl, alp_cov_arr_sp) #print zdr, ldr, kdp, rhohv, zh # plot radar variables fig = plt.figure(1) ax = fig.add_subplot(2, 2, 1) plt.plot(vfrac_inc, zdr, 'r-', lw=3.) plt.plot(vfrac_inc, zdr_sp, 'b-', lw=3.) #ax.set_ylim([0., 1.]) ax.set_xlim([0.05, 1.]) ax = fig.add_subplot(2, 2, 2) plt.plot(vfrac_inc, np.log10(kdp), 'r-', lw=3.) plt.plot(vfrac_inc, np.log10(kdp_sp), 'b-', lw=3.)
# calculate radar variables alpha_cov = ort.avg_polcov(angmom, alpha_a, alpha_c) avar_hh = alpha_cov[0] avar_vv = alpha_cov[1] avar_hv = alpha_cov[2] acov_hh_vv = alpha_cov[3] acov_hh_hv = alpha_cov[4] acov_vv_hv = alpha_cov[5] adp = alpha_cov[6] # simultaneous tr psi_dp = -73. * np.pi / 180. svar_h, svar_v, scov_hv = ort.cov_sim(alpha_cov, psi_dp) zdr, ldr, kdp, rhohv, zh, rhoxh = ort.radar(wavl, svar_h, svar_v, avar_hv, scov_hv, acov_hh_hv, acov_vv_hv, adp) phi_dp = 180. / np.pi * np.arctan2(np.imag(scov_hv), np.real(scov_hv)) zh = zh - 1. # plot distribution plt.figure(0) v = np.linspace(0., 1., 1000) theta = np.arccos(1. - 2. * v) beta = ort.beta_dist(v, a, b) plt.plot(theta * 180. / np.pi, beta, 'b-', lw=1.) ax = plt.gca() #ax.set_ylim([0., 1.]) ax.set_xlim([0., 180.]) plt.savefig('dist.png')
sigv_agg = np.log10(sigv_agg) #print sigh_agg, zdr_agg, kdp_agg # compare to isolated pristine crystals #aobl_a, aobl_a, aobl_c = sp.oblate_polz(eps_ice, asp_inc/2., 1./2.) aprl_c, aprl_a, aprl_a = sp.prolate_polz(eps_ice, 1. / 2., asp_inc / 2.) vol_sph = np.pi / 6. * asp_inc**2. #aobl_a = aobl_a/vol_sph #aobl_c = aobl_c/vol_sph aprl_a = aprl_a / vol_sph aprl_c = aprl_c / vol_sph angmom_pr = ort.angmom_beta(a_inc, b_inc) #acov_arr = ort.avg_polcov(angmom_pr, aobl_a, aobl_c) acov_arr = ort.avg_polcov(angmom_pr, aprl_a, aprl_c) zdr, ldr, kdp, rhohv, zhh, rhoxh = ort.radar(wavl, acov_arr) sigh = np.log10(k**2. * acov_arr[0]) sigv = np.log10(k**2. * acov_arr[1]) # plot radar variables fig = plt.figure(1) ax = fig.add_subplot(2, 2, 1) plt.plot(vfrac_inc, zdr * vfrac_inc / vfrac_inc, 'r-', lw=3.) plt.plot(vfrac_inc, zdr_agg, 'b-', lw=3.) #ax.set_ylim([0., 1.]) #ax.set_xlim([0.05, 1.]) ax = fig.add_subplot(2, 2, 2) plt.plot(vfrac_inc, np.log10(kdp) * vfrac_inc / vfrac_inc, 'r-', lw=3.) plt.plot(vfrac_inc, np.log10(kdp_agg), 'b-', lw=3.) #ax.set_ylim([0., 1.])