From 99f2b651529f1d3604a81751458861137fdefa02 Mon Sep 17 00:00:00 2001 From: Landung 'Don' Setiawan Date: Fri, 25 Aug 2023 15:10:11 -0700 Subject: [PATCH] feat: Add method argument Added 'method' argument to 'get_MVBS_along_channels' and also expose additional keyword arguments control for flox. --- echopype/commongrid/mvbs.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/echopype/commongrid/mvbs.py b/echopype/commongrid/mvbs.py index 19d7b6ce7..e540b86e9 100644 --- a/echopype/commongrid/mvbs.py +++ b/echopype/commongrid/mvbs.py @@ -429,7 +429,11 @@ def _linear_transform( def get_MVBS_along_channels( - ds_Sv: xr.Dataset, echo_range_interval: np.ndarray, ping_interval: np.ndarray + ds_Sv: xr.Dataset, + echo_range_interval: np.ndarray, + ping_interval: np.ndarray, + method: str = "map-reduce", + **kwargs ) -> xr.Dataset: """ Computes the MVBS of ``ds_Sv`` along each channel for the given @@ -446,6 +450,13 @@ def get_MVBS_along_channels( ping_interval: np.ndarray 1D array (used by np.digitize) representing the binning required for ``ping_time`` + method: str + The flox strategy for reduction of dask arrays only. + See flox `documentation `_ + for more details. + **kwargs + Additional keyword arguments to be passed + to flox reduction function Returns ------- @@ -466,8 +477,9 @@ def get_MVBS_along_channels( func="nanmean", expected_groups=(None, ping_interval, echo_range_interval), isbin=[False, True, True], - method="map-reduce", engine="flox", + method=method, + **kwargs ) # apply inverse mapping to get back to the original domain and store values