Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

handle NaN for ancillary wind #70

Merged
merged 3 commits into from
Jun 24, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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