Skip to content

Commit

Permalink
restructured canopy
Browse files Browse the repository at this point in the history
  • Loading branch information
bulli92 committed Jun 2, 2017
1 parent 49959ac commit 96b5c19
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
15 changes: 8 additions & 7 deletions sense/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def _check1(self):
assert self.theta is not None, 'ERROR: no incidence angle was specified!'

def sigma0(self, **kwargs):
'''
"""
calculate sigma
Parameters
Expand All @@ -27,7 +27,7 @@ def sigma0(self, **kwargs):
list with polarizations pq
whereas p=receive, q=transmit
p,g can be either H or V
'''
"""

self.dB = kwargs.get('dB', False)
self.pol = kwargs.get('pol', [])
Expand Down Expand Up @@ -148,14 +148,15 @@ def _set_models(self, RT_s, RT_c):


# set canopy models
if RT_c == 'dummy':
if RT_c == 'turbid': # turbid media (homogenous vegetation)
print('Still need to implement the canopy model here')
self.rt_c = CanopyHomoRT(ke_h=self.C.ke_h, ke_v=self.C.ke_v, d=self.C.d, theta=self.theta)
else:
assert False, 'Invalid canopy scattering model'

def _check(self, RT_s, RT_c):
valid_surface = ['Oh92', 'Dubois95']
valid_canopy = ['dummy']
valid_canopy = ['turbid']
assert RT_s in valid_surface, 'ERROR: invalid surface scattering model was chosen!'
assert RT_c in valid_canopy
assert self.theta is not None
Expand All @@ -167,8 +168,8 @@ def sigma(self):
"""

# canopy transmisivities
t_h = self.C.t_h
t_v = self.C.t_v
t_h = self.rt_c.t_h
t_v = self.rt_c.t_v

# backscatter
s_hh = self.rt_s.hh*t_h*t_h
Expand All @@ -182,7 +183,7 @@ def sigma(self):



class CanopyHomo(object):
class CanopyHomoRT(object):
"""
homogeneous canopy
assumes homogeneous vertical distribution of scatterers
Expand Down
8 changes: 4 additions & 4 deletions tests/test_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import numpy as np
from sense import model
from sense.soil import Soil
from sense.model import CanopyHomo
from sense.canopy import OneLayer

class TestModel(unittest.TestCase):
def test_init(self):
Expand All @@ -24,16 +24,16 @@ def test_init(self):

def test_scat(self):
# some dummy variables
models = {'surface': 'Oh92', 'canopy':'dummy'}
models = {'surface': 'Oh92', 'canopy':'turbid'}
eps = 5. -3.j
soil = Soil(eps=eps, f=5., s=0.02)
can = CanopyHomo(ke_h=0.05, ke_v=0.02, d=3., theta=np.arange(1.,80.))
can = OneLayer(ke_h=0.05, ke_v=0.02, d=3.)
S = model.SingleScatRT(surface=soil, canopy=can, models=models, theta=self.theta, freq=self.freq)
S.sigma0()



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

S = model.SingleScatRT(surface=soil, canopy=can, models=models, theta=self.theta, freq=self.freq)
Expand Down

0 comments on commit 96b5c19

Please sign in to comment.