Skip to content

Commit

Permalink
move the conversion of scalar to matrix after layer_echo is complete
Browse files Browse the repository at this point in the history
  • Loading branch information
ghislainp committed Aug 28, 2023
1 parent 79ef5ff commit 5a37533
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions smrt/rtsolver/nadir_lrm_altimetry.py
Original file line number Diff line number Diff line change
Expand Up @@ -317,11 +317,6 @@ def vertical_scattering_distribution(self, return_contributions, mu_i=1.0):
layer_echo = [i.diffuse_reflection_matrix(self.sensor.frequency, eps_1, eps_2,
mu_s=mu, mu_i=mu, dphi=np.pi, npol=2).diagonal[0].squeeze() / eps_1.real
for i, eps_1, eps_2, mu in zip(self.snowpack.interfaces, eps_upper_interface, eps, mu_upper_interface)]

if len(mu_upper_interface[0]) > 1:
# convert the scalar into matrix to get an homogeneous list before transformation to numpy array
layer_echo = [np.full(len(mu_upper_interface[0]), m) if np.isscalar(m) else m for m in layer_echo]

# note that the division by eps_1 takes into account the divergence of the upwelling stream due to refraction

if self.snowpack.substrate is not None:
Expand All @@ -334,6 +329,10 @@ def vertical_scattering_distribution(self, return_contributions, mu_i=1.0):

layer_echo += [np.zeros_like(layer_echo[-1])]

if len(mu_upper_interface[0]) > 1:
# convert the scalar into matrix to get an homogeneous list before transformation to numpy array
layer_echo = [np.full(len(mu_upper_interface[0]), m) if np.isscalar(m) else m for m in layer_echo]

layer_echo = np.transpose(layer_echo)

if len(mu_i) > 1:
Expand Down

0 comments on commit 5a37533

Please sign in to comment.