Commit 79f1cac1 authored by Jim King's avatar Jim King Committed by Jørgen Lind
Browse files

add new command line option

parent 72dc2bcf
......@@ -29,8 +29,8 @@ def output_vds() -> TempVDSGuard:
@pytest.fixture
def prestack_segy() -> str:
return os.path.join(test_data_dir, "HeadwavePlatform", "PlatformIntegration", "Teleport_Trim", "3D_Prestack",
"ST0202R08_Gather_Time.segy")
return os.path.join(test_data_dir, "HeadwavePlatform", "PlatformIntegration", "Teleport", "Teleport_Trim",
"3D_Prestack", "ST0202R08_Gather_Time.segy")
@pytest.fixture
......@@ -82,7 +82,7 @@ def get_gathers_stats(vds_filename: str) -> Tuple[int, int, int, int, int, int]:
number of gathers with no dead traces
)
"""
with openvds.open(output_vds.filename, "") as handle:
with openvds.open(vds_filename, "") as handle:
layout = openvds.getLayout(handle)
access_manager = openvds.getAccessManager(handle)
......@@ -107,7 +107,7 @@ def get_gathers_stats(vds_filename: str) -> Tuple[int, int, int, int, int, int]:
1),
channel=trace_channel,
format=openvds.VolumeDataChannelDescriptor.Format.Format_U8,
dimensionsND=openvds.DimensionsND.Dimensions_023)
dimensionsND=openvds.DimensionsND.Dimensions_012)
assert dim1_size == trace_flag_request.data.shape[0]
......@@ -149,8 +149,7 @@ def test_gather_spacing_invalid_arg(invalid_executor):
result = ex.run()
assert result != 0, ex.output()
# TODO what text to look for?
assert "some message" in ex.output().lower()
assert "unknown --respace-gathers option" in ex.output().lower()
def test_gather_spacing_default(default_executor):
......@@ -163,7 +162,7 @@ def test_gather_spacing_default(default_executor):
total, leading_only, middle_only, trailing_only, mixed, no_dead = get_gathers_stats(output_vds.filename)
assert total == 60
assert total == 71
assert middle_only > 0
assert mixed > 0
assert trailing_only == 0
......@@ -181,7 +180,7 @@ def test_gather_spacing_auto(auto_executor):
total, leading_only, middle_only, trailing_only, mixed, no_dead = get_gathers_stats(output_vds.filename)
assert total == 60
assert total == 71
assert middle_only > 0
assert mixed > 0
assert trailing_only == 0
......@@ -199,7 +198,7 @@ def test_gather_spacing_on(on_executor):
total, leading_only, middle_only, trailing_only, mixed, no_dead = get_gathers_stats(output_vds.filename)
assert total == 60
assert total == 71
assert middle_only > 0
assert mixed > 0
assert trailing_only == 0
......@@ -217,7 +216,7 @@ def test_gather_spacing_off(off_executor):
total, leading_only, middle_only, trailing_only, mixed, no_dead = get_gathers_stats(output_vds.filename)
assert total == 60
assert total == 71
assert trailing_only == total
assert middle_only == 0
assert mixed == 0
......
......@@ -2277,6 +2277,7 @@ main(int argc, char* argv[])
bool prestack = false;
bool is2D = false;
bool isOffsetSorted = false;
// TODO remove traceOrderByOffset
bool traceOrderByOffset = true;
bool jsonOutput = false;
bool help = false;
......@@ -2292,8 +2293,19 @@ main(int argc, char* argv[])
std::string azimuthTypeString;
std::string azimuthUnitString;
enum class TraceSpacingByOffset
{
Off = 0,
On = 1,
Auto = 2
};
TraceSpacingByOffset traceSpacingByOffset = TraceSpacingByOffset::Auto;
std::string traceSpacingByOffsetString;
const std::string supportedAzimuthTypes("Azimuth (from trace header field) (default), OffsetXY (computed from OffsetX and OffsetY header fields)");
const std::string supportedAzimuthUnits("Radians, Degrees (default)");
const std::string supportedTraceSpacingTypes("Off, On, Auto (default)");
// default key names used if not supplied by user
std::string defaultPrimaryKey = "InlineNumber";
......@@ -2346,8 +2358,9 @@ main(int argc, char* argv[])
options.add_option("", "", "azimuth-type", std::string("Azimuth type. Supported azimuth types are: ") + supportedAzimuthTypes + ".", cxxopts::value<std::string>(azimuthTypeString), "<string>");
options.add_option("", "", "azimuth-unit", std::string("Azimuth unit. Supported azimuth units are: ") + supportedAzimuthUnits + ".", cxxopts::value<std::string>(azimuthUnitString), "<string>");
options.add_option("", "", "azimuth-scale", "Azimuth scale factor. Trace header field Azimuth values will be multiplied by this factor.", cxxopts::value<float>(azimuthScaleFactor), "<value>");
options.add_option("", "", "respace-gathers", std::string("Respace traces in prestack gathers by Offset trace header field. Supported options are: ") + supportedTraceSpacingTypes + ".", cxxopts::value<std::string>(traceSpacingByOffsetString), "<string>");
// TODO temporary option that will be removed/changed when new respace algo is implemented (traceOrderByOffset)
// TODO remove traceOrderByOffset option
options.add_option("", "", "order-by-offset", "Order traces within a gather by offset.", cxxopts::value<bool>(traceOrderByOffset), "");
options.add_option("", "h", "help", "Print this help information", cxxopts::value<bool>(help), "");
......@@ -2596,6 +2609,28 @@ main(int argc, char* argv[])
}
}
if (!traceSpacingByOffsetString.empty())
{
std::transform(traceSpacingByOffsetString.begin(), traceSpacingByOffsetString.end(), traceSpacingByOffsetString.begin(), asciitolower);
if (traceSpacingByOffsetString == "off")
{
traceSpacingByOffset = TraceSpacingByOffset::Off;
}
else if (traceSpacingByOffsetString == "on")
{
traceSpacingByOffset = TraceSpacingByOffset::On;
}
else if (traceSpacingByOffsetString == "auto")
{
traceSpacingByOffset = TraceSpacingByOffset::Auto;
}
else
{
OpenVDS::printError(jsonOutput, "Args", fmt::format("Unknown --respace-gathers option '{}'", traceSpacingByOffsetString));
return EXIT_FAILURE;
}
}
SEGY::HeaderField
primaryKeyHeaderField,
secondaryKeyHeaderField;
......
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