Skip to content

Commit

Permalink
fix apply_pss when bottom and water column beams are not the same
Browse files Browse the repository at this point in the history
  • Loading branch information
peter-urban committed Dec 12, 2024
1 parent c24fa46 commit bd741d3
Showing 1 changed file with 23 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,16 +1,33 @@
import numpy as np

def apply_pss(ping, pss, apply_pss_to_bottom):
if apply_pss_to_bottom and ping.has_bottom():
#if ping.bottom.get_number_of_beams() != ping.watercolumn.get_number_of_beams():
if apply_pss_to_bottom and ping.has_bottom() and ping.bottom.has_beam_crosstrack_angles():
if ping.bottom.get_number_of_beams() != ping.watercolumn.get_number_of_beams():
aw = ping.watercolumn.get_beam_crosstrack_angles()
ab = ping.bottom.get_beam_crosstrack_angles()

ad = np.median(aw - ab)
ad = np.median(aw) - np.median(ab)
pss_ = pss.copy()

min_ba = pss.get_min_beam_angle()
max_ba = pss.get_max_beam_angle()

if min_ba is not None:
min_ba += ad

if max_ba is not None:
max_ba += ad

pss_.select_beam_range_by_angles(min_ba, max_ba)

sel = pss_.apply_selection(ping.watercolumn)
else:
sel = pss.apply_selection(ping.bottom)
pss_ = pss.copy()
pss_.select_beam_range_by_angles(pss.get_min_beam_angle() + ad, pss.get_max_beam_angle() + ad)
pss_.clear_beam_angle_range()
pss_.select_beam_range_by_numbers(sel.get_beam_numbers()[0], sel.get_beam_numbers()[-1], pss.get_beam_step())

sel = pss_.apply_selection(ping.watercolumn)
# else:
# sel = pss.apply_selection(ping.bottom)
else:
sel = pss.apply_selection(ping.watercolumn)

Expand Down

0 comments on commit bd741d3

Please sign in to comment.