Skip to content

Commit

Permalink
solve a bug with inhomogeneous snowpack
Browse files Browse the repository at this point in the history
  • Loading branch information
ghislainp committed Aug 15, 2023
1 parent e75e83c commit 4c57705
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion smrt/rtsolver/nadir_lrm_altimetry.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,10 @@ def vertical_scattering_distribution(self, return_contributions, mu_i=1.0):
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 @@ -326,7 +330,8 @@ def vertical_scattering_distribution(self, return_contributions, mu_i=1.0):
self.sensor.frequency, eps[-1],
mu_s=mu2, mu_i=mu2, dphi=np.pi, npol=2).diagonal[0].squeeze() / eps[-1].real]
else:
# not echo from the bottom
# no echo from the bottom

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

layer_echo = np.transpose(layer_echo)
Expand Down

0 comments on commit 4c57705

Please sign in to comment.