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

[Data conversion] EA640 files fails to calibrate after upgrading from 0.8.4 to 0.9.0 #1406

Open
torsteinnh opened this issue Nov 7, 2024 · 0 comments

Comments

@torsteinnh
Copy link

General description of problem

After upgrading from 0.8.4 to 0.9.0, by EA640 raw data files fails to compute Sv.
The bug is caused by an oversight in _check_echodata_backscatter_size, where total_nbytes remains unset for all sonar models except for EK60, EK80 and AZFP.

Echopype version

0.9.0

How did you install Echopype (e.g., conda or pip)

pip

What is your operating system

macOS 14.6.1

Minimal code example

import echopype as ep

echo_data = ep.open_raw(raw_file=path, sonar_model="EA640")
echo_data_sv = ep.calibrate.compute_Sv(echo_data, waveform_mode="CW", encode_mode="power")

Error message printouts

Traceback (most recent call last):
  File "/Users/tnh/Documents/workspace/PGS_playground/demos/demo_pgs.py", line 14, in <module>
    echo_data_sv = ep.calibrate.compute_Sv(echo_data, waveform_mode="CW", encode_mode="power")
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/tnh/.virtualenvs/echo-test/lib/python3.11/site-packages/echopype/calibrate/api.py", line 208, in compute_Sv
    return _compute_cal(cal_type="Sv", echodata=echodata, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/tnh/.virtualenvs/echo-test/lib/python3.11/site-packages/echopype/calibrate/api.py", line 62, in _compute_cal
    cal_obj._check_echodata_backscatter_size()
  File "/Users/tnh/.virtualenvs/echo-test/lib/python3.11/site-packages/echopype/calibrate/calibrate_base.py", line 117, in _check_echodata_backscatter_size
    total_gb = total_nbytes / (1024**3)
               ^^^^^^^^^^^^
UnboundLocalError: cannot access local variable 'total_nbytes' where it is not associated with a value
Exception ignored in: <function EchoData.__del__ at 0x168f640e0>
Traceback (most recent call last):
  File "/Users/tnh/.virtualenvs/echo-test/lib/python3.11/site-packages/echopype/echodata/echodata.py", line 105, in __del__
  File "/Users/tnh/.virtualenvs/echo-test/lib/python3.11/site-packages/echopype/echodata/echodata.py", line 81, in cleanup_swap_files
  File "/Users/tnh/.virtualenvs/echo-test/lib/python3.11/site-packages/xarray/core/dataset.py", line 1539, in __getitem__
ModuleNotFoundError: import of xarray.core.formatting halted; None in sys.modules

Process finished with exit code 1

Example data

Data is unfortunately not open to share.

Related existing issues or PRs

I have not seen, pull request will arrive later today.

Troubleshooting steps

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant