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

Change isel to sel to fix compute_Sv #828

Merged
merged 1 commit into from
Oct 6, 2022

Conversation

lsetiawan
Copy link
Member

@lsetiawan lsetiawan commented Oct 4, 2022

This PR adress #824 (comment) where idxmin is actually xarray data array object not integers, so isel doesn't work.

@codecov-commenter
Copy link

codecov-commenter commented Oct 4, 2022

Codecov Report

Merging #828 (c1eeac6) into dev (76e7d28) will increase coverage by 9.72%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##              dev     #828      +/-   ##
==========================================
+ Coverage   83.09%   92.81%   +9.72%     
==========================================
  Files          52        5      -47     
  Lines        4915      543    -4372     
==========================================
- Hits         4084      504    -3580     
+ Misses        831       39     -792     
Flag Coverage Δ
unittests 92.81% <100.00%> (+9.72%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
echopype/calibrate/calibrate_ek.py 93.61% <100.00%> (-0.71%) ⬇️
echopype/calibrate/env_params.py 89.47% <0.00%> (-3.51%) ⬇️
echopype/convert/parse_ek60.py
echopype/convert/set_groups_azfp.py
echopype/convert/parsed_to_zarr_ek60.py
echopype/echodata/widgets/utils.py
echopype/echodata/__init__.py
echopype/convert/utils/ek_raw_io.py
echopype/echodata/api.py
... and 40 more

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@lsetiawan lsetiawan requested a review from b-reyes October 4, 2022 22:28
@b-reyes
Copy link
Contributor

b-reyes commented Oct 5, 2022

@lsetiawan from my understanding, we should replace all isel operations on something that could potentially be a Dask array. Searching through just the calibrate folder, I found a couple of other occurrences of isel. Could you look into the following occurrences and determine if they also need to be changed?

  • In calibrate_ek.py Line 852: return out.isel(beam=0).drop("beam")
  • In env_params.py Line 146: extrap = extrap.isel(**extrap_unique_idx)
  • In env_params.py Line 152: interp = interp.isel(**interp_unique_idx)

@@ -94,7 +94,7 @@ def _get_vend_cal_params_power(self, param, waveform_mode):
)

# Select corresponding index and clean up the original nan elements
da_param = da_param.isel(pulse_length_bin=idxmin, drop=True)
da_param = da_param.sel(pulse_length_bin=idxmin, drop=True)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I looked into this change and everything looks good.

@lsetiawan lsetiawan added this to the 0.6.3 milestone Oct 5, 2022
@lsetiawan lsetiawan added the bug Something isn't working label Oct 5, 2022
@lsetiawan
Copy link
Member Author

In calibrate_ek.py Line 852: return out.isel(beam=0).drop("beam")

For this one, the value is clearly 0 so isel is appropriate, I'll take look at the other files.

@lsetiawan
Copy link
Member Author

In env_params.py Line 146: extrap = extrap.isel(**extrap_unique_idx)
In env_params.py Line 152: interp = interp.isel(**interp_unique_idx)

For these two, I'm not sure how to check for these, I'm not familiar enough with the env_params module. @leewujung I need your guidance on this. Thanks.

@b-reyes
Copy link
Contributor

b-reyes commented Oct 5, 2022

For this one, the value is clearly 0 so isel is appropriate, I'll take look at the other files.

Yes, I understand that isel would be appropriate here. However, from my understanding, if out is referring to a Dask array then out.isel will not work. Here, I think we are just trying to drop any lingering beam dimension. So, one could just find the first value in the beam dimension and use this value to replace isel with sel.

Copy link
Contributor

@b-reyes b-reyes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everything looks good!

@lsetiawan lsetiawan merged commit aff567b into OSOceanAcoustics:dev Oct 6, 2022
@lsetiawan lsetiawan deleted the fix_csv branch October 6, 2022 16:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants