Skip to content

Commit

Permalink
Merge pull request #70 from vincelhx/master
Browse files Browse the repository at this point in the history
handle NaN for ancillary wind
  • Loading branch information
vincelhx authored Jun 24, 2024
2 parents 96fa64f + a74c886 commit 1101b37
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
3 changes: 0 additions & 3 deletions src/xsarsea/windspeed/cmod7.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,6 @@ def _raw_lut(self, **kwargs):
final_dims = ['incidence', 'wspd', 'phi']
coords = {'incidence': inc, 'phi': phi, 'wspd': wspd}

self.wspd_step = 0.2
self.inc_step = 0.2
self.phi_step = 1
self.wspd_range = self.wspd_range_lr
self.inc_range = self.inc_range_lr
self.phi_range = self.phi_range_lr
Expand Down
6 changes: 3 additions & 3 deletions src/xsarsea/windspeed/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ def __init__(self, name, **kwargs):
self.wspd_step_lr = kwargs.pop('wspd_step_lr', 0.4)
self.phi_step_lr = kwargs.pop('phi_step_lr', 2.5)

self.inc_step = kwargs.pop('inc_step', 0.2)
self.wspd_step = kwargs.pop('wspd_step', 0.2)
self.phi_step = kwargs.pop('phi_step', 2)
self.inc_step = kwargs.pop('inc_step', 0.1)
self.wspd_step = kwargs.pop('wspd_step', 0.1)
self.phi_step = kwargs.pop('phi_step', 1)

self.__class__._available_models[name] = self

Expand Down
9 changes: 9 additions & 0 deletions src/xsarsea/windspeed/windspeed.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,13 +182,22 @@ def __invert_from_model_1d(inc_1d, sigma0_co_db_1d, sigma0_cr_db_1d, dsig_cr_1d,
one_sigma0_cr_db = sigma0_cr_db_1d[i]
one_dsig_cr = dsig_cr_1d[i]
one_ancillary_wind = ancillary_wind_1d[i]

#  if incidence is NaN ; all output is NaN
if np.isnan(one_inc):
out_co[i] = np.nan
out_cr[i] = np.nan
continue

#  if ancillary is NaN, copol & dualpol are NaN
if (not np.isnan(np.abs(one_sigma0_co_db)) and np.isnan(np.abs(one_ancillary_wind))):
out_co[i] = np.nan
out_cr[i] = np.nan
continue

if not np.isnan(one_sigma0_co_db):
# copol inversion available

i_inc = np.argmin(np.abs(np_inc_dim-one_inc))
np_sigma0_co_lut_db_inc = np_sigma0_co_lut_db[:, :, i_inc]

Expand Down

0 comments on commit 1101b37

Please sign in to comment.