""" compare own results against references from the Ulaby example codes provided http://mrs.eecs.umich.edu/codes/Module10_5/Module10_5.html for the Oh92 model (PRISM1) """ import sys import os sys.path.append(os.path.abspath(os.path.dirname(__file__)) + os.sep + '..') from sense.surface import Oh92 from sense.util import f2lam import matplotlib.pyplot as plt import numpy as np plt.close('all') eps = 30.8 - 40.j # note that normally the imagionary part is supposed to be negative! freq = 1. # GH s = 0.05 # m ks = (2. * np.pi / f2lam(freq)) * s theta = np.deg2rad(np.arange(0., 70.)) O = Oh92(eps, ks, theta) O.plot() plt.show()
from sense.util import f2lam from sense.model import RTModel from sense.soil import Soil from sense.canopy import OneLayer import matplotlib.pyplot as plt import pdb plt.close('all') theta_deg = np.arange(0., 70.) # theta_deg = 40. theta = np.deg2rad(theta_deg) f = 13. # GHz lam = f2lam(f) # m s = 0.0015 # m l = 0.015 # m omega = 0.1 #guessed from figure in chapter 4 for the time being eps = 15. - 4.0j models = {'surface': 'Oh92', 'canopy': 'turbid_rayleigh'} pol = 'vv' # short alfalfa d = 0.17
def test_scat_rayleigh(self): theta = self.theta*1. #theta = np.array([np.deg2rad(90.)]) stype = 'turbid_rayleigh' models = {'surface': 'Oh92', 'canopy': stype} eps = 15. -3.j d = 2. ke = 0.05 omega=0.5 soil = Soil(eps=eps, f=5., s=0.02) can = OneLayer(ke_h=ke, ke_v=ke, d=d, ks_h = omega*ke, ks_v = omega*ke) S = model.SingleScatRT(surface=soil, canopy=can, models=models, theta=theta, freq=self.freq) S.sigma0() models = {'surface': 'Dubois95', 'canopy': stype} S = model.SingleScatRT(surface=soil, canopy=can, models=models, theta=theta, freq=self.freq) S.sigma0() # compare results against results obtained through Eq. 11.23 (analytic way) SMODEL = Dubois95(eps, soil.ks, theta, lam=f2lam(soil.f)) s_hh_surf = SMODEL.hh s_vv_surf = SMODEL.vv trans = np.exp(-d*ke/np.cos(theta)) n=2. # 2== coherent RHO_h = S.G.rho_h RHO_v = S.G.rho_v ref_hh = trans**2. * s_hh_surf + (0.75*omega)*np.cos(theta)*(1.-trans**2.)*(1.+RHO_h**2.*trans**2.)+3.*n*omega*ke*d*RHO_h*trans**2. ref_vv = trans**2. * s_vv_surf + (0.75*omega)*np.cos(theta)*(1.-trans**2.)*(1.+RHO_v**2.*trans**2.)+3.*n*omega*ke*d*RHO_v*trans**2. pol = 'hh' self.assertEqual(len(ref_hh), len(S.stot[pol])) for i in xrange(len(ref_hh)): #print np.rad2deg(theta[i]), ref_hh[i] if np.isnan(ref_hh[i]): self.assertTrue(np.isnan(S.stot[pol][i])) else: # check components first self.assertAlmostEqual(S.s0g[pol][i], s_hh_surf[i]*trans[i]**2.) # attenuated ground self.assertAlmostEqual(S.s0c[pol][i]+S.s0gcg[pol][i], 0.75*omega*np.cos(theta[i])*(1.-trans[i]**2.)*(1.+RHO_h[i]**2.*trans[i]**2.)) # gcg xx=3.*n*omega*ke*d*RHO_h[i]*trans[i]**2. print np.rad2deg(theta[i]), S.s0gcg[pol][i],xx, S.s0gcg[pol][i]/xx self.assertAlmostEqual(S.s0cgt[pol][i],xx) db1=db(ref_hh[i]) db2=db(S.stot[pol][i]) self.assertAlmostEqual(db1,db2) pol = 'vv' self.assertEqual(len(ref_vv), len(S.stot[pol])) for i in xrange(len(ref_vv)): #print theta[i], ref_vv[i] if np.isnan(ref_vv[i]): self.assertTrue(np.isnan(S.stot[pol][i])) else: self.assertAlmostEqual(db(ref_vv[i]), db(S.stot[pol][i]))