Commit 88ead152 authored by Jim King's avatar Jim King
Browse files

add warning message for offset-sorted SEGY containing traces with duplicate key combos

parent 3d0a889f
......@@ -20,18 +20,24 @@ def output_scan() -> TempScanFileGuard:
@pytest.fixture
def offset_sorted_segy() -> str:
return os.path.join(test_data_dir, "Plugins", "ImportPlugins", "SEGYUnittest", "CrosslineSorted", "ST0202.segy")
return os.path.join(test_data_dir, "Plugins", "ImportPlugins", "SEGYUnittest", "OffsetSorted", "ST0202.segy")
@pytest.fixture
def offset_sorted_deduped_segy() -> str:
return os.path.join(test_data_dir, "Plugins", "ImportPlugins", "SEGYUnittest", "OffsetSorted",
"ST0202_deduped.segy")
@pytest.fixture
def offset_sorted_scan() -> str:
return os.path.join(test_data_dir, "Plugins", "ImportPlugins", "SEGYUnittest", "CrosslineSorted",
return os.path.join(test_data_dir, "Plugins", "ImportPlugins", "SEGYUnittest", "OffsetSorted",
"ST0202.segy.scan.json")
@pytest.fixture
def conventional_sorted_segy() -> str:
return os.path.join(test_data_dir, "Plugins", "ImportPlugins", "SEGYUnittest", "CrosslineSorted",
return os.path.join(test_data_dir, "Plugins", "ImportPlugins", "SEGYUnittest", "OffsetSorted",
"ST0202_conventional.segy")
......@@ -55,6 +61,21 @@ def offset_sorted_executor(offset_sorted_segy, output_vds) -> Tuple[ImportExecut
return ex, output_vds
@pytest.fixture
def offset_sorted_deduped_executor(offset_sorted_deduped_segy, output_vds) -> Tuple[ImportExecutor, TempVDSGuard]:
"""Fixture to setup an ImportExecutor with common options for de-duped version of offset-sorted SEGY"""
ex = ImportExecutor()
ex.add_args(["--header-field", "offset=177:4"])
ex.add_arg("--offset-sorted")
ex.add_args(["--vdsfile", output_vds.filename])
ex.add_arg(offset_sorted_deduped_segy)
return ex, output_vds
@pytest.fixture
def conventional_sorted_executor(conventional_sorted_segy, conventional_output_vds) -> Tuple[ImportExecutor, TempVDSGuard]:
"""Fixture to setup an ImportExecutor with common options for conventionally sorted SEGY"""
......@@ -343,3 +364,28 @@ def test_with_scan_file(offset_sorted_segy, offset_sorted_scan, output_vds):
access_manager = openvds.getAccessManager(handle)
assert access_manager.getVDSProduceStatus(openvds.DimensionsND.Dimensions_023) != openvds.VDSProduceStatus.Unavailable
def test_dupe_warning(offset_sorted_executor):
ex, output_vds = offset_sorted_executor
s = ex.command_line()
result = ex.run()
assert result == 0, ex.output()
assert Path(output_vds.filename).exists()
# check that the output contains the warning message for traces with duplicate offset, inline, crossline key combos
assert "duplicate key combinations" in ex.output()
def test_dupe_no_warning(offset_sorted_deduped_executor):
ex, output_vds = offset_sorted_deduped_executor
result = ex.run()
assert result == 0, ex.output()
assert Path(output_vds.filename).exists()
# check that the output contains the warning message for traces with duplicate offset, inline, crossline key combos
assert "duplicate key combinations" not in ex.output()
......@@ -2490,6 +2490,7 @@ main(int argc, char* argv[])
bool prestack = false;
bool is2D = false;
bool isOffsetSorted = false;
bool isOffsetSortedDupeKeyWarned = false;
bool jsonOutput = false;
bool help = false;
bool helpConnection = false;
......@@ -3751,6 +3752,18 @@ main(int argc, char* argv[])
break;
}
if (fileInfo.IsOffsetSorted() && !isOffsetSortedDupeKeyWarned && trace > firstTrace && secondaryTest == currentSecondaryKey)
{
if (!jsonOutput && is_tty)
{
std::cout << std::endl;
}
auto
message = "This offset-sorted SEGY has traces with duplicate key combinations of Offset, Inline, and Crossline. Only one of the traces with duplicate key values will be written to the output VDS.";
OpenVDS::printWarning(jsonOutput, "SEGY", message);
isOffsetSortedDupeKeyWarned = true;
}
if (secondaryTest != currentSecondaryKey)
{
// we've progressed to a new secondary key, so reset the tertiary (gather) index
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment