Skip to content

Commit 6985bd8

Browse files
markspectasansal
andauthored
Improved logging in autochannelwrap. (#332)
* Update the logging in autochannlewrap to explain when and why it is using type a. * refactor a little bit to be more readable --------- Co-authored-by: Altay Sansal <[email protected]>
1 parent 5db90a6 commit 6985bd8

File tree

1 file changed

+26
-6
lines changed

1 file changed

+26
-6
lines changed

src/mdio/segy/geometry.py

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ def analyze_streamer_headers(
6666
"""Check input headers for SEG-Y input to help determine geometry.
6767
6868
This function reads in trace_qc_count headers and finds the unique cable values.
69-
The function then checks to make sure channel numbers for different cables do
69+
The function then checks to ensure channel numbers for different cables do
7070
not overlap.
7171
7272
Args:
@@ -91,16 +91,36 @@ def analyze_streamer_headers(
9191

9292
# Check channel numbers do not overlap for case B
9393
geom_type = StreamerShotGeometryType.B
94-
for idx, cable in enumerate(unique_cables):
95-
min_val = cable_chan_min[idx]
96-
max_val = cable_chan_max[idx]
94+
for idx1, cable1 in enumerate(unique_cables):
95+
min_val1 = cable_chan_min[idx1]
96+
max_val1 = cable_chan_max[idx1]
97+
98+
cable1_range = (min_val1, max_val1)
9799
for idx2, cable2 in enumerate(unique_cables):
98-
if cable2 == cable:
100+
if cable2 == cable1:
99101
continue
100102

101-
if cable_chan_min[idx2] < max_val and cable_chan_max[idx2] > min_val:
103+
min_val2 = cable_chan_min[idx2]
104+
max_val2 = cable_chan_max[idx2]
105+
cable2_range = (min_val2, max_val2)
106+
107+
# Check for overlap and return early with Type A
108+
if min_val2 < max_val1 and max_val2 > min_val1:
102109
geom_type = StreamerShotGeometryType.A
103110

111+
overlap_info = (
112+
f"Cable {cable1} index {idx1} with channel range {cable1_range} "
113+
f"overlaps cable {cable2} index {idx2} with channel range "
114+
f"{cable2_range}. Check for aux trace issues if the overlap is "
115+
"unexpected. To fix, modify the SEG-Y file or use AutoIndex "
116+
"grid override (not channel) for channel number correction."
117+
)
118+
119+
logger.info("Found overlapping channels, assuming streamer type A")
120+
logger.info(overlap_info)
121+
122+
return unique_cables, cable_chan_min, cable_chan_max, geom_type
123+
104124
return unique_cables, cable_chan_min, cable_chan_max, geom_type
105125

106126

0 commit comments

Comments
 (0)