Ejemplo n.º 1
0
def solve_fun(coef):

    # stype = 'turbid_rayleigh'
    stype = 'turbid_isotropic'
    models = {'surface': 'Oh92', 'canopy': stype}

    ke = coef * lai_508.values.flatten()

    # soil = Soil(eps=eps, f=freq, s=s)
    soil = Soil(mv=sm_508.values.flatten(),
                f=freq,
                s=s,
                clay=0.3,
                sand=0.4,
                bulk=1.65)
    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=freq)

    S.sigma0()

    return S.__dict__['stot']['vv'][0]
Ejemplo n.º 2
0
def solve_fun(VALS):

    for i in range(len(var_opt)):
        dic[var_opt[i]] = VALS[i]

    # ke = dic['coef'] * np.sqrt(dic['lai'])
    # ke = dic['coef'] * np.sqrt(dic['vwc'])
    ke = 1
    dic['ke'] = ke

    # surface
    soil = Soil(mv=dic['mv'],
                C_hh=dic['C_hh'],
                C_vv=dic['C_vv'],
                D_hh=dic['D_hh'],
                D_vv=dic['D_vv'],
                C_hv=dic['C_hv'],
                D_hv=dic['D_hv'],
                V2=dic['V2'],
                s=dic['s'],
                clay=dic['clay'],
                sand=dic['sand'],
                f=dic['f'],
                bulk=dic['bulk'],
                l=dic['l'])

    # canopy
    can = OneLayer(canopy=dic['canopy'],
                   ke_h=dic['ke'],
                   ke_v=dic['ke'],
                   d=dic['d'],
                   ks_h=dic['omega'] * dic['ke'],
                   ks_v=dic['omega'] * dic['ke'],
                   V1=dic['V1'],
                   V2=dic['V2'],
                   A_hh=dic['A_hh'],
                   B_hh=dic['B_hh'],
                   A_vv=dic['A_vv'],
                   B_vv=dic['B_vv'],
                   A_hv=dic['A_hv'],
                   B_hv=dic['B_hv'])

    S = model.RTModel(surface=soil,
                      canopy=can,
                      models=models,
                      theta=dic['theta'],
                      freq=dic['f'])
    S.sigma0()

    return S.__dict__['stot'][pol[::-1]]
Ejemplo n.º 3
0
    def test_scat_isotropic(self):
        # some dummy variables

        stype='turbid_isotropic'

        models = {'surface': 'Oh92', 'canopy': stype}
        eps = 5. -3.j
        soil = Soil(eps=eps, f=5., s=0.02)
        can = OneLayer(ke_h=0.05, ke_v=0.05, d=3., ks_h = 0.02, ks_v = 0.02)
        S = model.SingleScatRT(surface=soil, canopy=can, models=models, theta=self.theta, freq=self.freq)
        S.sigma0()

        models = {'surface': 'Dubois95', 'canopy': stype}
        eps = 5. -3.j

        S = model.SingleScatRT(surface=soil, canopy=can, models=models, theta=self.theta, freq=self.freq)
        S.sigma0()
Ejemplo n.º 4
0
def solve_fun_SSRT(coef):

    # ke = coef * np.sqrt(lai)
    ke = coef * np.sqrt(vwc)

    # initialize surface
    #--------------------
    soil = Soil(mv=sm, C_hh=C_hh, C_vv=C_vv, D_hh=D_hh, D_vv=D_vv, C_hv=C_hv, D_hv=D_hv, V2=lai, s=s, clay=clay, sand=sand, f=freq, bulk=bulk)

    # initialize canopy
    #-------------------
    can = OneLayer(canopy=canopy, ke_h=ke, ke_v=ke, d=d, ks_h = omega*ke, ks_v = omega*ke, V1=lai, V2=lai, A_hh=A_hh, B_hh=B_hh, A_vv=A_vv, B_vv=B_vv, A_hv=A_hv, B_hv=B_hv)

    # run SenSe module
    #------------------
    S = model.RTModel(surface=soil, canopy=can, models=models, theta=theta, freq=freq)
    S.sigma0()

    return S.__dict__['stot'][pol2]
Ejemplo n.º 5
0
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
tau = 2.5
ke = tau / d
omega = 0.27
ks = omega * ke
S = Soil(f=f, s=s, l=l, eps=eps)
C = OneLayer(ke_h=ke, ke_v=ke, d=d, ks_v=ks, ks_h=ks, canopy=models['canopy'])
RT = RTModel(theta=theta, models=models, surface=S, canopy=C, freq=f)
RT.sigma0()

fig = plt.figure()
ax = fig.add_subplot(111)
ax.plot(theta_deg, 10. * np.log10(RT.stot[pol][0]), label='short', color='b')

