Skip to content

Use normalization to compute echo range scaling#1463

Merged
ctuguinay merged 33 commits intoOSOceanAcoustics:mainfrom
ctuguinay:investigate_rotation_matrix_upgrade
Apr 3, 2025
Merged

Use normalization to compute echo range scaling#1463
ctuguinay merged 33 commits intoOSOceanAcoustics:mainfrom
ctuguinay:investigate_rotation_matrix_upgrade

Conversation

@ctuguinay
Copy link
Copy Markdown
Collaborator

@ctuguinay ctuguinay commented Feb 18, 2025

Enforces normalization of beam direction z if normalization of the beam direction vector is not already present. If vector is all zeros, return NaN.

@ctuguinay ctuguinay self-assigned this Feb 18, 2025
@ctuguinay ctuguinay added the bug Something isn't working label Feb 18, 2025
@ctuguinay ctuguinay added this to the v0.9.2 milestone Feb 18, 2025
@ctuguinay ctuguinay changed the title Use align vectors instead of from matrix for a channel-wise rotation Use align vectors for channel-wise rotation Feb 18, 2025
@leewujung leewujung modified the milestones: v0.9.2, v0.10.0, v0.10.1 Feb 18, 2025
@ctuguinay ctuguinay changed the title Use align vectors for channel-wise rotation Use normalization to compute echo range scaling Feb 25, 2025
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Feb 25, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.14%. Comparing base (9f56124) to head (a993c55).
⚠️ Report is 387 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff             @@
##             main    #1463       +/-   ##
===========================================
+ Coverage   83.52%   95.14%   +11.62%     
===========================================
  Files          64        5       -59     
  Lines        5686      309     -5377     
===========================================
- Hits         4749      294     -4455     
+ Misses        937       15      -922     
Flag Coverage Δ
unittests 95.14% <100.00%> (+11.62%) ⬆️

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

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ctuguinay
Copy link
Copy Markdown
Collaborator Author

@leewujung This should be ready for review

@ctuguinay ctuguinay requested a review from leewujung February 25, 2025 01:07
@ctuguinay ctuguinay marked this pull request as ready for review February 25, 2025 01:07
Comment on lines +110 to +111
# For channels with near-zero norm, we return NaN. Otherwise, we return the normalized
# z component.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This statement is reversed, right?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I don't think so since xr.where(norm < tolerance, np.nan, beam_direction_z / norm) will return NaN if norm is small
image

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

oh i know what I read wrong! I read "near-zero" as "non-zero" 😵
This is resolved then!

Comment thread echopype/consolidate/ek_depth_utils.py Outdated
leewujung
leewujung previously approved these changes Apr 3, 2025
Copy link
Copy Markdown
Member

@leewujung leewujung left a comment

Choose a reason for hiding this comment

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

@ctuguinay : Two minor comments, but otherwise this looks great. Feel free to merge once those are addressed!

