@@ -342,9 +342,16 @@ def test_add_splitbeam_angle_partial_valid_channels(test_path):
342342 # Manually override beam_type for one channel to simulate single-beam
343343 beam_types = ed ["Sonar/Beam_group1" ]["beam_type" ].values
344344 total_channels = beam_types .shape [0 ]
345+ valid_channels = 0
346+ channel_to_invalidate = None
345347
346348 # Force the first channel to an unsupported beam_type
347- beam_types [1 ] = 0
349+ for idx , bt in enumerate (beam_types ):
350+ if bt != 0 :
351+ valid_channels += 1
352+ if channel_to_invalidate is None :
353+ channel_to_invalidate = idx
354+
348355 ed ["Sonar/Beam_group1" ]["beam_type" ].data [:] = beam_types
349356
350357 # Compute Sv
@@ -354,6 +361,8 @@ def test_add_splitbeam_angle_partial_valid_channels(test_path):
354361 ds_Sv = ep .consolidate .add_splitbeam_angle (source_Sv = ds_Sv , echodata = ed , waveform_mode = "CW" ,
355362 encode_mode = "complex" , pulse_compression = False , to_disk = False )
356363
364+ expected_valid_channels = valid_channels - 1
365+
357366 valid_angle_channels = [
358367 ch for ch in ds_Sv .channel .values
359368 if not np .all (np .isnan (ds_Sv ["angle_alongship" ].sel (channel = ch )))
@@ -362,7 +371,7 @@ def test_add_splitbeam_angle_partial_valid_channels(test_path):
362371 # Verify angles exist for valid channel only
363372 assert "angle_alongship" in ds_Sv
364373 assert "angle_athwartship" in ds_Sv
365- assert len (valid_angle_channels ) == total_channels - 1
374+ assert len (valid_angle_channels ) == expected_valid_channels
366375
367376# TODO: need a test for power/angle data, with mock EchoData object
368377# containing some channels with single-beam data and some channels with split-beam data
0 commit comments