Closed simedroniraluca closed 12 months ago
Hey @simedroniraluca : Thanks very much for pointing out the bug and sending in the above! I did some investigation and comparison and put the results in this gist. In it I compare the echopy
implementation with the Echoview
one, and an adaption that we'll use in echopype
using flox
.
For the bug in #1136 and the different implementations, it boils down to:
Echoview
NASC in the first implementationechopy
handles NaN samples in Sv data by a scaling, which is probably up for debateechopy
computes ping-by-ping NASC, while Echoview
computes NASC in an average sense across the defined cell depth range and distance rangeTo make compute_NASC
more efficient we are moving away from the looping approach (#1127). I'll send in a separate and incomplete PR in a moment that has the barebone stuff using flox
, which @lsetiawan will carry forward to finish it.
For visibility, here I copy-paste some notes from the gist:
echopy
implementationThe implementation in
echopy
integrated Sv between the range limitsr0
andr1
.There are a few specifics to note:
- if
method="mean"
, the function takes the mean ofsv*sh
and multiply that by the number of vertical samples, and treat this number as the integration output- if
method=""sum
, the function just takes the sum ofsv*sh
to be the integration output- the resulting integrated output is "corrected" by scaling according to the number of valid samples in each column (
distance_nmi
). For example, if there are only 2 non-NaN samples out of 3 total samples along depth, then the integrated outputNASC_raw
is scaled by 3/2:NASC_corrected = NASC_raw / (2/3)
- the code also assumes that the "height" of the samples are conserved across ping, which may not be the case unless the
Sv
data has been regriddedI am not sure about the final correction of the NASC based on the missing non-NaN values. This would result in inflating the NASC number if there are a lot of NaNs in
sv
, and would not be accurate if the goal is to obtainNASC
from maskedSv
dataset.
echopy
vs Echoview
differences
- the Echoview implementation computes NASC in a sense of a mean across multiple pings
- the Echopy implementation computes ping-by-ping NASC with some scaling to compensate for potential NaN samples along depth in some pings
Hey @simedroniraluca: I think we can close this issue and move our discussions to #1167, so that everything is in one place. Thanks again for your contribution!!
NASC (Nautical Area Scattering Coefficient) Computation Correction
This PR is opened to propose a solution for https://github.com/OSOceanAcoustics/echopype/pull/1136
Changes Made:
Conversion Factors: Conversion factors have been incorporated to facilitate the conversion from backscattering cross-section to scattering cross-section and from meters to nautical miles (nmi).
Computation Approach: