Skip to content

Commit 1dccbc5

Browse files
authored
Remove ChannelWrap grid override (TGSAI#698)
1 parent b48fece commit 1dccbc5

File tree

3 files changed

+1
-89
lines changed

3 files changed

+1
-89
lines changed

src/mdio/commands/segy.py

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -257,17 +257,8 @@ def segy_import( # noqa: PLR0913
257257
--header-names shot,cable,chan
258258
--header-types int32,None,int32
259259
--chunk-size 8,2,256,512
260-
--grid-overrides '{"ChannelWrap": True, "ChannelsPerCable": 800,
261-
"CalculateCable": True}'
260+
--grid-overrides '{"CalculateCable": True}'
262261
263-
\b
264-
If we do have cable numbers in the headers, but channels are still sequential (aka.
265-
unwrapped), we can still ingest it like this.
266-
--header-locations 9,213,13
267-
--header-names shot,cable,chan
268-
--header-types int32,int16,int32
269-
--chunk-size 8,2,256,512
270-
--grid-overrides '{"ChannelWrap":True, "ChannelsPerCable": 800}'
271262
\b
272263
No grid overrides are necessary for shot gathers with channel numbers and wrapped channels.
273264

src/mdio/segy/geometry.py

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -371,9 +371,6 @@ class DuplicateIndex(GridOverrideCommand):
371371

372372
def validate(self, index_headers: HeaderArray, grid_overrides: dict[str, bool | int]) -> None:
373373
"""Validate if this transform should run on the type of data."""
374-
if "ChannelWrap" in grid_overrides:
375-
raise GridOverrideIncompatibleError(self.name, "ChannelWrap")
376-
377374
if "CalculateCable" in grid_overrides:
378375
raise GridOverrideIncompatibleError(self.name, "CalculateCable")
379376

@@ -434,9 +431,6 @@ class AutoChannelWrap(GridOverrideCommand):
434431

435432
def validate(self, index_headers: HeaderArray, grid_overrides: dict[str, bool | int]) -> None:
436433
"""Validate if this transform should run on the type of data."""
437-
if "ChannelWrap" in grid_overrides:
438-
raise GridOverrideIncompatibleError(self.name, "ChannelWrap")
439-
440434
if "CalculateCable" in grid_overrides:
441435
raise GridOverrideIncompatibleError(self.name, "CalculateCable")
442436

@@ -469,30 +463,6 @@ def transform(
469463
return index_headers
470464

471465

472-
class ChannelWrap(GridOverrideCommand):
473-
"""Wrap channels to start from one at cable boundaries."""
474-
475-
required_keys = {"shot_point", "cable", "channel"}
476-
required_parameters = {"ChannelsPerCable"}
477-
478-
def validate(self, index_headers: HeaderArray, grid_overrides: dict[str, bool | int]) -> None:
479-
"""Validate if this transform should run on the type of data."""
480-
if "AutoChannelWrap" in grid_overrides:
481-
raise GridOverrideIncompatibleError(self.name, "AutoCableChannel")
482-
483-
self.check_required_keys(index_headers)
484-
self.check_required_params(grid_overrides)
485-
486-
def transform(self, index_headers: HeaderArray, grid_overrides: dict[str, bool | int]) -> NDArray:
487-
"""Perform the grid transform."""
488-
self.validate(index_headers, grid_overrides)
489-
490-
channels_per_cable = grid_overrides["ChannelsPerCable"]
491-
index_headers["channel"] = (index_headers["channel"] - 1) % channels_per_cable + 1
492-
493-
return index_headers
494-
495-
496466
class CalculateCable(GridOverrideCommand):
497467
"""Calculate cable numbers from unwrapped channels."""
498468

@@ -575,7 +545,6 @@ def __init__(self) -> None:
575545
"AutoChannelWrap": AutoChannelWrap(),
576546
"AutoShotWrap": AutoShotWrap(),
577547
"CalculateCable": CalculateCable(),
578-
"ChannelWrap": ChannelWrap(),
579548
"NonBinned": NonBinned(),
580549
"HasDuplicates": DuplicateIndex(),
581550
}

tests/unit/test_segy_grid_overrides.py

Lines changed: 0 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -131,22 +131,6 @@ def test_non_binned(self, mock_streamer_headers: dict[str, npt.NDArray]) -> None
131131
class TestStreamerGridOverrides:
132132
"""Check grid overrides for shot data with streamer acquisition."""
133133

134-
def test_channel_wrap(self, mock_streamer_headers: dict[str, npt.NDArray]) -> None:
135-
"""Test the ChannelWrap command."""
136-
index_names = ("shot_point", "cable", "channel")
137-
grid_overrides = {"ChannelWrap": True, "ChannelsPerCable": len(RECEIVERS)}
138-
139-
new_headers, new_names, new_chunks = run_override(grid_overrides, index_names, mock_streamer_headers)
140-
141-
assert new_names == index_names
142-
assert new_chunks is None
143-
144-
dims = get_dims(new_headers)
145-
146-
assert_array_equal(dims[0].coords, SHOTS)
147-
assert_array_equal(dims[1].coords, CABLES)
148-
assert_array_equal(dims[2].coords, RECEIVERS)
149-
150134
def test_calculate_cable(
151135
self,
152136
mock_streamer_headers: dict[str, npt.NDArray],
@@ -172,40 +156,12 @@ def test_calculate_cable(
172156
assert_array_equal(dims[1].coords, cables)
173157
assert_array_equal(dims[2].coords, channels)
174158

175-
def test_wrap_and_calc_cable(
176-
self,
177-
mock_streamer_headers: dict[str, npt.NDArray],
178-
) -> None:
179-
"""Test the combined ChannelWrap and CalculateCable commands."""
180-
index_names = ("shot_point", "cable", "channel")
181-
grid_overrides = {
182-
"CalculateCable": True,
183-
"ChannelWrap": True,
184-
"ChannelsPerCable": len(RECEIVERS),
185-
}
186-
187-
new_headers, new_names, new_chunks = run_override(grid_overrides, index_names, mock_streamer_headers)
188-
189-
assert new_names == index_names
190-
assert new_chunks is None
191-
192-
dims = get_dims(new_headers)
193-
# We reset the cables to start from 1.
194-
cables = arange(1, len(CABLES) + 1, dtype="uint32")
195-
196-
assert_array_equal(dims[0].coords, SHOTS)
197-
assert_array_equal(dims[1].coords, cables)
198-
assert_array_equal(dims[2].coords, RECEIVERS)
199-
200159
def test_missing_param(self, mock_streamer_headers: dict[str, npt.NDArray]) -> None:
201160
"""Test missing parameters for the commands."""
202161
index_names = ("shot_point", "cable", "channel")
203162
chunksize = None
204163
overrider = GridOverrider()
205164

206-
with pytest.raises(GridOverrideMissingParameterError):
207-
overrider.run(mock_streamer_headers, index_names, {"ChannelWrap": True}, chunksize)
208-
209165
with pytest.raises(GridOverrideMissingParameterError):
210166
overrider.run(mock_streamer_headers, index_names, {"CalculateCable": True}, chunksize)
211167

@@ -218,10 +174,6 @@ def test_incompatible_overrides(
218174
chunksize = None
219175
overrider = GridOverrider()
220176

221-
grid_overrides = {"ChannelWrap": True, "AutoChannelWrap": True}
222-
with pytest.raises(GridOverrideIncompatibleError):
223-
overrider.run(mock_streamer_headers, index_names, grid_overrides, chunksize)
224-
225177
grid_overrides = {"CalculateCable": True, "AutoChannelWrap": True}
226178
with pytest.raises(GridOverrideIncompatibleError):
227179
overrider.run(mock_streamer_headers, index_names, grid_overrides, chunksize)

0 commit comments

Comments
 (0)