def test_HenyeyGreenstein(self): V = HenyeyGreenstein(omega=0.2, tau=1.7, t=0.7, ncoefs=20) self.assertEqual(V.t, 0.7) t_0 = np.pi / 2. t_ex = 0.234234 p_0 = np.pi / 2. p_ex = 0. #--> cos(THETA) = 0 p = V.p(t_0, t_ex, p_0, p_ex) self.assertAlmostEqual(p, (1. - 0.7 * 0.7) / (4. * np.pi * (1. + 0.7 * 0.7)**1.5), 10)
def set_V_SRF(frac, omega, SM, VOD, v, v2, **kwargs): SRFchoices = [[frac, HG_nadirnorm(t=0.01, ncoefs=2, a=[-1., 1., 1.])], [(1. - frac), HG_nadirnorm(t=0.6, ncoefs=10, a=[1., 1., 1.])]] SRF = LinCombSRF(SRFchoices=SRFchoices, NormBRDF=SM) V = HenyeyGreenstein(t=v, omega=omega, tau=v2 * VOD, ncoefs=8) return V, SRF
def test_fn_coefficients_HGIso(self): # test if calculation of fn coefficients is correct # this is done by comparing the obtained coefficients # against the analytical solution using a Rayleigh volume # and isotropic surface scattering phase function S = Isotropic() t_0 = 0. t_ex = 0. p_0 = 0. p_ex = np.pi V = HenyeyGreenstein(omega=0.2, tau=1.7, t=0.7, ncoefs=1) RT = RT1(self.I0, t_0, t_ex, p_0, p_ex, V=V, SRF=S, geometry='ffff') r = RT._fnevals(t_0, p_0, t_ex, p_ex) self.assertTrue(np.allclose(r[0], 1. / (2. * np.pi)))
def test_example_2_int(self): print('Testing Example 2 ...') inc = self.inc2 # ---- evaluation of second example V = HenyeyGreenstein(tau=0.7, omega=0.3, t=0.7, ncoefs=20) SRF = CosineLobe(ncoefs=10, i=5, NormBRDF=np.pi) R = RT1(1., np.deg2rad(inc), np.deg2rad(inc), np.zeros_like(inc), np.full_like(inc, np.pi), V=V, SRF=SRF, geometry='mono') self.assertTrue(np.allclose(self.int_num_2, R.calc()[3], atol=1e-6))
example = 3 # ----------- definition of examples ----------- if example == 1: # define incidence-angle range for generation of backscatter-plots inc = np.arange(1., 89., 1.) # Example 1 V = Rayleigh(tau=0.55, omega=0.24) SRF = CosineLobe(ncoefs=15, i=6, a=[.28, 1., 1.]) label = 'Example 1' elif example == 2: # define incidence-angle range for generation of backscatter-plots inc = np.arange(1., 89., 1.) V = HenyeyGreenstein(tau=0.7, omega=0.3, t=0.7, ncoefs=20) SRF = CosineLobe(ncoefs=10, i=5) label = 'Example 2' elif example == 3: # define incidence-angle range for generation of backscatter-plots inc = np.arange(1., 89., 1.) # list of volume-scattering phase-functions to be combined phasechoices = [ # forward-scattering-peak HenyeyGreenstein(t=0.5, ncoefs=10, a=[-1., 1., 1.]), # backscattering-peak HenyeyGreenstein(t=-0.2, ncoefs=10, a=[-1., 1., 1.]), # downward-specular peak HenyeyGreenstein(t=-0.5, ncoefs=10, a=[1., 1., 1.]), # upward-specular peak HenyeyGreenstein(t=0.2, ncoefs=10, a=[1., 1., 1.]),
def test_HenyeyGreenstein_coefficients(self): V = HenyeyGreenstein(omega=0.2, tau=1.7, t=0.7, ncoefs=20) self.assertEqual(V._get_legcoef(0), 1. / (4. * np.pi)) self.assertEqual(V._get_legcoef(1), 3. * 0.7 / (4. * np.pi))