oceanstream-echopype 0.11.1a3__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- _echopype_version.py +1 -0
- echopype/__init__.py +33 -0
- echopype/calibrate/__init__.py +3 -0
- echopype/calibrate/api.py +424 -0
- echopype/calibrate/cal_params.py +522 -0
- echopype/calibrate/calibrate_azfp.py +117 -0
- echopype/calibrate/calibrate_base.py +128 -0
- echopype/calibrate/calibrate_ek.py +672 -0
- echopype/calibrate/ecs.py +475 -0
- echopype/calibrate/ek80_complex.py +414 -0
- echopype/calibrate/env_params.py +363 -0
- echopype/calibrate/env_params_old.py +205 -0
- echopype/calibrate/gpu_cal.py +204 -0
- echopype/calibrate/range.py +236 -0
- echopype/clean/__init__.py +17 -0
- echopype/clean/api.py +717 -0
- echopype/clean/gpu_noise_est.py +161 -0
- echopype/clean/noise_est.py +134 -0
- echopype/clean/transient_noise/transient_fielding.py +235 -0
- echopype/clean/transient_noise/transient_matecho.py +287 -0
- echopype/clean/utils.py +402 -0
- echopype/colormap/__init__.py +9 -0
- echopype/colormap/cm.py +83 -0
- echopype/commongrid/__init__.py +7 -0
- echopype/commongrid/api.py +527 -0
- echopype/commongrid/gpu_mvbs.py +172 -0
- echopype/commongrid/utils.py +697 -0
- echopype/consolidate/__init__.py +3 -0
- echopype/consolidate/api.py +540 -0
- echopype/consolidate/ek_depth_utils.py +112 -0
- echopype/consolidate/loc_utils.py +159 -0
- echopype/consolidate/split_beam_angle.py +277 -0
- echopype/convert/__init__.py +23 -0
- echopype/convert/ad2cp_fields.yaml +1307 -0
- echopype/convert/api.py +946 -0
- echopype/convert/from_ping_data.py +720 -0
- echopype/convert/parse_ad2cp.py +1856 -0
- echopype/convert/parse_azfp.py +582 -0
- echopype/convert/parse_azfp6.py +698 -0
- echopype/convert/parse_base.py +716 -0
- echopype/convert/parse_ek60.py +16 -0
- echopype/convert/parse_ek80.py +17 -0
- echopype/convert/set_groups_ad2cp.py +532 -0
- echopype/convert/set_groups_azfp.py +860 -0
- echopype/convert/set_groups_azfp6.py +746 -0
- echopype/convert/set_groups_base.py +531 -0
- echopype/convert/set_groups_ek60.py +779 -0
- echopype/convert/set_groups_ek80.py +1462 -0
- echopype/convert/utils/__init__.py +0 -0
- echopype/convert/utils/ek_date_conversion.py +163 -0
- echopype/convert/utils/ek_duplicates.py +44 -0
- echopype/convert/utils/ek_raw_io.py +679 -0
- echopype/convert/utils/ek_raw_parsers.py +1817 -0
- echopype/convert/utils/ek_swap.py +93 -0
- echopype/core.py +111 -0
- echopype/echodata/__init__.py +9 -0
- echopype/echodata/api.py +134 -0
- echopype/echodata/combine.py +976 -0
- echopype/echodata/convention/1.0.yml +160 -0
- echopype/echodata/convention/__init__.py +6 -0
- echopype/echodata/convention/conv.py +29 -0
- echopype/echodata/convention/utils.py +16 -0
- echopype/echodata/echodata.py +748 -0
- echopype/echodata/sensor_ep_version_mapping/ep_version_mapper.py +30 -0
- echopype/echodata/sensor_ep_version_mapping/v05x_to_v06x.py +1156 -0
- echopype/echodata/simrad.py +230 -0
- echopype/echodata/utils_platform.py +143 -0
- echopype/echodata/widgets/__init__.py +0 -0
- echopype/echodata/widgets/static/css/style.css +360 -0
- echopype/echodata/widgets/static/html/icons-svg-inline.html +15 -0
- echopype/echodata/widgets/templates/echodata.html.j2 +44 -0
- echopype/echodata/widgets/templates/style.html.j2 +1 -0
- echopype/echodata/widgets/utils.py +74 -0
- echopype/echodata/widgets/widgets.py +56 -0
- echopype/mask/__init__.py +3 -0
- echopype/mask/api.py +801 -0
- echopype/mask/freq_diff.py +148 -0
- echopype/mask/gpu_mask.py +173 -0
- echopype/mask/seafloor_detection/bottom_basic.py +100 -0
- echopype/mask/seafloor_detection/bottom_blackwell.py +173 -0
- echopype/mask/seafloor_detection/utils.py +64 -0
- echopype/mask/shoal_detection/shoal_echoview.py +144 -0
- echopype/mask/shoal_detection/shoal_weill.py +160 -0
- echopype/metrics/__init__.py +13 -0
- echopype/metrics/summary_statistics.py +151 -0
- echopype/qc/__init__.py +3 -0
- echopype/qc/api.py +267 -0
- echopype/utils/__init__.py +0 -0
- echopype/utils/align.py +61 -0
- echopype/utils/coding.py +303 -0
- echopype/utils/compute.py +53 -0
- echopype/utils/gpu.py +241 -0
- echopype/utils/io.py +508 -0
- echopype/utils/log.py +115 -0
- echopype/utils/misc.py +87 -0
- echopype/utils/prov.py +331 -0
- echopype/utils/uwa.py +189 -0
- oceanstream_echopype-0.11.1a3.dist-info/METADATA +216 -0
- oceanstream_echopype-0.11.1a3.dist-info/RECORD +102 -0
- oceanstream_echopype-0.11.1a3.dist-info/WHEEL +5 -0
- oceanstream_echopype-0.11.1a3.dist-info/licenses/LICENSE +201 -0
- oceanstream_echopype-0.11.1a3.dist-info/top_level.txt +2 -0
_echopype_version.py
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
version = "0.11.1a3" # noqa
|
echopype/__init__.py
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
from __future__ import absolute_import, division, print_function
|
|
2
|
+
|
|
3
|
+
from _echopype_version import version as __version__ # noqa
|
|
4
|
+
|
|
5
|
+
from . import calibrate, clean, commongrid, consolidate, mask, utils
|
|
6
|
+
from .convert.api import open_raw, open_raw_multi
|
|
7
|
+
from .convert.from_ping_data import PingAccumulator, from_ping_data
|
|
8
|
+
from .echodata.api import open_converted
|
|
9
|
+
from .echodata.combine import combine_echodata
|
|
10
|
+
from .utils.io import init_ep_dir
|
|
11
|
+
from .utils.log import verbose
|
|
12
|
+
|
|
13
|
+
# Turn off verbosity for echopype
|
|
14
|
+
verbose(override=True)
|
|
15
|
+
|
|
16
|
+
init_ep_dir()
|
|
17
|
+
|
|
18
|
+
__all__ = [
|
|
19
|
+
"calibrate",
|
|
20
|
+
"clean",
|
|
21
|
+
"combine_echodata",
|
|
22
|
+
"commongrid",
|
|
23
|
+
"consolidate",
|
|
24
|
+
"from_ping_data",
|
|
25
|
+
"mask",
|
|
26
|
+
"metrics",
|
|
27
|
+
"open_converted",
|
|
28
|
+
"open_raw",
|
|
29
|
+
"open_raw_multi",
|
|
30
|
+
"PingAccumulator",
|
|
31
|
+
"utils",
|
|
32
|
+
"verbose",
|
|
33
|
+
]
|
|
@@ -0,0 +1,424 @@
|
|
|
1
|
+
import numpy as np
|
|
2
|
+
import xarray as xr
|
|
3
|
+
|
|
4
|
+
from ..echodata import EchoData
|
|
5
|
+
from ..echodata.simrad import check_input_args_combination
|
|
6
|
+
from ..utils.log import _init_logger
|
|
7
|
+
from ..utils.prov import echopype_prov_attrs, source_files_vars
|
|
8
|
+
from .calibrate_azfp import CalibrateAZFP
|
|
9
|
+
from .calibrate_ek import CalibrateEK60, CalibrateEK80
|
|
10
|
+
|
|
11
|
+
CALIBRATOR = {
|
|
12
|
+
"EK60": CalibrateEK60,
|
|
13
|
+
"EK80": CalibrateEK80,
|
|
14
|
+
"AZFP": CalibrateAZFP,
|
|
15
|
+
"ES70": CalibrateEK60,
|
|
16
|
+
"ES80": CalibrateEK80,
|
|
17
|
+
"EA640": CalibrateEK80,
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
logger = _init_logger(__name__)
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def _to_vec(da, ch_idx, n_pings):
|
|
24
|
+
"""Extract a 1-D ``(n_pings,)`` float64 vector from an xarray DataArray.
|
|
25
|
+
|
|
26
|
+
Handles DataArrays with or without a ``channel`` dimension and varying
|
|
27
|
+
dim order (e.g. ``transmit_power`` is ``(channel, ping_time)``).
|
|
28
|
+
"""
|
|
29
|
+
if "channel" in da.dims:
|
|
30
|
+
v = da.isel(channel=ch_idx)
|
|
31
|
+
else:
|
|
32
|
+
v = da
|
|
33
|
+
val = np.atleast_1d(v.values.ravel()).astype(np.float64)
|
|
34
|
+
if val.size == 1:
|
|
35
|
+
val = np.full(n_pings, val[0])
|
|
36
|
+
return val
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
def _compute_sv_gpu_ek80(echodata, cal_obj):
|
|
40
|
+
"""GPU-accelerated Sv for EK80 CW complex mode.
|
|
41
|
+
|
|
42
|
+
Uses the already-initialised *cal_obj* (``CalibrateEK80``) to read
|
|
43
|
+
calibration parameters, then computes Sv per channel on GPU via
|
|
44
|
+
:func:`~echopype.calibrate.gpu_cal.compute_sv_from_complex_gpu`.
|
|
45
|
+
|
|
46
|
+
Returns an ``xr.Dataset`` with the same structure as the standard path.
|
|
47
|
+
"""
|
|
48
|
+
from .ek80_complex import get_filter_coeff, get_tau_effective, get_transmit_signal
|
|
49
|
+
from .gpu_cal import compute_sv_from_complex_gpu
|
|
50
|
+
from .range import range_mod_TVG_EK
|
|
51
|
+
|
|
52
|
+
beam = echodata[cal_obj.ed_beam_group].sel(channel=cal_obj.chan_sel)
|
|
53
|
+
vend = echodata["Vendor_specific"].sel(channel=cal_obj.chan_sel)
|
|
54
|
+
|
|
55
|
+
# Calibration scalars
|
|
56
|
+
z_et = float(cal_obj.cal_params["impedance_transducer"].values.flat[0])
|
|
57
|
+
z_er = float(cal_obj.cal_params["impedance_transceiver"].values.flat[0])
|
|
58
|
+
n_beams = int(beam["beam"].size)
|
|
59
|
+
|
|
60
|
+
sound_speed_da = cal_obj.env_params["sound_speed"]
|
|
61
|
+
absorption_da = cal_obj.env_params["sound_absorption"]
|
|
62
|
+
range_meter = cal_obj.range_meter
|
|
63
|
+
tvg_mod = range_mod_TVG_EK(echodata, cal_obj.ed_beam_group, range_meter, sound_speed_da)
|
|
64
|
+
|
|
65
|
+
# Effective pulse length
|
|
66
|
+
tx_coeff = get_filter_coeff(vend)
|
|
67
|
+
fs = cal_obj.cal_params["receiver_sampling_frequency"]
|
|
68
|
+
tx, tx_time = get_transmit_signal(beam, tx_coeff, "CW", fs)
|
|
69
|
+
tau_eff = get_tau_effective(
|
|
70
|
+
ytx_dict=tx,
|
|
71
|
+
fs_deci_dict={k: 1 / np.diff(v[:2]) for (k, v) in tx_time.items()},
|
|
72
|
+
waveform_mode="CW",
|
|
73
|
+
channel=cal_obj.chan_sel,
|
|
74
|
+
ping_time=beam["ping_time"],
|
|
75
|
+
)
|
|
76
|
+
ch_GPT = (vend["transceiver_type"] == "GPT").compute()
|
|
77
|
+
tau_eff[ch_GPT] = beam["transmit_duration_nominal"][ch_GPT].isel(ping_time=0)
|
|
78
|
+
|
|
79
|
+
# Per-channel GPU Sv
|
|
80
|
+
n_channels = beam.sizes["channel"]
|
|
81
|
+
n_pings = beam.sizes["ping_time"]
|
|
82
|
+
n_range = beam.sizes["range_sample"]
|
|
83
|
+
sv_all = np.empty((n_channels, n_pings, n_range), dtype=np.float64)
|
|
84
|
+
|
|
85
|
+
for ch in range(n_channels):
|
|
86
|
+
sv_all[ch] = compute_sv_from_complex_gpu(
|
|
87
|
+
beam["backscatter_r"].isel(channel=ch).values,
|
|
88
|
+
beam["backscatter_i"].isel(channel=ch).values,
|
|
89
|
+
tvg_mod.isel(channel=ch).values,
|
|
90
|
+
_to_vec(sound_speed_da, ch, n_pings),
|
|
91
|
+
_to_vec(absorption_da, ch, n_pings),
|
|
92
|
+
_to_vec(cal_obj.freq_center, ch, n_pings),
|
|
93
|
+
_to_vec(beam["transmit_power"], ch, n_pings),
|
|
94
|
+
_to_vec(cal_obj.cal_params["gain_correction"], ch, n_pings),
|
|
95
|
+
_to_vec(cal_obj.cal_params["equivalent_beam_angle"], ch, n_pings),
|
|
96
|
+
_to_vec(cal_obj.cal_params["sa_correction"], ch, n_pings),
|
|
97
|
+
_to_vec(tau_eff, ch, n_pings),
|
|
98
|
+
z_et, z_er, n_beams,
|
|
99
|
+
)
|
|
100
|
+
|
|
101
|
+
# Assemble output Dataset matching the standard calibration format
|
|
102
|
+
sv_da = xr.DataArray(
|
|
103
|
+
sv_all,
|
|
104
|
+
dims=["channel", "ping_time", "range_sample"],
|
|
105
|
+
coords={
|
|
106
|
+
"channel": beam["channel"],
|
|
107
|
+
"ping_time": beam["ping_time"],
|
|
108
|
+
"range_sample": beam["range_sample"],
|
|
109
|
+
},
|
|
110
|
+
name="Sv",
|
|
111
|
+
)
|
|
112
|
+
ds = sv_da.to_dataset()
|
|
113
|
+
ds = ds.merge(range_meter)
|
|
114
|
+
ds["frequency_nominal"] = beam["frequency_nominal"]
|
|
115
|
+
ds = cal_obj._add_params_to_output(ds)
|
|
116
|
+
|
|
117
|
+
return ds
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
def _compute_cal(
|
|
121
|
+
cal_type,
|
|
122
|
+
echodata: EchoData,
|
|
123
|
+
env_params=None,
|
|
124
|
+
cal_params=None,
|
|
125
|
+
ecs_file=None,
|
|
126
|
+
waveform_mode=None,
|
|
127
|
+
encode_mode=None,
|
|
128
|
+
use_gpu="auto",
|
|
129
|
+
):
|
|
130
|
+
# Make waveform_mode "FM" equivalent to "BB"
|
|
131
|
+
waveform_mode = "BB" if waveform_mode == "FM" else waveform_mode
|
|
132
|
+
|
|
133
|
+
# Check on waveform_mode and encode_mode inputs
|
|
134
|
+
if echodata.sonar_model == "EK80":
|
|
135
|
+
if waveform_mode is None or encode_mode is None:
|
|
136
|
+
raise ValueError("waveform_mode and encode_mode must be specified for EK80 calibration")
|
|
137
|
+
check_input_args_combination(waveform_mode=waveform_mode, encode_mode=encode_mode)
|
|
138
|
+
elif echodata.sonar_model in ("EK60", "AZFP"):
|
|
139
|
+
if waveform_mode is not None and waveform_mode != "CW":
|
|
140
|
+
logger.warning(
|
|
141
|
+
"This sonar model transmits only narrowband signals (waveform_mode='CW'). "
|
|
142
|
+
"Calibration will be in CW mode",
|
|
143
|
+
)
|
|
144
|
+
if encode_mode is not None and encode_mode != "power":
|
|
145
|
+
logger.warning(
|
|
146
|
+
"This sonar model only record data as power or power/angle samples "
|
|
147
|
+
"(encode_mode='power'). Calibration will be done on the power samples.",
|
|
148
|
+
)
|
|
149
|
+
|
|
150
|
+
# Set up calibration object
|
|
151
|
+
cal_obj = CALIBRATOR[echodata.sonar_model](
|
|
152
|
+
echodata,
|
|
153
|
+
env_params=env_params,
|
|
154
|
+
cal_params=cal_params,
|
|
155
|
+
ecs_file=ecs_file,
|
|
156
|
+
waveform_mode=waveform_mode,
|
|
157
|
+
encode_mode=encode_mode,
|
|
158
|
+
)
|
|
159
|
+
|
|
160
|
+
# Check Echodata Backscatter Size
|
|
161
|
+
cal_obj._check_echodata_backscatter_size()
|
|
162
|
+
|
|
163
|
+
# Perform calibration — optionally via GPU
|
|
164
|
+
from ..utils.gpu import resolve_use_gpu
|
|
165
|
+
|
|
166
|
+
_do_gpu = resolve_use_gpu(use_gpu)
|
|
167
|
+
if (
|
|
168
|
+
_do_gpu
|
|
169
|
+
and cal_type == "Sv"
|
|
170
|
+
and echodata.sonar_model in ("EK80", "ES80", "EA640")
|
|
171
|
+
and waveform_mode == "CW"
|
|
172
|
+
and encode_mode == "complex"
|
|
173
|
+
):
|
|
174
|
+
cal_ds = _compute_sv_gpu_ek80(echodata, cal_obj)
|
|
175
|
+
logger.info("compute_Sv: used GPU path (EK80 CW complex)")
|
|
176
|
+
elif cal_type == "Sv":
|
|
177
|
+
cal_ds = cal_obj.compute_Sv()
|
|
178
|
+
elif cal_type == "TS":
|
|
179
|
+
cal_ds = cal_obj.compute_TS()
|
|
180
|
+
else:
|
|
181
|
+
raise ValueError("cal_type must be Sv or TS")
|
|
182
|
+
|
|
183
|
+
# Add attributes
|
|
184
|
+
def add_attrs(cal_type, ds):
|
|
185
|
+
"""Add attributes to backscattering strength dataset.
|
|
186
|
+
cal_type: Sv or TS
|
|
187
|
+
"""
|
|
188
|
+
ds["range_sample"].attrs = {"long_name": "Along-range sample number, base 0"}
|
|
189
|
+
ds["echo_range"].attrs = {"long_name": "Range distance", "units": "m"}
|
|
190
|
+
ds[cal_type].attrs = {
|
|
191
|
+
"long_name": {
|
|
192
|
+
"Sv": "Volume backscattering strength (Sv re 1 m-1)",
|
|
193
|
+
"TS": "Target strength (TS re 1 m^2)",
|
|
194
|
+
}[cal_type],
|
|
195
|
+
"units": "dB",
|
|
196
|
+
}
|
|
197
|
+
if echodata.sonar_model == "EK80":
|
|
198
|
+
ds[cal_type] = ds[cal_type].assign_attrs(
|
|
199
|
+
{
|
|
200
|
+
"waveform_mode": waveform_mode,
|
|
201
|
+
"encode_mode": encode_mode,
|
|
202
|
+
}
|
|
203
|
+
)
|
|
204
|
+
|
|
205
|
+
add_attrs(cal_type, cal_ds)
|
|
206
|
+
|
|
207
|
+
# Add provinance
|
|
208
|
+
# Provenance source files may originate from raw files (echodata.source_files)
|
|
209
|
+
# or converted files (echodata.converted_raw_path)
|
|
210
|
+
if echodata.source_file is not None:
|
|
211
|
+
source_file = echodata.source_file
|
|
212
|
+
elif echodata.converted_raw_path is not None:
|
|
213
|
+
source_file = echodata.converted_raw_path
|
|
214
|
+
else:
|
|
215
|
+
source_file = "SOURCE FILE NOT IDENTIFIED"
|
|
216
|
+
|
|
217
|
+
prov_dict = echopype_prov_attrs(process_type="processing")
|
|
218
|
+
prov_dict["processing_function"] = f"calibrate.compute_{cal_type}"
|
|
219
|
+
files_vars = source_files_vars(source_file)
|
|
220
|
+
cal_ds = (
|
|
221
|
+
cal_ds.assign(**files_vars["source_files_var"])
|
|
222
|
+
.assign_coords(**files_vars["source_files_coord"])
|
|
223
|
+
.assign_attrs(prov_dict)
|
|
224
|
+
)
|
|
225
|
+
|
|
226
|
+
# Add water_level to the created xr.Dataset
|
|
227
|
+
if "water_level" in echodata["Platform"].data_vars.keys():
|
|
228
|
+
cal_ds["water_level"] = echodata["Platform"].water_level
|
|
229
|
+
|
|
230
|
+
return cal_ds
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
def compute_Sv(echodata: EchoData, use_gpu="auto", **kwargs) -> xr.Dataset:
|
|
234
|
+
"""
|
|
235
|
+
Compute volume backscattering strength (Sv) from raw data.
|
|
236
|
+
|
|
237
|
+
The calibration routine varies depending on the sonar type.
|
|
238
|
+
Currently this operation is supported for the following ``sonar_model``:
|
|
239
|
+
EK60, AZFP, EK80 (see Notes below for detail).
|
|
240
|
+
|
|
241
|
+
Parameters
|
|
242
|
+
----------
|
|
243
|
+
echodata : EchoData
|
|
244
|
+
An `EchoData` object created by using `open_raw` or `open_converted`
|
|
245
|
+
|
|
246
|
+
use_gpu : bool or {"auto"}, default "auto"
|
|
247
|
+
GPU acceleration strategy:
|
|
248
|
+
|
|
249
|
+
* ``"auto"`` — use GPU when CuPy + CUDA are available (transparent).
|
|
250
|
+
* ``True`` — require GPU; raises ``RuntimeError`` if unavailable.
|
|
251
|
+
* ``False`` — force CPU-only computation.
|
|
252
|
+
|
|
253
|
+
Currently GPU-accelerated for EK80/ES80/EA640 with
|
|
254
|
+
``waveform_mode="CW"`` and ``encode_mode="complex"``.
|
|
255
|
+
|
|
256
|
+
env_params : dict, optional
|
|
257
|
+
Environmental parameters needed for calibration.
|
|
258
|
+
Users can supply `"sound speed"` and `"absorption"` directly,
|
|
259
|
+
or specify other variables that can be used to compute them,
|
|
260
|
+
including `"temperature"`, `"salinity"`, and `"pressure"`.
|
|
261
|
+
|
|
262
|
+
For EK60 and EK80 echosounders, by default echopype uses
|
|
263
|
+
environmental variables stored in the data files.
|
|
264
|
+
For AZFP echosounder, all environmental parameters need to be supplied.
|
|
265
|
+
AZFP echosounders typically are equipped with an internal temperature
|
|
266
|
+
sensor, and some are equipped with a pressure sensor, but automatically
|
|
267
|
+
using these pressure data is not currently supported.
|
|
268
|
+
|
|
269
|
+
cal_params : dict, optional
|
|
270
|
+
Intrument-dependent calibration parameters.
|
|
271
|
+
|
|
272
|
+
For EK60, EK80, and AZFP echosounders, by default echopype uses
|
|
273
|
+
environmental variables stored in the data files.
|
|
274
|
+
Users can optionally pass in custom values shown below.
|
|
275
|
+
|
|
276
|
+
- for EK60 echosounder, allowed parameters include:
|
|
277
|
+
`"sa_correction"`, `"gain_correction"`, `"equivalent_beam_angle"`
|
|
278
|
+
- for AZFP echosounder, allowed parameters include:
|
|
279
|
+
`"EL"`, `"DS"`, `"TVR"`, `"VTX0"`, `"equivalent_beam_angle"`, `"Sv_offset"`
|
|
280
|
+
|
|
281
|
+
Passing in calibration parameters for other echosounders
|
|
282
|
+
are not currently supported.
|
|
283
|
+
|
|
284
|
+
waveform_mode : {"CW", "BB", "FM"}, optional
|
|
285
|
+
Type of transmit waveform.
|
|
286
|
+
Required only for data from the EK80 echosounder
|
|
287
|
+
and not used with any other echosounder.
|
|
288
|
+
|
|
289
|
+
- `"CW"` for narrowband transmission,
|
|
290
|
+
returned echoes recorded either as complex or power/angle samples
|
|
291
|
+
- `"BB"` or `"FM"` for broadband transmission,
|
|
292
|
+
returned echoes recorded as complex samples
|
|
293
|
+
|
|
294
|
+
encode_mode : {"complex", "power"}, optional
|
|
295
|
+
Type of encoded return echo data.
|
|
296
|
+
Required only for data from the EK80 echosounder
|
|
297
|
+
and not used with any other echosounder.
|
|
298
|
+
|
|
299
|
+
- `"complex"` for complex samples
|
|
300
|
+
- `"power"` for power/angle samples, only allowed when
|
|
301
|
+
the echosounder is configured for narrowband transmission
|
|
302
|
+
|
|
303
|
+
Returns
|
|
304
|
+
-------
|
|
305
|
+
xr.Dataset
|
|
306
|
+
The calibrated Sv dataset, including calibration parameters
|
|
307
|
+
and environmental variables used in the calibration operations.
|
|
308
|
+
|
|
309
|
+
Notes
|
|
310
|
+
-----
|
|
311
|
+
The EK80 echosounder can be configured to transmit
|
|
312
|
+
either broadband/frequency modulated (``waveform_mode="BB"`` or ``waveform_mode="FM"``)
|
|
313
|
+
or narrowband (``waveform_mode="CW"``) signals.
|
|
314
|
+
When transmitting in broadband mode, the returned echoes are
|
|
315
|
+
encoded as complex samples (``encode_mode="complex"``).
|
|
316
|
+
When transmitting in narrowband mode, the returned echoes can be encoded
|
|
317
|
+
either as complex samples (``encode_mode="complex"``)
|
|
318
|
+
or as power/angle combinations (``encode_mode="power"``) in a format
|
|
319
|
+
similar to those recorded by EK60 echosounders.
|
|
320
|
+
|
|
321
|
+
The current calibration implemented for EK80 broadband complex data
|
|
322
|
+
uses band-integrated Sv with the gain computed at the center frequency
|
|
323
|
+
of the transmit signal.
|
|
324
|
+
|
|
325
|
+
The returned xr.Dataset will contain the variable `water_level` from the
|
|
326
|
+
EchoData object provided, if it exists. If `water_level` is not returned,
|
|
327
|
+
it must be set using `EchoData.update_platform()`.
|
|
328
|
+
"""
|
|
329
|
+
return _compute_cal(cal_type="Sv", echodata=echodata, use_gpu=use_gpu, **kwargs)
|
|
330
|
+
|
|
331
|
+
|
|
332
|
+
def compute_TS(echodata: EchoData, **kwargs):
|
|
333
|
+
"""
|
|
334
|
+
Compute target strength (TS) from raw data.
|
|
335
|
+
|
|
336
|
+
The calibration routine varies depending on the sonar type.
|
|
337
|
+
Currently this operation is supported for the following ``sonar_model``:
|
|
338
|
+
EK60, AZFP, EK80 (see Notes below for detail).
|
|
339
|
+
|
|
340
|
+
Parameters
|
|
341
|
+
----------
|
|
342
|
+
echodata : EchoData
|
|
343
|
+
An `EchoData` object created by using `open_raw` or `open_converted`
|
|
344
|
+
|
|
345
|
+
env_params : dict, optional
|
|
346
|
+
Environmental parameters needed for calibration.
|
|
347
|
+
Users can supply `"sound speed"` and `"absorption"` directly,
|
|
348
|
+
or specify other variables that can be used to compute them,
|
|
349
|
+
including `"temperature"`, `"salinity"`, and `"pressure"`.
|
|
350
|
+
|
|
351
|
+
For EK60 and EK80 echosounders, by default echopype uses
|
|
352
|
+
environmental variables stored in the data files.
|
|
353
|
+
For AZFP echosounder, all environmental parameters need to be supplied.
|
|
354
|
+
AZFP echosounders typically are equipped with an internal temperature
|
|
355
|
+
sensor, and some are equipped with a pressure sensor, but automatically
|
|
356
|
+
using these pressure data is not currently supported.
|
|
357
|
+
|
|
358
|
+
cal_params : dict, optional
|
|
359
|
+
Intrument-dependent calibration parameters.
|
|
360
|
+
|
|
361
|
+
For EK60, EK80, and AZFP echosounders, by default echopype uses
|
|
362
|
+
environmental variables stored in the data files.
|
|
363
|
+
Users can optionally pass in custom values shown below.
|
|
364
|
+
|
|
365
|
+
- for EK60 echosounder, allowed parameters include:
|
|
366
|
+
`"sa_correction"`, `"gain_correction"`, `"equivalent_beam_angle"`
|
|
367
|
+
- for AZFP echosounder, allowed parameters include:
|
|
368
|
+
`"EL"`, `"DS"`, `"TVR"`, `"VTX0"`, `"equivalent_beam_angle"`, `"Sv_offset"`
|
|
369
|
+
|
|
370
|
+
Passing in calibration parameters for other echosounders
|
|
371
|
+
are not currently supported.
|
|
372
|
+
|
|
373
|
+
waveform_mode : {"CW", "BB", "FM"}, optional
|
|
374
|
+
Type of transmit waveform.
|
|
375
|
+
Required only for data from the EK80 echosounder
|
|
376
|
+
and not used with any other echosounder.
|
|
377
|
+
|
|
378
|
+
- `"CW"` for narrowband transmission,
|
|
379
|
+
returned echoes recorded either as complex or power/angle samples
|
|
380
|
+
- `"BB"` or `"FM"` for broadband transmission,
|
|
381
|
+
returned echoes recorded as complex samples
|
|
382
|
+
|
|
383
|
+
encode_mode : {"complex", "power"}, optional
|
|
384
|
+
Type of encoded return echo data.
|
|
385
|
+
Required only for data from the EK80 echosounder
|
|
386
|
+
and not used with any other echosounder.
|
|
387
|
+
|
|
388
|
+
- `"complex"` for complex samples
|
|
389
|
+
- `"power"` for power/angle samples, only allowed when
|
|
390
|
+
the echosounder is configured for narrowband transmission
|
|
391
|
+
|
|
392
|
+
Returns
|
|
393
|
+
-------
|
|
394
|
+
xr.Dataset
|
|
395
|
+
The calibrated TS dataset, including calibration parameters
|
|
396
|
+
and environmental variables used in the calibration operations.
|
|
397
|
+
|
|
398
|
+
Notes
|
|
399
|
+
-----
|
|
400
|
+
The EK80 echosounder can be configured to transmit
|
|
401
|
+
either broadband/frequency modulated (``waveform_mode="BB"`` or ``waveform_mode="FM"``)
|
|
402
|
+
or narrowband (``waveform_mode="CW"``) signals.
|
|
403
|
+
When transmitting in broadband mode, the returned echoes are
|
|
404
|
+
encoded as complex samples (``encode_mode="complex"``).
|
|
405
|
+
When transmitting in narrowband mode, the returned echoes can be encoded
|
|
406
|
+
either as complex samples (``encode_mode="complex"``)
|
|
407
|
+
or as power/angle combinations (``encode_mode="power"``) in a format
|
|
408
|
+
similar to those recorded by EK60 echosounders.
|
|
409
|
+
|
|
410
|
+
The current calibration implemented for EK80 broadband complex data
|
|
411
|
+
uses band-integrated TS with the gain computed at the center frequency
|
|
412
|
+
of the transmit signal.
|
|
413
|
+
|
|
414
|
+
Note that in the fisheries acoustics context, it is customary to
|
|
415
|
+
associate TS to a single scatterer.
|
|
416
|
+
TS is defined as: TS = 10 * np.log10 (sigma_bs), where sigma_bs
|
|
417
|
+
is the backscattering cross-section.
|
|
418
|
+
|
|
419
|
+
For details, see:
|
|
420
|
+
MacLennan et al. 2002. A consistent approach to definitions and
|
|
421
|
+
symbols in fisheries acoustics. ICES J. Mar. Sci. 59: 365-369.
|
|
422
|
+
https://doi.org/10.1006/jmsc.2001.1158
|
|
423
|
+
"""
|
|
424
|
+
return _compute_cal(cal_type="TS", echodata=echodata, **kwargs)
|