# tall alfalfa
d = 0.55
tau = 0.45
ke = tau / d
omega = 0.175
ks = omega * ke
S = Soil(f=f, s=s, l=l, eps=eps)
Ejemplo n.º 6
0
# coef = [2.8211794522771836, 3.5425090255370901, 3.2928811420649549, 3.7054736773563386, 2.8961183027242945, 2.6151602913331349, 2.4189863720217848, 2.4167831184418151, 2.9416289237554785, 3.173742070422747, 3.2383792609197575, 2.7931417278929307, 3.1121882936071223, 3.1256520435841559, 3.4783185812129198, 3.221982368854273, 3.3728926537091137, 3.3781506298071911, 3.2569473671053992, 2.4663320815477578, 2.1141754601248004, 2.1209806250929346, 2.0649019533248212, 2.9544567022270387, 3.2224869016201918, 3.2369640163741287, 3.1260764088434825, 2.2886755717903537, 2.444457485088495, 2.4480123008899097, 2.9424868137311013, 2.6918809874287475, 2.7294523688168129, 2.797705352991366, 2.0186456268959168, 2.8744575821617224, 3.044882444109152, 2.9802180637002609, 2.6019756936977609, 2.5503946347668287, 2.3604725553358343, 2.3317510351411883, 1.9275854991156061, 2.2753308530216287, 2.4092428831073858, 2.3698519298054159, 1.9286656987151718, 1.6963728219945839, 2.0918823569585152, 1.9957476741875333, 1.7201838997262218, 1.4695235195381868, 1.5361435193274382, 1.6667889407678251, 0.82853524517534494, 0.79365611796719404, 0.83635432955114541, 0.74755549562741264, 0.52765406146373417, 0.48239419873329636, 0.54280068255034319, 0.5049404990262979, 0.38576228044679073, 0.45119396015499219, 0.5469751828940197, 0.57279234317771832, 0.38171780066089117, 0.34532639205524862, 0.31494432189245669, 0.29321333743882261, 0.17349153645934853, 0.23334377236206902, 0.30119514955623677, 0.35404564503560393]


# ke = coef * np.sqrt(lai_field.values.flatten())
ke = coef * np.sqrt(vwc_field.values.flatten())
# ke = 1.3
# A_vv = np.array(aaa)
# B_vv = np.array(bbb)
# C_vv = np.array(ccc)
# D_vv = np.array(ddd)

# pdb.set_trace()

# initialize surface
#--------------------
soil = Soil(mv=sm_field.values.flatten(), C_hh=C_hh, C_vv=C_vv, D_hh=D_hh, D_vv=D_vv, C_hv=C_hv, D_hv=D_hv, V2=lai_field.values.flatten(), s=s, clay=clay, sand=sand, f=freq, bulk=bulk)

# initialize canopy
#-------------------
can = OneLayer(canopy=canopy, ke_h=ke, ke_v=ke, d=height_field.values.flatten(), ks_h = omega*ke, ks_v = omega*ke, V1=lai_field.values.flatten(), V2=lai_field.values.flatten(), A_hh=A_hh, B_hh=B_hh, A_vv=A_vv, B_vv=B_vv, A_hv=A_hv, B_hv=B_hv)

can = OneLayer(canopy=canopy, ke_h=ke, ke_v=ke, d=height_field.values.flatten(), ks_h = omega*ke, ks_v = omega*ke)

# run SenSe module
#------------------
S = model.RTModel(surface=soil, canopy=can, models=models, theta=theta_field.values.flatten(), freq=freq)
S.sigma0()

# pdb.set_trace()

# Scatterplot
Ejemplo n.º 7
0
import os
import sys

sys.path.append(os.path.abspath(os.path.dirname(__file__)) + os.sep + '..')

from sense.soil import Soil

plt.close('all')

mv = np.linspace(0.001, 0.38)

f = plt.figure()
ax = f.add_subplot(111)

c = 'blue'
S = Soil(sand=0.306, clay=0.135, mv=mv, s=0.01, f=1.4)
ax.plot(mv, np.real(S.eps), color=c)
ax.plot(mv, np.imag(S.eps), color=c, linestyle='--')

c = 'red'
S = Soil(sand=0.306, clay=0.135, mv=mv, s=0.01, f=6.)
ax.plot(mv, np.real(S.eps), color=c)
ax.plot(mv, np.imag(S.eps), color=c, linestyle='--')

c = 'green'
S = Soil(sand=0.306, clay=0.135, mv=mv, s=0.01, f=12.)
ax.plot(mv, np.real(S.eps), color=c)
ax.plot(mv, np.imag(S.eps), color=c, linestyle='--')

c = 'black'
S = Soil(sand=0.306, clay=0.135, mv=mv, s=0.01, f=18.)
Ejemplo n.º 8
0
omega = 0.1

s = 0.02

# canopy
ke = 1.
ks = omega * ke
# ks=0.63
# results strongly depend on the surface scattering model chosen!
# Oh92 gives a much smoother response at low incidence angles compared
# to the Dubois95 model

# shape of ACL would certailny also play an important role!

models = {'surface': 'Oh92', 'canopy': 'turbid_isotropic'}
S = Soil(f=f, s=s, mv=0.2, sand=0.4, clay=0.3, bulk=1.65)

pol = 'vv'

d = np.linspace(0.1, 1)
C = OneLayer(ke_h=ke, ke_v=ke, d=d, ks_v=ks, ks_h=ks, canopy=models['canopy'])
RT = RTModel(theta=theta, models=models, surface=S, canopy=C, freq=f)
RT.sigma0()

fig = plt.figure()
ax = fig.add_subplot(111)

ax.plot(d, 10. * np.log10(RT.stot[pol]), label='STOT', color='k')
ax.plot(d, 10. * np.log10(RT.s0g[pol]), label='SIGGROUND', color='r')
ax.plot(d, 10. * np.log10(RT.s0c[pol]), label='SIG can', color='b')
# ax.plot(d, 10.*np.log10(RT.s0cgt[pol]), label='SIG can ground', color='g')
Ejemplo n.º 9
0
A_hh = 0.02
B_hh = 0.21
A_vv = 0.01
B_vv = 0.03623961
C_hh = -14.8465
C_vv = -19.99992029
D_hh = 15.907
D_vv = 11.06995661

A_vv = 3.40631410e-03
B_vv = 2.00000000e+00
C_vv = 1.99999999e+01
D_vv = 1.00000000e+01

# soil = Soil(eps=eps, f=freq, s=s)
soil = Soil(mv=mv, f=freq, s=s, clay=0.3, sand=0.4)
# soil = Soil(mv=mv, C_hh=C_hh, C_vv=C_vv, D_hh=D_hh, D_vv=D_vv, V2=V2, s=s, clay=0.3, sand=0.4, f=freq)
can = OneLayer(ke_h=ke, ke_v=ke, d=d, ks_h = omega*ke, ks_v = omega*ke)
# can = OneLayer(V1=V1, V2=V2, A_hh=A_hh, B_hh=B_hh, A_vv=A_vv, B_vv=B_vv)
S = model.SingleScatRT(surface=soil, canopy=can, models=models, theta=theta, freq=freq)
# S = model.WaterCloud(surface=soil, canopy=can, models=models, theta=theta, freq=freq)
S.sigma0()
pdb.set_trace()


f = plt.figure()
ax = f.add_subplot(111)
ax.plot(np.rad2deg(S.__dict__['theta']), 10*np.log10(S.__dict__['s0g']['vv']), color='red', linestyle='-', label='vv s0g')
ax.plot(np.rad2deg(S.__dict__['theta']), 10*np.log10(S.__dict__['s0c']['vv']), color='blue', linestyle='-', label='vv s0c')
ax.plot(np.rad2deg(S.__dict__['theta']), 10*np.log10(S.__dict__['s0cgt']['vv']), color='green', linestyle='-', label='vv s0cgt')
# ax.plot(np.rad2deg(S.__dict__['theta']), 10*np.log10(S.__dict__['stot']['vv']), color='black', linestyle='-', label='vv stot')
Ejemplo n.º 10
0
l = 0.1  # m

omega = 0.1

# canopy
ke = 1.
ks = omega * ke
# ks=0.63
# results strongly depend on the surface scattering model chosen!
# Oh92 gives a much smoother response at low incidence angles compared
# to the Dubois95 model

# shape of ACL would certailny also play an important role!

models = {'surface': 'Oh92', 'canopy': 'turbid_rayleigh'}
S = Soil(f=f, s=s, l=l, mv=0.2, sand=0.3, clay=0.3)

pol = 'vv'

d = 0.22
C = OneLayer(ke_h=ke, ke_v=ke, d=d, ks_v=ks, ks_h=ks, canopy=models['canopy'])
RT = RTModel(theta=theta, models=models, surface=S, canopy=C, freq=f)
RT.sigma0()

fig = plt.figure()
ax = fig.add_subplot(111)

ax.plot(theta_deg, 10. * np.log10(RT.stot[pol][0]), label='STOT', color='k')
ax.plot(theta_deg, 10. * np.log10(RT.s0g[pol]), label='SIGGROUND', color='r')
ax.plot(theta_deg, 10. * np.log10(RT.s0c[pol]), label='SIG can', color='b')
ax.plot(theta_deg,
Ejemplo n.º 11
0
 def test_init(self):
     S = Soil(s=self.s, f=self.f, eps=self.eps)
     self.assertEqual(S.ks, S.k * S.s)
Ejemplo n.º 12
0
# pol_field = field_data.filter(like='sigma_sentinel_'+pol)

# C_vv = np.asarray([el[0] for el in aaa])
# D_vv = np.asarray([el[1] for el in aaa])

#-----------------------------------------------------------------

### Run SenSe module
#-----------------------------------------------------------------

soil = Soil(surface=surface,
            mv=sm_field.values.flatten(),
            C_hh=C_hh,
            C_vv=C_vv,
            D_hh=D_hh,
            D_vv=D_vv,
            C_hv=C_hv,
            D_hv=D_hv,
            V2=lai_field.values.flatten())

can = OneLayer(canopy=canopy,
               V1=lai_field.values.flatten(),
               V2=lai_field.values.flatten(),
               A_hh=A_hh,
               B_hh=B_hh,
               A_vv=A_vv,
               B_vv=B_vv,
               A_hv=A_hv,
               B_hv=B_hv)
Ejemplo n.º 13
0
    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]))