Skip to content

Commit bd741d3

Browse files
committed
fix apply_pss when bottom and water column beams are not the same
1 parent c24fa46 commit bd741d3

File tree

1 file changed

+23
-6
lines changed

1 file changed

+23
-6
lines changed

python/themachinethatgoesping/pingprocessing/watercolumn/helper/select_get_wci_image.py

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,33 @@
1+
import numpy as np
2+
13
def apply_pss(ping, pss, apply_pss_to_bottom):
2-
if apply_pss_to_bottom and ping.has_bottom():
3-
#if ping.bottom.get_number_of_beams() != ping.watercolumn.get_number_of_beams():
4+
if apply_pss_to_bottom and ping.has_bottom() and ping.bottom.has_beam_crosstrack_angles():
5+
if ping.bottom.get_number_of_beams() != ping.watercolumn.get_number_of_beams():
46
aw = ping.watercolumn.get_beam_crosstrack_angles()
57
ab = ping.bottom.get_beam_crosstrack_angles()
68

7-
ad = np.median(aw - ab)
9+
ad = np.median(aw) - np.median(ab)
10+
pss_ = pss.copy()
11+
12+
min_ba = pss.get_min_beam_angle()
13+
max_ba = pss.get_max_beam_angle()
14+
15+
if min_ba is not None:
16+
min_ba += ad
17+
18+
if max_ba is not None:
19+
max_ba += ad
20+
21+
pss_.select_beam_range_by_angles(min_ba, max_ba)
22+
23+
sel = pss_.apply_selection(ping.watercolumn)
24+
else:
25+
sel = pss.apply_selection(ping.bottom)
826
pss_ = pss.copy()
9-
pss_.select_beam_range_by_angles(pss.get_min_beam_angle() + ad, pss.get_max_beam_angle() + ad)
27+
pss_.clear_beam_angle_range()
28+
pss_.select_beam_range_by_numbers(sel.get_beam_numbers()[0], sel.get_beam_numbers()[-1], pss.get_beam_step())
1029

1130
sel = pss_.apply_selection(ping.watercolumn)
12-
# else:
13-
# sel = pss.apply_selection(ping.bottom)
1431
else:
1532
sel = pss.apply_selection(ping.watercolumn)
1633

0 commit comments

Comments
 (0)