diff --git a/echopype/consolidate/api.py b/echopype/consolidate/api.py index cf5f2c50a..2388b0ead 100644 --- a/echopype/consolidate/api.py +++ b/echopype/consolidate/api.py @@ -30,7 +30,7 @@ def swap_dims_channel_frequency(ds: Union[xr.Dataset, str, pathlib.Path]) -> xr.Dataset: """ - Use frequency_nominal in place of channel to be dataset dimension and coorindate. + Use frequency_nominal in place of channel to be dataset dimension and coordinate. This is useful because the nominal transducer frequencies are commonly used to refer to data collected from a specific transducer. @@ -349,6 +349,7 @@ def add_splitbeam_angle( pulse_compression: bool = False, storage_options: dict = {}, to_disk: bool = True, + use_frequency_nominal: bool = False, ) -> xr.Dataset: """ Add split-beam (alongship/athwartship) angles into the Sv dataset. @@ -390,6 +391,9 @@ def add_splitbeam_angle( If ``False``, ``to_disk`` with split-beam angles added will be returned. ``to_disk=True`` is useful when ``source_Sv`` is a path and users only want to write the split-beam angle data to this path. + use_frequency_nominal: bool, default=False + If ``True``, the split-beam angles will be calculated using the + ``frequency_nominal`` variable in ``source_Sv``. Returns ------- @@ -459,7 +463,11 @@ def add_splitbeam_angle( if "channel" not in source_Sv.variables: raise ValueError("The input source_Sv Dataset must have a channel dimension!") - # Select ds_beam channels from source_Sv + # Swap the dimension to frequency_nominal if use_frequency_nominal is True + if use_frequency_nominal: + source_Sv = swap_dims_channel_frequency(source_Sv) + + # Select ds_beam dimension from source_Sv ds_beam = echodata[ed_beam_group].sel(channel=source_Sv["channel"].values) # Assemble angle param dict diff --git a/echopype/consolidate/split_beam_angle.py b/echopype/consolidate/split_beam_angle.py index a269d70c4..5e68d49a4 100644 --- a/echopype/consolidate/split_beam_angle.py +++ b/echopype/consolidate/split_beam_angle.py @@ -151,7 +151,9 @@ def _e2f(angle_type: str) -> xr.Dataset: def get_angle_complex_samples( - ds_beam: xr.Dataset, angle_params: dict, pc_params: dict = None + ds_beam: xr.Dataset, + angle_params: dict, + pc_params: dict = None, ) -> Tuple[xr.DataArray, xr.DataArray]: """ Obtain split-beam angle from CW or BB mode complex samples. diff --git a/echopype/test_data/README.md b/echopype/test_data/README.md index d3295604e..c79ad71f3 100644 --- a/echopype/test_data/README.md +++ b/echopype/test_data/README.md @@ -11,8 +11,6 @@ Most of these files are stored on Git LFS but the ones that aren't (due to file - 2019118 group2survey-D20191214-T081342.raw: Contains 6 channels but only 2 of those channels collect ping data - D20200528-T125932.raw: Data collected from WBT mini (instead of WBT), from @emlynjdavies - Green2.Survey2.FM.short.slow.-D20191004-T211557.raw: Contains 2-in-1 transducer, from @FletcherFT (reduced from 104.9 MB to 765 KB in test data updates) -- raw4-D20220514-T172704.raw: Contains RAW4 datagram, 1 channel only, from @cornejotux -- D20210330-T123857.raw: do not contain filter coefficients ### EA640 @@ -24,7 +22,6 @@ Most of these files are stored on Git LFS but the ones that aren't (due to file - Winter2017-D20170115-T150122.raw: Contains a change of recording length in the middle of the file - 2015843-D20151023-T190636.raw: Not used in tests but contains ranges are not constant across ping times - SH1701_consecutive_files_w_range_change: Not used in tests. [Folder](https://drive.google.com/drive/u/1/folders/1PaDtL-xnG5EK3N3P1kGlXa5ub16Yic0f) on shared drive that contains sequential files with ranges that are not constant across ping times. -- NBP_B050N-D20180118-T090228.raw: split-beam setup without angle data ### AZFP