Closed leewujung closed 1 year ago
See https://github.com/OSOceanAcoustics/echopype/pull/968#issuecomment-1464282197 for the divide by zero warnings on ek80_bb_complex and ek80_cw_power range tests.
I'm seeing the divide-by-zero error on compute_Sv
with all kinds of raw files, including ek60 from the hake survey. In https://github.com/OSOceanAcoustics/echopype/pull/968#issuecomment-1464282197 I noted it for only those two ek80 tests, but I can now see that when running the full test, pytest
somehow only spits out those warnings after those tests. When running each test individually, all ek tests produce the warning; the azfp test doesn't.
BTW, this warning doesn't happen with 0.6.3.
@leewujung I've isolated the source of these log10 warnings. They're all in calibrate_ek.py
.
tvg_mod_range
can be <= 0 in https://github.com/OSOceanAcoustics/echopype/blob/90e4377e7cb46953bf15d8b57f05ad0ab968d4de/echopype/calibrate/calibrate_ek.py#L68tvg_mod_range
can be <= 0 in https://github.com/OSOceanAcoustics/echopype/blob/90e4377e7cb46953bf15d8b57f05ad0ab968d4de/echopype/calibrate/calibrate_ek.py#L378 and prx
can be <= 0 in https://github.com/OSOceanAcoustics/echopype/blob/90e4377e7cb46953bf15d8b57f05ad0ab968d4de/echopype/calibrate/calibrate_ek.py#L406Strictly speaking, something like this for both tvg_mod_range
and prx
would eliminate the warnings:
x = x.where(x > 0, eps)
where eps
is a very small positive value (eg, 0.00001). But, I don't know what impact that would have on the calculations. On the other hand, those invalid log10
applications must be leading to nan
or -inf
values right now ...
What do you suggest?
Can we close this now? I'm not 100% sure that the exact scope of the issue was addressed by #986
I think this is addressed -- reading the description again I am not sure why data combination has anything to do with the range dimension. But I am glad that the range computation was reviewed/revised when range computation was factored out, and the log10(0) or log10(neg values) warning issue was resolved.
Right now we set all negative
echo_range
to 0 at the end ofcompute_range
, which causes problems when trying to combine datasets (#578) https://github.com/OSOceanAcoustics/echopype/blob/12693a72badcf54a18408e694b72e7b0e6d48023/echopype/echodata/echodata.py#L473This issue is a reminder to review this and change/fix related operations in calibration.