Commit 7102c7c4 authored by Jim King's avatar Jim King Committed by Jørgen Lind
Browse files

add header fields and command line options for azimuth and mute channels

parent a195f9c6
......@@ -204,6 +204,11 @@ static const HeaderField InlineNumberHeaderField(189, FieldWidth::FourByte);
static const HeaderField CrosslineNumberHeaderField(193, FieldWidth::FourByte);
static const HeaderField ReceiverHeaderField(13, FieldWidth::FourByte);
static const HeaderField OffsetHeaderField(37, FieldWidth::FourByte);
static const HeaderField OffsetXHeaderField(97, FieldWidth::TwoByte);
static const HeaderField OffsetYHeaderField(95, FieldWidth::TwoByte);
static const HeaderField Azimuth(61, FieldWidth::FourByte);
static const HeaderField MuteStartTime(111, FieldWidth::TwoByte);
static const HeaderField MuteEndTime(113, FieldWidth::TwoByte);
} // end namespace TraceHeader
......@@ -318,6 +323,22 @@ enum class SampleUnits
Meters = 2
};
enum class AzimuthUnits
{
Radians = 0,
Degrees = 1,
MinValue = Radians,
MaxValue = Degrees
};
enum class AzimuthType
{
Azimuth = 0,
OffsetXY = 1,
MinValue = Azimuth,
MaxValue = OffsetXY
};
enum class SEGYType
{
Poststack = 0,
......
......@@ -32,12 +32,15 @@ def azimuth_from_azimuth_executor(azimuth_degrees_segy, output_vds) -> Tuple[Imp
ex.add_args(["--header-field", "azimuth=25:4"])
ex.add_arg("--azimuth")
ex.add_args(["--azimuth-type", "angle"])
ex.add_args(["--azimuth-type", "azimuth"])
ex.add_args(["--azimuth-unit", "degrees"])
ex.add_arg("--prestack")
# TODO disable trace order by offset?
ex.add_args(["--vdsfile", output_vds.filename])
# Need to ignore warnings because this data is only one segment
ex.add_arg("--ignore-warnings")
ex.add_arg(azimuth_degrees_segy)
return ex, output_vds
......
......@@ -278,7 +278,12 @@ g_traceHeaderFields =
{ "inlinenumber", SEGY::TraceHeader::InlineNumberHeaderField },
{ "crosslinenumber", SEGY::TraceHeader::CrosslineNumberHeaderField },
{ "receiver", SEGY::TraceHeader::ReceiverHeaderField },
{ "offset", SEGY::TraceHeader::OffsetHeaderField }
{ "offset", SEGY::TraceHeader::OffsetHeaderField },
{ "offsetx", SEGY::TraceHeader::OffsetXHeaderField },
{ "offsety", SEGY::TraceHeader::OffsetYHeaderField },
{ "azimuth", SEGY::TraceHeader::Azimuth },
{ "mutestarttime", SEGY::TraceHeader::MuteStartTime },
{ "muteendtime", SEGY::TraceHeader::MuteEndTime },
};
std::map<std::string, std::string>
......@@ -2240,6 +2245,15 @@ main(int argc, char* argv[])
bool version = false;
std::string attributeName = AMPLITUDE_ATTRIBUTE_NAME;
std::string attributeUnit;
bool isMutes = false;
bool isAzimuth = false;
SEGY::AzimuthType azimuthType = SEGY::AzimuthType::Azimuth;
SEGY::AzimuthUnits azimuthUnit = SEGY::AzimuthUnits::Degrees;
std::string azimuthTypeString;
std::string azimuthUnitString;
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)");
// default key names used if not supplied by user
std::string defaultPrimaryKey = "InlineNumber";
......@@ -2287,6 +2301,10 @@ main(int argc, char* argv[])
options.add_option("", "", "attribute-unit", "The units of the primary VDS channel. The unit name may be blank (default), ft, ft/s, Hz, m, m/s, ms, or s", cxxopts::value<std::string>(attributeUnit), "<string>");
options.add_option("", "", "2d", "Import 2D data.", cxxopts::value<bool>(is2D), "");
options.add_option("", "", "offset-sorted", "Import prestack data sorted by trace header Offset value.", cxxopts::value<bool>(isOffsetSorted), "");
options.add_option("", "", "mute", "Enable Mutes channel in output VDS.", cxxopts::value<bool>(isMutes), "");
options.add_option("", "", "azimuth", "Enable Azimuth channel in output VDS.", cxxopts::value<bool>(isAzimuth), "");
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>");
// TODO add option for turning off traceOrderByOffset
options.add_option("", "h", "help", "Print this help information", cxxopts::value<bool>(help), "");
......@@ -2499,6 +2517,42 @@ main(int argc, char* argv[])
}
}
if (!azimuthTypeString.empty())
{
std::transform(azimuthTypeString.begin(), azimuthTypeString.end(), azimuthTypeString.begin(), asciitolower);
if (azimuthTypeString == "azimuth")
{
azimuthType = SEGY::AzimuthType::Azimuth;
}
else if (azimuthTypeString == "offsetxy")
{
azimuthType = SEGY::AzimuthType::OffsetXY;
}
else
{
OpenVDS::printError(jsonOutput, "Args", fmt::format("Unknown Azimuth type '{}'", azimuthTypeString));
return EXIT_FAILURE;
}
}
if (!azimuthUnitString.empty())
{
std::transform(azimuthUnitString.begin(), azimuthUnitString.end(), azimuthUnitString.begin(), asciitolower);
if (azimuthUnitString == "radians")
{
azimuthUnit = SEGY::AzimuthUnits::Radians;
}
else if (azimuthUnitString == "degrees")
{
azimuthUnit = SEGY::AzimuthUnits::Degrees;
}
else
{
OpenVDS::printError(jsonOutput, "Args", fmt::format("Unknown Azimuth unit '{}'", azimuthUnitString));
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