From 88c6c5313c2f5e779c3c38464f4098facf2cbfc0 Mon Sep 17 00:00:00 2001 From: Andrei Rusu Date: Wed, 11 Mar 2026 11:45:16 +0100 Subject: [PATCH] fix: correct SNR_threshold type annotation and xarray scalar extraction - clean/api.py: Change SNR_threshold parameter type hint from float to str to match its default value '3.0dB' - calibrate/cal_params.py: Use .values.item() instead of .data.tolist() for xarray scalar extraction (forward-compatible API) --- echopype/calibrate/cal_params.py | 2 +- echopype/clean/api.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/echopype/calibrate/cal_params.py b/echopype/calibrate/cal_params.py index 684dc0370..a6510db51 100644 --- a/echopype/calibrate/cal_params.py +++ b/echopype/calibrate/cal_params.py @@ -410,7 +410,7 @@ def _get_fs(): # loop through channel since transceiver can vary fs = [] for ch in vend["channel"]: - tcvr_type = vend["transceiver_type"].sel(channel=ch).data.tolist().upper() + tcvr_type = vend["transceiver_type"].sel(channel=ch).values.item().upper() fs.append(default_params["receiver_sampling_frequency"][tcvr_type]) return xr.DataArray(fs, dims=["channel"], coords={"channel": vend["channel"]}) diff --git a/echopype/clean/api.py b/echopype/clean/api.py index a0f451619..4892de5d2 100644 --- a/echopype/clean/api.py +++ b/echopype/clean/api.py @@ -439,7 +439,7 @@ def remove_background_noise( ping_num: int, range_sample_num: int, background_noise_max: str = None, - SNR_threshold: float = "3.0dB", + SNR_threshold: str = "3.0dB", ) -> xr.Dataset: """ Remove noise by using estimates of background noise