From 684f292f63844a9ae99ba37bf06a4c0449de736b Mon Sep 17 00:00:00 2001 From: Alan Richardson Date: Sun, 9 May 2021 21:50:48 +0100 Subject: [PATCH] Changes source energy direction trace header MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Previously, bytes 219-224 of trace headers were specified in the code to contain a 4-byte mantissa and 2-byte exponent for the source energy direction. The SEG-Y revision 2 standard, however, says that these bytes contain: " Source Energy Direction with respect to the source orientation — Three two- byte two’s complement binary integers for vertical, cross-line and in-line inclinations respectively. The positive orientation direction is defined in Bytes 217–218 of the Standard Trace Header. The energy direction is encoded in tenths of degrees (i.e. 347.8o is encoded as 3478 10 (0D96 16 )). " This commit removes the trace headers SEGY_TR_SOURCE_ENERGY_DIR_MANT SEGY_TR_SOURCE_ENERGY_DIR_EXP and replaces them with SEGY_TR_SOURCE_ENERGY_DIR_VERT SEGY_TR_SOURCE_ENERGY_DIR_XLINE SEGY_TR_SOURCE_ENERGY_DIR_ILINE --- applications/segyio-catr.c | 27 +++++++++++++---------- applications/segyio-crop.c | 5 +++-- applications/test/catr.output | 35 ++++++++++++++++++------------ applications/test/crop-ns.output | 5 +++-- lib/experimental/segyio/segyio.hpp | 10 +++++---- lib/include/segyio/segy.h | 5 +++-- lib/src/segy.c | 10 +++++---- lib/test/segy.cpp | 5 +++-- mex/Segy.m | 5 +++-- mex/TraceField.m | 5 +++-- python/segyio/field.py | 5 +++-- python/segyio/su/words.py | 6 +++-- python/segyio/tracefield.py | 10 +++++---- python/test/segy.py | 8 +++---- 14 files changed, 84 insertions(+), 57 deletions(-) diff --git a/applications/segyio-catr.c b/applications/segyio-catr.c index 0a4564e06..be68fc9bf 100644 --- a/applications/segyio-catr.c +++ b/applications/segyio-catr.c @@ -97,8 +97,9 @@ static const int fields[] = { SEGY_TR_DEVICE_ID , SEGY_TR_SCALAR_TRACE_HEADER , SEGY_TR_SOURCE_TYPE , - SEGY_TR_SOURCE_ENERGY_DIR_MANT , - SEGY_TR_SOURCE_ENERGY_DIR_EXP , + SEGY_TR_SOURCE_ENERGY_DIR_VERT , + SEGY_TR_SOURCE_ENERGY_DIR_XLINE , + SEGY_TR_SOURCE_ENERGY_DIR_ILINE , SEGY_TR_SOURCE_MEASURE_MANT , SEGY_TR_SOURCE_MEASURE_EXP , SEGY_TR_SOURCE_MEASURE_UNIT , @@ -106,7 +107,7 @@ static const int fields[] = { SEGY_TR_UNASSIGNED2 }; -static const char* su[91] = { +static const char* su[92] = { "tracl" , "tracr" , "fldr" , @@ -191,8 +192,9 @@ static const char* su[91] = { "triden" , "sctrh" , "stype" , - "sedm" , - "sede" , + "sedv" , + "sedxl" , + "sedil" , "smm" , "sme" , "smunit" , @@ -200,7 +202,7 @@ static const char* su[91] = { "uint2" }; -static const char* segynames[91] = { +static const char* segynames[92] = { "SEQ_LINE" , "SEQ_FILE" , "FIELD_RECORD" , @@ -285,8 +287,9 @@ static const char* segynames[91] = { "DEVICE_ID" , "SCALAR_TRACE_HEADER" , "SOURCE_TYPE" , - "SOURCE_ENERGY_DIR_MA", - "SOURCE_ENERGY_DIR_EX", + "SOURCE_ENERGY_DIR_V" , + "SOURCE_ENERGY_DIR_XL", + "SOURCE_ENERGY_DIR_IL", "SOURCE_MEASURE_MANT" , "SOURCE_MEASURE_EXP" , "SOURCE_MEASURE_UNIT" , @@ -294,7 +297,7 @@ static const char* segynames[91] = { "UNASSIGNED2" }; -static const char* desc[91] = { +static const char* desc[92] = { "Trace sequence number within line" , "Trace sequence number within SEG Y file" , "Original field record number" , @@ -385,7 +388,9 @@ static const char* desc[91] = { "to give the true time value in milliseconds" , "Source Type/Orientation" , "Source Energy Direction with respect to the source orientation " - "(vertical and crossline)" , + "(vertical)" , + "Source Energy Direction with respect to the source orientation " + "(crossline)" , "Source Energy Direction with respect to the source orientation " "(inline)" , "Source Measurement (mantissa)" , @@ -693,7 +698,7 @@ int main( int argc, char** argv ) { if( err ) exit( errmsg( errno, "Unable to read trace header" ) ); - for( int j = 0; j < 91; j++ ) { + for( int j = 0; j < 92; j++ ) { int f; segy_get_field( trheader, fields[j], &f ); if( opts.nonzero && !f ) continue; diff --git a/applications/segyio-crop.c b/applications/segyio-crop.c index 97638850c..e12e6948f 100644 --- a/applications/segyio-crop.c +++ b/applications/segyio-crop.c @@ -166,8 +166,9 @@ static int valid_trfield( int x ) { case SEGY_TR_DEVICE_ID: case SEGY_TR_SCALAR_TRACE_HEADER: case SEGY_TR_SOURCE_TYPE: - case SEGY_TR_SOURCE_ENERGY_DIR_MANT: - case SEGY_TR_SOURCE_ENERGY_DIR_EXP: + case SEGY_TR_SOURCE_ENERGY_DIR_VERT: + case SEGY_TR_SOURCE_ENERGY_DIR_XLINE: + case SEGY_TR_SOURCE_ENERGY_DIR_ILINE: case SEGY_TR_SOURCE_MEASURE_MANT: case SEGY_TR_SOURCE_MEASURE_EXP: case SEGY_TR_SOURCE_MEASURE_UNIT: diff --git a/applications/test/catr.output b/applications/test/catr.output index 1677262c7..10f51f92a 100644 --- a/applications/test/catr.output +++ b/applications/test/catr.output @@ -82,8 +82,9 @@ tdunit 0 triden 0 sctrh 0 stype 0 -sedm 0 -sede 0 +sedv 0 +sedxl 0 +sedil 0 smm 0 sme 0 smunit 0 @@ -173,8 +174,9 @@ tdunit 0 triden 0 sctrh 0 stype 0 -sedm 0 -sede 0 +sedv 0 +sedxl 0 +sedil 0 smm 0 sme 0 smunit 0 @@ -264,8 +266,9 @@ tdunit 0 triden 0 sctrh 0 stype 0 -sedm 0 -sede 0 +sedv 0 +sedxl 0 +sedil 0 smm 0 sme 0 smunit 0 @@ -355,8 +358,9 @@ tdunit 0 triden 0 sctrh 0 stype 0 -sedm 0 -sede 0 +sedv 0 +sedxl 0 +sedil 0 smm 0 sme 0 smunit 0 @@ -446,8 +450,9 @@ tdunit 0 triden 0 sctrh 0 stype 0 -sedm 0 -sede 0 +sedv 0 +sedxl 0 +sedil 0 smm 0 sme 0 smunit 0 @@ -537,8 +542,9 @@ tdunit 0 triden 0 sctrh 0 stype 0 -sedm 0 -sede 0 +sedv 0 +sedxl 0 +sedil 0 smm 0 sme 0 smunit 0 @@ -628,8 +634,9 @@ tdunit 0 triden 0 sctrh 0 stype 0 -sedm 0 -sede 0 +sedv 0 +sedxl 0 +sedil 0 smm 0 sme 0 smunit 0 diff --git a/applications/test/crop-ns.output b/applications/test/crop-ns.output index 1858ed21b..ff2708639 100644 --- a/applications/test/crop-ns.output +++ b/applications/test/crop-ns.output @@ -82,8 +82,9 @@ tdunit 0 triden 0 sctrh 0 stype 0 -sedm 0 -sede 0 +sedv 0 +sedxl 0 +sedil 0 smm 0 sme 0 smunit 0 diff --git a/lib/experimental/segyio/segyio.hpp b/lib/experimental/segyio/segyio.hpp index 706f07ff5..1863dcd9d 100644 --- a/lib/experimental/segyio/segyio.hpp +++ b/lib/experimental/segyio/segyio.hpp @@ -744,8 +744,9 @@ struct trace_header { int device_id = 0; int scalar_trace_header = 0; int source_type = 0; - int source_energy_dir_mant = 0; - int source_energy_dir_exp = 0; + int source_energy_dir_vert = 0; + int source_energy_dir_xline = 0; + int source_energy_dir_iline = 0; int source_measure_mant = 0; int source_measure_exp = 0; int source_measure_unit = 0; @@ -1471,8 +1472,9 @@ trace_header trace_header_reader< Derived >::get_th( int i ) noexcept(false) { h.device_id = getf( SEGY_TR_DEVICE_ID ); h.scalar_trace_header = getf( SEGY_TR_SCALAR_TRACE_HEADER ); h.source_type = getf( SEGY_TR_SOURCE_TYPE ); - h.source_energy_dir_mant = getf( SEGY_TR_SOURCE_ENERGY_DIR_MANT ); - h.source_energy_dir_exp = getf( SEGY_TR_SOURCE_ENERGY_DIR_EXP ); + h.source_energy_dir_vert = getf( SEGY_TR_SOURCE_ENERGY_DIR_VERT ); + h.source_energy_dir_xline= getf( SEGY_TR_SOURCE_ENERGY_DIR_XLINE ); + h.source_energy_dir_iline= getf( SEGY_TR_SOURCE_ENERGY_DIR_ILINE ); h.source_measure_mant = getf( SEGY_TR_SOURCE_MEASURE_MANT ); h.source_measure_exp = getf( SEGY_TR_SOURCE_MEASURE_EXP ); h.source_measure_unit = getf( SEGY_TR_SOURCE_MEASURE_UNIT ); diff --git a/lib/include/segyio/segy.h b/lib/include/segyio/segy.h index 8b67dae95..5dc7506f0 100644 --- a/lib/include/segyio/segy.h +++ b/lib/include/segyio/segy.h @@ -533,8 +533,9 @@ typedef enum { SEGY_TR_DEVICE_ID = 213, SEGY_TR_SCALAR_TRACE_HEADER = 215, SEGY_TR_SOURCE_TYPE = 217, - SEGY_TR_SOURCE_ENERGY_DIR_MANT = 219, - SEGY_TR_SOURCE_ENERGY_DIR_EXP = 223, + SEGY_TR_SOURCE_ENERGY_DIR_VERT = 219, + SEGY_TR_SOURCE_ENERGY_DIR_XLINE = 221, + SEGY_TR_SOURCE_ENERGY_DIR_ILINE = 223, SEGY_TR_SOURCE_MEASURE_MANT = 225, SEGY_TR_SOURCE_MEASURE_EXP = 229, SEGY_TR_SOURCE_MEASURE_UNIT = 231, diff --git a/lib/src/segy.c b/lib/src/segy.c index 274ff477b..c7c1aafcc 100644 --- a/lib/src/segy.c +++ b/lib/src/segy.c @@ -244,7 +244,6 @@ static int field_size[] = { [SEGY_TR_SHOT_POINT ] = 4, [SEGY_TR_SOURCE_DATUM_ELEV ] = 4, [SEGY_TR_SOURCE_DEPTH ] = 4, - [SEGY_TR_SOURCE_ENERGY_DIR_MANT ] = 4, [SEGY_TR_SOURCE_MEASURE_MANT ] = 4, [SEGY_TR_SOURCE_SURF_ELEV ] = 4, [SEGY_TR_SOURCE_WATER_DEPTH ] = 4, @@ -291,7 +290,9 @@ static int field_size[] = { [SEGY_TR_SCALAR_TRACE_HEADER ] = 2, [SEGY_TR_SEC_OF_MIN ] = 2, [SEGY_TR_SHOT_POINT_SCALAR ] = 2, - [SEGY_TR_SOURCE_ENERGY_DIR_EXP ] = 2, + [SEGY_TR_SOURCE_ENERGY_DIR_VERT ] = 2, + [SEGY_TR_SOURCE_ENERGY_DIR_XLINE] = 2, + [SEGY_TR_SOURCE_ENERGY_DIR_ILINE] = 2, [SEGY_TR_SOURCE_GROUP_SCALAR ] = 2, [SEGY_TR_SOURCE_MEASURE_EXP ] = 2, [SEGY_TR_SOURCE_MEASURE_UNIT ] = 2, @@ -1103,7 +1104,6 @@ static int bswap_th( char* xs, int lsb ) { SEGY_TR_SHOT_POINT, SEGY_TR_SOURCE_DATUM_ELEV, SEGY_TR_SOURCE_DEPTH, - SEGY_TR_SOURCE_ENERGY_DIR_MANT, SEGY_TR_SOURCE_MEASURE_MANT, SEGY_TR_SOURCE_SURF_ELEV, SEGY_TR_SOURCE_WATER_DEPTH, @@ -1160,7 +1160,9 @@ static int bswap_th( char* xs, int lsb ) { SEGY_TR_SCALAR_TRACE_HEADER, SEGY_TR_SEC_OF_MIN, SEGY_TR_SHOT_POINT_SCALAR, - SEGY_TR_SOURCE_ENERGY_DIR_EXP, + SEGY_TR_SOURCE_ENERGY_DIR_VERT, + SEGY_TR_SOURCE_ENERGY_DIR_XLINE, + SEGY_TR_SOURCE_ENERGY_DIR_ILINE, SEGY_TR_SOURCE_GROUP_SCALAR, SEGY_TR_SOURCE_MEASURE_EXP, SEGY_TR_SOURCE_MEASURE_UNIT, diff --git a/lib/test/segy.cpp b/lib/test/segy.cpp index 88a4bb1e5..ccf672990 100644 --- a/lib/test/segy.cpp +++ b/lib/test/segy.cpp @@ -561,7 +561,6 @@ TEST_CASE("testing size", "[c.segy]") { CHECK( 4 == size( SEGY_TR_SHOT_POINT )); CHECK( 4 == size( SEGY_TR_SOURCE_DATUM_ELEV )); CHECK( 4 == size( SEGY_TR_SOURCE_DEPTH )); - CHECK( 4 == size( SEGY_TR_SOURCE_ENERGY_DIR_MANT )); CHECK( 4 == size( SEGY_TR_SOURCE_SURF_ELEV )); CHECK( 4 == size( SEGY_TR_SOURCE_X )); CHECK( 4 == size( SEGY_TR_SOURCE_Y )); @@ -606,7 +605,9 @@ TEST_CASE("testing size", "[c.segy]") { CHECK( 2 == size( SEGY_TR_SCALAR_TRACE_HEADER )); CHECK( 2 == size( SEGY_TR_SEC_OF_MIN )); CHECK( 2 == size( SEGY_TR_SHOT_POINT_SCALAR )); - CHECK( 2 == size( SEGY_TR_SOURCE_ENERGY_DIR_EXP )); + CHECK( 2 == size( SEGY_TR_SOURCE_ENERGY_DIR_VERT )); + CHECK( 2 == size( SEGY_TR_SOURCE_ENERGY_DIR_XLINE )); + CHECK( 2 == size( SEGY_TR_SOURCE_ENERGY_DIR_ILINE )); CHECK( 2 == size( SEGY_TR_SOURCE_MEASURE_EXP )); CHECK( 2 == size( SEGY_TR_SOURCE_MEASURE_UNIT )); CHECK( 2 == size( SEGY_TR_SOURCE_STATIC_CORR )); diff --git a/mex/Segy.m b/mex/Segy.m index 9009adcaa..3c36f589b 100644 --- a/mex/Segy.m +++ b/mex/Segy.m @@ -603,8 +603,9 @@ tr_heads.TraceIdentifier = segy_get_field_mex( header, 213 ); tr_heads.ScalarTraceHeader = segy_get_field_mex( header, 215 ); tr_heads.SourceType = segy_get_field_mex( header, 217 ); - tr_heads.SourceEnergyDirectionMantissa = segy_get_field_mex( header, 219 ); - tr_heads.SourceEnergyDirectionExponent = segy_get_field_mex( header, 223 ); + tr_heads.SourceEnergyDirectionVert = segy_get_field_mex( header, 219 ); + tr_heads.SourceEnergyDirectionXline = segy_get_field_mex( header, 221 ); + tr_heads.SourceEnergyDirectionIline = segy_get_field_mex( header, 223 ); tr_heads.SourceMeasurementMantissa = segy_get_field_mex( header, 225 ); tr_heads.SourceMeasurementExponent = segy_get_field_mex( header, 229 ); tr_heads.SourceMeasurementUnit = segy_get_field_mex( header, 231 ); diff --git a/mex/TraceField.m b/mex/TraceField.m index cef7ec4d3..db96e2e8b 100644 --- a/mex/TraceField.m +++ b/mex/TraceField.m @@ -85,8 +85,9 @@ TraceIdentifier (213) ScalarTraceHeader (215) SourceType (217) - SourceEnergyDirectionMantissa (219) - SourceEnergyDirectionExponent (223) + SourceEnergyDirectionVert (219) + SourceEnergyDirectionXline (221) + SourceEnergyDirectionIline (223) SourceMeasurementMantissa (225) SourceMeasurementExponent (229) SourceMeasurementUnit (231) diff --git a/python/segyio/field.py b/python/segyio/field.py index f749ee7dc..4302b59b9 100644 --- a/python/segyio/field.py +++ b/python/segyio/field.py @@ -122,8 +122,9 @@ class Field(MutableMapping): 'triden': TraceField.TraceIdentifier, 'sctrh' : TraceField.ScalarTraceHeader, 'stype' : TraceField.SourceType, - 'sedm' : TraceField.SourceEnergyDirectionMantissa, - 'sede' : TraceField.SourceEnergyDirectionExponent, + 'sedv' : TraceField.SourceEnergyDirectionVert, + 'sedxl' : TraceField.SourceEnergyDirectionXline, + 'sedil' : TraceField.SourceEnergyDirectionIline, 'smm' : TraceField.SourceMeasurementMantissa, 'sme' : TraceField.SourceMeasurementExponent, 'smunit': TraceField.SourceMeasurementUnit, diff --git a/python/segyio/su/words.py b/python/segyio/su/words.py index 17babdf11..f5f6fd911 100644 --- a/python/segyio/su/words.py +++ b/python/segyio/su/words.py @@ -191,9 +191,11 @@ #: stype = tf.SourceType #: -sedm = tf.SourceEnergyDirectionMantissa +sedv = tf.SourceEnergyDirectionVert #: -sede = tf.SourceEnergyDirectionExponent +sedxl = tf.SourceEnergyDirectionXline +#: +sedil = tf.SourceEnergyDirectionIline #: smm = tf.SourceMeasurementMantissa #: diff --git a/python/segyio/tracefield.py b/python/segyio/tracefield.py index aff65a8e1..98b73a580 100644 --- a/python/segyio/tracefield.py +++ b/python/segyio/tracefield.py @@ -92,8 +92,9 @@ class TraceField(Enum): TraceIdentifier = 213 ScalarTraceHeader = 215 SourceType = 217 - SourceEnergyDirectionMantissa = 219 - SourceEnergyDirectionExponent = 223 + SourceEnergyDirectionVert = 219 + SourceEnergyDirectionXline = 221 + SourceEnergyDirectionIline = 223 SourceMeasurementMantissa = 225 SourceMeasurementExponent = 229 SourceMeasurementUnit = 231 @@ -185,8 +186,9 @@ class TraceField(Enum): 'TraceIdentifier' : 213, 'ScalarTraceHeader' : 215, 'SourceType' : 217, - 'SourceEnergyDirectionMantissa' : 219, - 'SourceEnergyDirectionExponent' : 223, + 'SourceEnergyDirectionVert' : 219, + 'SourceEnergyDirectionXline' : 221, + 'SourceEnergyDirectionIline' : 223, 'SourceMeasurementMantissa' : 225, 'SourceMeasurementExponent' : 229, 'SourceMeasurementUnit' : 231, diff --git a/python/test/segy.py b/python/test/segy.py index a180d900c..2eca1f2c0 100644 --- a/python/test/segy.py +++ b/python/test/segy.py @@ -329,10 +329,10 @@ def test_disabled_methods_seismic_unix(openfn, kwargs): @pytest.mark.parametrize(('openfn', 'kwargs'), small_segys) def test_header_dict_methods(openfn, kwargs): with openfn(**kwargs) as f: - assert 89 == len(list(f.header[0].keys())) - assert 89 == len(list(f.header[1].values())) - assert 89 == len(list(f.header[2].items())) - assert 89 == len(list(f.header[3])) + assert 90 == len(list(f.header[0].keys())) + assert 90 == len(list(f.header[1].values())) + assert 90 == len(list(f.header[2].items())) + assert 90 == len(list(f.header[3])) assert 0 not in f.header[0] assert 1 in f.header[0] assert segyio.su.cdpx in f.header[0]