ctuguinay and others added 9 commits April 3, 2025 14:11
Co-authored-by: Wu-Jung Lee <leewujung@gmail.com>
updates:
- [github.com/PyCQA/flake8: 7.1.1 → 7.1.2](PyCQA/flake8@7.1.1...7.1.2)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
…s ci] (OSOceanAcoustics#1451)

* check if zarr stores > 0

* add a test for echodata delete

* fix path

* add comments for readability

---------

Co-authored-by: Wu-Jung Lee <leewujung@gmail.com>
* dims to sizes

* dims to sizes when using ds.dims

* dims to sizes for test echodata combine
ctuguinay and others added 18 commits April 3, 2025 14:11
…oustics#1454)

* chunks as dictionaries in _get_auto_chunk

* when zarr encoding get chunks as list-like and rename _get_auto_chunk to _get_dask_auto_chunk to show that there is a difference between Dask and Zarr chunking
…ci] (OSOceanAcoustics#1450)

* fix deprecation warning for truth value of an empty array

* change test outcome from True to False when param is missing

* found logic error in checking parameter validity before loading XML

---------

Co-authored-by: Wu-Jung Lee <leewujung@gmail.com>
…stics#1458)

* fill in nan for missing filter coeffs from all channels

* update test_convert_ek80_no_fil_coeff

* remove commented out section

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* cast numpy float array to int

* add compute Sv test

* remove test mark

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: ctuguinay <cmtuguinay2000@gmail.com>
…ll tests ci] (OSOceanAcoustics#1447)

* EP-1420 resolved path issue with ek60_missing_channel_power

* EP-1420 fixed path to use string concatenation

* formatting

* adding conditionals for checking platform nmea and exchange from time1 to time_nmea

* working datatree for v0.9.0 w o calibration

* Drop Ping Time Duplicates (OSOceanAcoustics#1382)

* init commit

* revert change to fix merge conflict

* test only one file

* use other file

* move test duplicate to test convert ek

* add extra line

* move test back to ek80 convert

* pin zarr and add check unique ping time duplicates and tests

* fix test message

* test remove zarr pin

* add back zarr pin

* Fix tests that fail from new Xarray variable and attribute assignment updates (OSOceanAcoustics#1433)

* add .values to change water level scalar value

* add .values to fillna

* fix assign attributes

* remove test1

* update echodata properly

* remove print statement

* Assemble AD2CP timestamp with nanosecond precision (OSOceanAcoustics#1436)

* assemble ad2cp timestamp at ns instead of us

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* add noqa

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>

* Use `import_resources.files` instead of the legacy `open_text` (OSOceanAcoustics#1434)

* use import_resources.files to open yaml files

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* import from importlib.resources

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>

* bump codespell version, add exceptions (OSOceanAcoustics#1438)

* Pin `zarr` and `netcdf4` temporarily [all tests ci] (OSOceanAcoustics#1429)

* pin zarr and netcdf4 in requirements.txt

* change np.alltrue to np.all

* use np.argmin(da.data) instead of da.argmin()

* use S instead s for MVBS ping_time_bin

* extract single element in computing nsamples and L in tapered_chirp

* change from S to s in testing.py

* Add `type-extensions` to requirements.txt (OSOceanAcoustics#1440)

* add type-extensions

* sort requirements.txt

* add manual trigger to pypi workflow (OSOceanAcoustics#1442)

* update cff with ices paper data (OSOceanAcoustics#1443)

* add assign actual range utility function (OSOceanAcoustics#1435)

* chore(deps): bump actions/setup-python from 5.3.0 to 5.4.0 (OSOceanAcoustics#1445)

Bumps [actions/setup-python](https://github.com/actions/setup-python) from 5.3.0 to 5.4.0.
- [Release notes](https://github.com/actions/setup-python/releases)
- [Commits](actions/setup-python@v5.3.0...v5.4.0)

---
updated-dependencies:
- dependency-name: actions/setup-python
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* [pre-commit.ci] pre-commit autoupdate (OSOceanAcoustics#1446)

* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/PyCQA/isort: 5.13.2 → 6.0.0](PyCQA/isort@5.13.2...6.0.0)
- [github.com/psf/black: 24.10.0 → 25.1.0](psf/black@24.10.0...25.1.0)
- [github.com/codespell-project/codespell: v2.4.0 → v2.4.1](codespell-project/codespell@v2.4.0...v2.4.1)

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>

* added pooch and bound the test registry to the echodata test

* EP-1420 added legacy test files >=v0.8.4, created pooch registry, parameterized test

* EP-1420 checked tests

* EP-1420 debugging TestEchoData test failures, test_nbytes, test_setattr, & test_setitem

* EP-1447 troubleshooting bug still

* EP-1420 removed pooch and added normal test path resources

* EP-1420 fixed test_nbytes, commented out test_setattr

* EP-1420 changed "time_nmea" to "nmea_time", added ek80 legacy_datatree tests, fixed readme

* EP-1420 removed import

* trying to add sonar channel_all

* EP-1420 checked sonar for channel and renamed to channel_all

* check legacy data differently

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* remove v0.9.2 zarr test files

* remove test_setattr that is no longer needed, see OSOceanAcoustics#1457 that removes EchoData.__setattr__

* Update echopype/tests/echodata/test_echodata.py

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Caesar Tuguinay <87830138+ctuguinay@users.noreply.github.com>
Co-authored-by: Wu-Jung Lee <leewujung@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* add v0.9.1 and v0.10.0 whats new

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
…SOceanAcoustics#1466)

* update to use python 3.12 and ubuntu 22.04

* update v0.10.0 release notes
…es` [all tests ci] (OSOceanAcoustics#1468)

* replace pkg_resources with importlib.resources

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* remove unused pkg_resources import

* update __name__ to __package__ and use read_text

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* remove unused pkg_resources again

* update whats new

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
…SOceanAcoustics#1430)

Bumps [pypa/gh-action-pypi-publish](https://github.com/pypa/gh-action-pypi-publish) from 1.12.3 to 1.12.4.
- [Release notes](https://github.com/pypa/gh-action-pypi-publish/releases)
- [Commits](pypa/gh-action-pypi-publish@v1.12.3...v1.12.4)

---
updated-dependencies:
- dependency-name: pypa/gh-action-pypi-publish
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…#1469)

Bumps [actions/cache](https://github.com/actions/cache) from 4.2.0 to 4.2.1.
- [Release notes](https://github.com/actions/cache/releases)
- [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md)
- [Commits](actions/cache@v4.2.0...v4.2.1)

---
updated-dependencies:
- dependency-name: actions/cache
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
updates:
- [github.com/PyCQA/isort: 6.0.0 → 6.0.1](PyCQA/isort@6.0.0...6.0.1)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
…#1473)

Bumps [actions/cache](https://github.com/actions/cache) from 4.2.1 to 4.2.2.
- [Release notes](https://github.com/actions/cache/releases)
- [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md)
- [Commits](actions/cache@v4.2.1...v4.2.2)

---
updated-dependencies:
- dependency-name: actions/cache
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…oustics#1481)

Bumps [actions/setup-python](https://github.com/actions/setup-python) from 5.4.0 to 5.5.0.
- [Release notes](https://github.com/actions/setup-python/releases)
- [Commits](actions/setup-python@v5.4.0...v5.5.0)

---
updated-dependencies:
- dependency-name: actions/setup-python
  dependency-version: 5.5.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
updates:
- [github.com/PyCQA/flake8: 7.1.2 → 7.2.0](PyCQA/flake8@7.1.2...7.2.0)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
…#1479)

Bumps [actions/cache](https://github.com/actions/cache) from 4.2.2 to 4.2.3.
- [Release notes](https://github.com/actions/cache/releases)
- [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md)
- [Commits](actions/cache@v4.2.2...v4.2.3)

---
updated-dependencies:
- dependency-name: actions/cache
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* add range var max and reindex to compute_MVBS parameters and drop flox maximum version

* add tests for compute MVBS changes

* add todo for compute NASC

* add np.nan fill value

* Update echopype/commongrid/api.py

Co-authored-by: Wu-Jung Lee <leewujung@gmail.com>

---------

Co-authored-by: Wu-Jung Lee <leewujung@gmail.com>
@review-notebook-app
Copy link
Copy Markdown

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@ctuguinay ctuguinay merged commit b20995b into OSOceanAcoustics:main Apr 3, 2025
5 checks passed
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

No open projects
Status: Done

Development

Successfully merging this pull request may close these issues.

5 participants