[segyio] 342/376: Add application segyio-catr
Jørgen Kvalsvik
jokva-guest at moszumanska.debian.org
Wed Sep 20 08:04:56 UTC 2017
This is an automated email from the git hooks/post-receive script.
jokva-guest pushed a commit to branch debian
in repository segyio.
commit 9a3cabe23091824e225d395f11308d93da1e8243
Author: erha <erha at statoil.com>
Date: Tue Jul 25 08:09:09 2017 +0200
Add application segyio-catr
---
applications/CMakeLists.txt | 10 +
applications/segyio-catr.c | 537 ++++++++++++++++++++++++++++++++++++++++++++
applications/test/apps.py | 166 ++++++++++++++
man/segyio-catr.1 | 59 +++++
4 files changed, 772 insertions(+)
diff --git a/applications/CMakeLists.txt b/applications/CMakeLists.txt
index cb19a71..121f988 100644
--- a/applications/CMakeLists.txt
+++ b/applications/CMakeLists.txt
@@ -32,8 +32,18 @@ target_compile_definitions(segyio-crop PRIVATE
-Dsegyio_MINOR=${segyio_MINOR}
)
+add_executable(segyio-catr segyio-catr.c)
+target_link_libraries(segyio-catr segyio apputils)
+target_compile_definitions(segyio-catr PRIVATE
+ -Dsegyio_MAJOR=${segyio_MAJOR}
+ -Dsegyio_MINOR=${segyio_MINOR}
+)
+
install(TARGETS segyinfo DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
install(TARGETS segyinspect DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
install(TARGETS segyio-cath DESTINATION ${CMAKE_INSTALL_BINDIR})
+install(TARGETS segyio-catr DESTINATION ${CMAKE_INSTALL_BINDIR})
install(TARGETS segyio-crop DESTINATION ${CMAKE_INSTALL_BINDIR})
+
+add_python_test(applications.apps test/apps.py)
diff --git a/applications/segyio-catr.c b/applications/segyio-catr.c
new file mode 100644
index 0000000..b91d020
--- /dev/null
+++ b/applications/segyio-catr.c
@@ -0,0 +1,537 @@
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <getopt.h>
+#include <unistd.h>
+
+#include <segyio/segy.h>
+#include "apputils.c"
+
+#define TRHSIZE SEGY_TRACE_HEADER_SIZE
+#define BINSIZE SEGY_BINARY_HEADER_SIZE
+
+static const int fields[] = {
+ SEGY_TR_SEQ_LINE ,
+ SEGY_TR_SEQ_FILE ,
+ SEGY_TR_FIELD_RECORD ,
+ SEGY_TR_NUMBER_ORIG_FIELD ,
+ SEGY_TR_ENERGY_SOURCE_POINT ,
+ SEGY_TR_ENSEMBLE ,
+ SEGY_TR_NUM_IN_ENSEMBLE ,
+ SEGY_TR_TRACE_ID ,
+ SEGY_TR_SUMMED_TRACES ,
+ SEGY_TR_STACKED_TRACES ,
+ SEGY_TR_DATA_USE ,
+ SEGY_TR_OFFSET ,
+ SEGY_TR_RECV_GROUP_ELEV ,
+ SEGY_TR_SOURCE_SURF_ELEV ,
+ SEGY_TR_SOURCE_DEPTH ,
+ SEGY_TR_RECV_DATUM_ELEV ,
+ SEGY_TR_SOURCE_DATUM_ELEV ,
+ SEGY_TR_SOURCE_WATER_DEPTH ,
+ SEGY_TR_GROUP_WATER_DEPTH ,
+ SEGY_TR_ELEV_SCALAR ,
+ SEGY_TR_SOURCE_GROUP_SCALAR ,
+ SEGY_TR_SOURCE_X ,
+ SEGY_TR_SOURCE_Y ,
+ SEGY_TR_GROUP_X ,
+ SEGY_TR_GROUP_Y ,
+ SEGY_TR_COORD_UNITS ,
+ SEGY_TR_WEATHERING_VELO ,
+ SEGY_TR_SUBWEATHERING_VELO ,
+ SEGY_TR_SOURCE_UPHOLE_TIME ,
+ SEGY_TR_GROUP_UPHOLE_TIME ,
+ SEGY_TR_SOURCE_STATIC_CORR ,
+ SEGY_TR_GROUP_STATIC_CORR ,
+ SEGY_TR_TOT_STATIC_APPLIED ,
+ SEGY_TR_LAG_A ,
+ SEGY_TR_LAG_B ,
+ SEGY_TR_DELAY_REC_TIME ,
+ SEGY_TR_MUTE_TIME_START ,
+ SEGY_TR_MUTE_TIME_END ,
+ SEGY_TR_SAMPLE_COUNT ,
+ SEGY_TR_SAMPLE_INTER ,
+ SEGY_TR_GAIN_TYPE ,
+ SEGY_TR_INSTR_GAIN_CONST ,
+ SEGY_TR_INSTR_INIT_GAIN ,
+ SEGY_TR_CORRELATED ,
+ SEGY_TR_SWEEP_FREQ_START ,
+ SEGY_TR_SWEEP_FREQ_END ,
+ SEGY_TR_SWEEP_LENGTH ,
+ SEGY_TR_SWEEP_TYPE ,
+ SEGY_TR_SWEEP_TAPERLEN_START ,
+ SEGY_TR_SWEEP_TAPERLEN_END ,
+ SEGY_TR_TAPER_TYPE ,
+ SEGY_TR_ALIAS_FILT_FREQ ,
+ SEGY_TR_ALIAS_FILT_SLOPE ,
+ SEGY_TR_NOTCH_FILT_FREQ ,
+ SEGY_TR_NOTCH_FILT_SLOPE ,
+ SEGY_TR_LOW_CUT_FREQ ,
+ SEGY_TR_HIGH_CUT_FREQ ,
+ SEGY_TR_LOW_CUT_SLOPE ,
+ SEGY_TR_HIGH_CUT_SLOPE ,
+ SEGY_TR_YEAR_DATA_REC ,
+ SEGY_TR_DAY_OF_YEAR ,
+ SEGY_TR_HOUR_OF_DAY ,
+ SEGY_TR_MIN_OF_HOUR ,
+ SEGY_TR_SEC_OF_MIN ,
+ SEGY_TR_TIME_BASE_CODE ,
+ SEGY_TR_WEIGHTING_FAC ,
+ SEGY_TR_GEOPHONE_GROUP_ROLL1 ,
+ SEGY_TR_GEOPHONE_GROUP_FIRST ,
+ SEGY_TR_GEOPHONE_GROUP_LAST ,
+ SEGY_TR_GAP_SIZE ,
+ SEGY_TR_OVER_TRAVEL ,
+ SEGY_TR_CDP_X ,
+ SEGY_TR_CDP_Y ,
+ SEGY_TR_INLINE ,
+ SEGY_TR_CROSSLINE ,
+ SEGY_TR_SHOT_POINT ,
+ SEGY_TR_SHOT_POINT_SCALAR ,
+ SEGY_TR_MEASURE_UNIT ,
+ SEGY_TR_TRANSDUCTION_MANT ,
+ SEGY_TR_TRANSDUCTION_EXP ,
+ SEGY_TR_TRANSDUCTION_UNIT ,
+ 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_MEASURE_MANT ,
+ SEGY_TR_SOURCE_MEASURE_EXP ,
+ SEGY_TR_SOURCE_MEASURE_UNIT ,
+ SEGY_TR_UNASSIGNED1 ,
+ SEGY_TR_UNASSIGNED2
+};
+
+static const char* su[91] = {
+ "tracl" ,
+ "tracr" ,
+ "fldr" ,
+ "tracf" ,
+ "ep" ,
+ "cdp" ,
+ "cdpt" ,
+ "trid" ,
+ "nvs" ,
+ "nhs" ,
+ "duse" ,
+ "offset" ,
+ "gelev" ,
+ "selev" ,
+ "sdepth" ,
+ "gdel" ,
+ "sdel" ,
+ "swdep" ,
+ "gwdep" ,
+ "scalel" ,
+ "scalco" ,
+ "sx" ,
+ "sy" ,
+ "gx" ,
+ "gy" ,
+ "counit" ,
+ "wevel" ,
+ "swevel" ,
+ "sut" ,
+ "gut" ,
+ "sstat" ,
+ "gstat" ,
+ "tstat" ,
+ "laga" ,
+ "lagb" ,
+ "delrt" ,
+ "muts" ,
+ "mute" ,
+ "ns" ,
+ "dt" ,
+ "gain" ,
+ "igc" ,
+ "igi" ,
+ "corr" ,
+ "sfs" ,
+ "sfe" ,
+ "slen" ,
+ "styp" ,
+ "stat" ,
+ "stae" ,
+ "tatyp" ,
+ "afilf" ,
+ "afils" ,
+ "nofilf" ,
+ "nofils" ,
+ "lcf" ,
+ "hcf" ,
+ "lcs" ,
+ "hcs" ,
+ "year" ,
+ "day" ,
+ "hour" ,
+ "minute" ,
+ "sec" ,
+ "timbas" ,
+ "trwf" ,
+ "grnors" ,
+ "grnofr" ,
+ "grnlof" ,
+ "gaps" ,
+ "otrav" ,
+ "cdpx" ,
+ "cdpy" ,
+ "iline" ,
+ "xline" ,
+ "sp" ,
+ "scalsp" ,
+ "trunit" ,
+ "tdcm" ,
+ "tdcp" ,
+ "tdunit" ,
+ "triden" ,
+ "sctrh" ,
+ "stype" ,
+ "sedm" ,
+ "sede" ,
+ "smm" ,
+ "sme" ,
+ "smunit" ,
+ "uint1" ,
+ "uint2"
+};
+
+static const char* segynames[91] = {
+ "SEQ_LINE" ,
+ "SEQ_FILE" ,
+ "FIELD_RECORD" ,
+ "NUMBER_ORIG_FIELD" ,
+ "ENERGY_SOURCE_POINT" ,
+ "ENSEMBLE" ,
+ "NUM_IN_ENSEMBLE" ,
+ "TRACE_ID" ,
+ "SUMMED_TRACES" ,
+ "STACKED_TRACES" ,
+ "DATA_USE" ,
+ "OFFSET" ,
+ "RECV_GROUP_ELEV" ,
+ "SOURCE_SURF_ELEV" ,
+ "SOURCE_DEPTH" ,
+ "RECV_DATUM_ELEV" ,
+ "SOURCE_DATUM_ELEV" ,
+ "SOURCE_WATER_DEPTH" ,
+ "GROUP_WATER_DEPTH" ,
+ "ELEV_SCALAR" ,
+ "SOURCE_GROUP_SCALAR" ,
+ "SOURCE_X" ,
+ "SOURCE_Y" ,
+ "GROUP_X" ,
+ "GROUP_Y" ,
+ "COORD_UNITS" ,
+ "WEATHERING_VELO" ,
+ "SUBWEATHERING_VELO" ,
+ "SOURCE_UPHOLE_TIME" ,
+ "GROUP_UPHOLE_TIME" ,
+ "SOURCE_STATIC_CORR" ,
+ "GROUP_STATIC_CORR" ,
+ "TOT_STATIC_APPLIED" ,
+ "LAG_A" ,
+ "LAG_B" ,
+ "DELAY_REC_TIME" ,
+ "MUTE_TIME_START" ,
+ "MUTE_TIME_END" ,
+ "SAMPLE_COUNT" ,
+ "SAMPLE_INTER" ,
+ "GAIN_TYPE" ,
+ "INSTR_GAIN_CONST" ,
+ "INSTR_INIT_GAIN" ,
+ "CORRELATED" ,
+ "SWEEP_FREQ_START" ,
+ "SWEEP_FREQ_END" ,
+ "SWEEP_LENGTH" ,
+ "SWEEP_TYPE" ,
+ "SWEEP_TAPERLEN_START",
+ "SWEEP_TAPERLEN_END" ,
+ "TAPER_TYPE" ,
+ "ALIAS_FILT_FREQ" ,
+ "ALIAS_FILT_SLOPE" ,
+ "NOTCH_FILT_FREQ" ,
+ "NOTCH_FILT_SLOPE" ,
+ "LOW_CUT_FREQ" ,
+ "HIGH_CUT_FREQ" ,
+ "LOW_CUT_SLOPE" ,
+ "HIGH_CUT_SLOPE" ,
+ "YEAR_DATA_REC" ,
+ "DAY_OF_YEAR" ,
+ "HOUR_OF_DAY" ,
+ "MIN_OF_HOUR" ,
+ "SEC_OF_MIN" ,
+ "TIME_BASE_CODE" ,
+ "WEIGHTING_FAC" ,
+ "GEOPHONE_GROUP_ROLL1",
+ "GEOPHONE_GROUP_FIRST",
+ "GEOPHONE_GROUP_LAST" ,
+ "GAP_SIZE" ,
+ "OVER_TRAVEL" ,
+ "CDP_X" ,
+ "CDP_Y" ,
+ "INLINE" ,
+ "CROSSLINE" ,
+ "SHOT_POINT" ,
+ "SHOT_POINT_SCALAR" ,
+ "MEASURE_UNIT" ,
+ "TRANSDUCTION_MANT" ,
+ "TRANSDUCTION_EXP" ,
+ "TRANSDUCTION_UNIT" ,
+ "DEVICE_ID" ,
+ "SCALAR_TRACE_HEADER" ,
+ "SOURCE_TYPE" ,
+ "SOURCE_ENERGY_DIR_MA",
+ "SOURCE_ENERGY_DIR_EX",
+ "SOURCE_MEASURE_MANT" ,
+ "SOURCE_MEASURE_EXP" ,
+ "SOURCE_MEASURE_UNIT" ,
+ "UNASSIGNED1" ,
+ "UNASSIGNED2"
+};
+
+static int help() {
+ puts( "Usage: segyio-catr [OPTION]... FILE\n"
+ "Print specific trace headers from FILE\n"
+ "\n"
+ "-t, --trace=NUMBER trace to print\n"
+ "-r, --range=NUMBER range of traces to print\n"
+ "-s, --strict fail on unreadable tracefields\n"
+ "-S, --non-strict don't fail on unreadable tracefields\n"
+ " this is the default behaviour\n"
+ "-n, --segyio-names print with segyio tracefield names\n"
+ "-v, --verbose increase verbosity\n"
+ " --version output version information and exit\n"
+ " --help display this help and exit\n"
+ "\n"
+
+ "The -r flag can takes up to three values; start, stop, step,\n"
+ "where all values are defaulted to zero\n"
+ "Flags -r and -t can be called multiple times\n"
+ );
+ return 0;
+}
+
+static int printversion() {
+ printf( "Segyio-catr (segyio version %d.%d)\n", segyio_MAJOR, segyio_MINOR );
+ return 0;
+}
+
+typedef struct { int start, stop, step; } range;
+
+struct options {
+ char* src;
+ range* r;
+ int rsize;
+ int verbosity;
+ int version, help;
+ int strict, labels;
+ const char* errmsg;
+};
+
+enum { su_labels, segyio_labels } label_ids;
+
+static range fill_range( range r, int field, int val ) {
+ switch( field ) {
+ case 0: r.start = val; return r;
+ case 1: r.stop = val; return r;
+ case 2: r.step = val; return r;
+ default:
+ exit( 12 );
+ }
+}
+
+static struct options parse_options( int argc, char** argv ){
+ int rallocsize = 32;
+
+ struct options opts;
+ opts.rsize = 0; opts.r = calloc( sizeof( range ), rallocsize );
+ opts.verbosity = 0;
+ opts.version = 0; opts.help = 0;
+ opts.strict = 0; opts.labels = su_labels;
+ opts.errmsg = NULL;
+
+ struct options opthelp, optversion;
+ opthelp.help = 1; opthelp.errmsg = NULL;
+ optversion.version = 1, optversion.errmsg = NULL;
+
+ static struct option long_options[] = {
+ { "trace", required_argument, 0, 't' },
+ { "range", required_argument, 0, 'r' },
+ { "segyio", no_argument, 0, 'k' },
+ { "strict", no_argument, 0, 's' },
+ { "non-strict", no_argument, 0, 'S' },
+ { "verbose", no_argument, 0, 'v' },
+ { "version", no_argument, 0, 'V' },
+ { "help", no_argument, 0, 'h' },
+ { 0, 0, 0, 0,}
+ };
+
+ static const char* parsenum_errmsg[] = { "",
+ "num must be an integer",
+ "num must be non-negative" };
+ opterr = 1;
+ while( true ) {
+ int option_index = 0;
+ int c = getopt_long( argc, argv, "sSkvt:r:",
+ long_options, &option_index );
+
+ if( c == -1 ) break;
+
+ int ret;
+ switch( c ) {
+ case 0: break;
+ case 'h': return opthelp;
+ case 'V': return optversion;
+ case 'v': ++opts.verbosity; break;
+ case 's': opts.strict = 1; break;
+ case 'S': opts.strict = 0; break;
+ case 'k': opts.labels = segyio_labels; break;
+ case 'r': // intentional fallthrough
+ case 't':
+ if( opts.rsize == rallocsize ) {
+ rallocsize *= 2;
+ range* re = realloc( opts.r, rallocsize*sizeof( range ) );
+ if( !re ) {
+ opts.errmsg = "Unable to reallocate memory";
+ return opts;
+ }
+ opts.r = re;
+ }
+
+ range* r = opts.r + opts.rsize;
+ r->start = r->stop = r->step = 0;
+
+ if( c == 't' ) {
+ ret = parseint( optarg, &r->start );
+
+ if( ret ) {
+ opts.errmsg = parsenum_errmsg[ ret ];
+ return opts;
+ }
+
+ goto done;
+ }
+
+ ret = sscanf(optarg," %d %d %d", &r->start,
+ &r->stop,
+ &r->step );
+ if( ret && (r->start < 0 || r->stop < 0 || r->step < 0 ) ) {
+ opts.errmsg = "POSITIVE";
+ return opts;
+ }
+
+ // if sscanf found something it consumes 1 argument, and we won't have to rewind optind
+ if( !ret ) optind--;
+
+ for( int pos = ret; optind < argc && pos < 3; pos++, optind++ ) {
+ int val;
+ ret = parseint( argv[ optind ], &val );
+ /* parseint returns 1 when the string contains more
+ * than an int (or not an int at all)
+ * we assume that the remaining range parameters
+ * were defaulted and give control back to argument parsing
+ *
+ * such invocations include:
+ * segyio-catr -r 1 foo.sgy
+ * segyio-catr -r 1 2 -s foo.sgy
+ */
+ if( ret == 0 ) *r = fill_range( *r, pos, val );
+ if( ret == 1 ) goto done;
+ if( ret == 2 ) {
+ opts.errmsg = parsenum_errmsg[ ret ];
+ return opts;
+ }
+ }
+
+ done: ++opts.rsize; break;
+
+ default: return opthelp;
+ }
+ }
+
+ if( argc - optind != 1 ) {
+ errmsg( 0, "Wrong number of files" );
+ return opthelp;
+ }
+ opts.src = argv[ optind ];
+
+ if( opts.rsize == 0 ) opts.rsize = 1;
+
+ return opts;
+}
+
+int main( int argc, char** argv ) {
+ struct options opts = parse_options( argc, argv );
+
+ if( opts.help ) return help();
+ if( opts.version ) return printversion();
+ if( opts.errmsg ) return errmsg( EINVAL, opts.errmsg );
+
+ int strict = opts.strict;
+
+ const char** labels;
+ switch( opts.labels ) {
+ case su_labels: labels = su; break;
+ case segyio_labels: labels = segynames; break;
+ default: labels = su; break;
+ }
+
+ for( range* r = opts.r; r < opts.r + opts.rsize; ++r ) {
+ if( r->start > r->stop && strict )
+ return errmsg( -3, "Range is empty" );
+ }
+
+ char trheader[ TRHSIZE ];
+ char binheader[ BINSIZE ];
+
+ segy_file* src = segy_open( opts.src, "r" );
+ if( !src )
+ return errmsg2( errno, "Unable to open src", strerror( errno ) );
+
+ int err = segy_binheader( src, binheader );
+ if( err )
+ return errmsg( errno, "Unable to read binheader" );
+
+ int samnr = segy_samples( binheader );
+ int trace_bsize = segy_trace_bsize( samnr );
+ long trace0 = segy_trace0( binheader );
+
+ int numtrh;
+ err = segy_traces( src, &numtrh, trace0, trace_bsize );
+ if( err )
+ return errmsg( errno, "Unable to determine number of traces in file" );
+
+ for( range* r = opts.r; r < opts.r + opts.rsize; ++r ) {
+ if( r->stop == 0 ) r->stop = r->start;
+ if( r->step == 0 ) r->step = 1;
+ }
+
+ for( range* r = opts.r; r < opts.r + opts.rsize; ++r ) {
+ for( int i = r->start; i <= r->stop; i += r->step ) {
+ if( i > numtrh && strict )
+ return errmsg2( errno, "Unable to read traceheader",
+ "out of range" );
+ if( i > numtrh ) break;
+
+ err = segy_traceheader( src, i - 1, trheader, trace0, trace_bsize );
+ if( err )
+ return errmsg( errno, "Unable to read trace header" );
+
+ for( int j = 0; j < 91; j++ ) {
+ int f;
+ segy_get_field( trheader, fields[j], &f );
+ printf( "%s\t%d\n", labels[j], f );
+ }
+ }
+ }
+ free( opts.r );
+ segy_close( src );
+
+ return 0;
+}
+
diff --git a/applications/test/apps.py b/applications/test/apps.py
new file mode 100644
index 0000000..e08450f
--- /dev/null
+++ b/applications/test/apps.py
@@ -0,0 +1,166 @@
+from unittest import TestCase
+
+import subprocess
+
+class appTest(TestCase):
+ def setUp(self):
+ self.file_path = "../python/test-data/small.sgy"
+ self.cmd_base = ".././applications/segyio-catr"
+ self.ref_list = [
+ b'tracl\t0',
+ b'tracr\t0',
+ b'fldr\t0',
+ b'tracf\t0',
+ b'ep\t0',
+ b'cdp\t0',
+ b'cdpt\t0',
+ b'trid\t0',
+ b'nvs\t0',
+ b'nhs\t0',
+ b'duse\t0',
+ b'offset\t1',
+ b'gelev\t0',
+ b'selev\t0',
+ b'sdepth\t0',
+ b'gdel\t0',
+ b'sdel\t0',
+ b'swdep\t0',
+ b'gwdep\t0',
+ b'scalel\t0',
+ b'scalco\t0',
+ b'sx\t0',
+ b'sy\t0',
+ b'gx\t0',
+ b'gy\t0',
+ b'counit\t0',
+ b'wevel\t0',
+ b'swevel\t0',
+ b'sut\t0',
+ b'gut\t0',
+ b'sstat\t0',
+ b'gstat\t0',
+ b'tstat\t0',
+ b'laga\t0',
+ b'lagb\t0',
+ b'delrt\t0',
+ b'muts\t0',
+ b'mute\t0',
+ b'ns\t0',
+ b'dt\t0',
+ b'gain\t0',
+ b'igc\t0',
+ b'igi\t0',
+ b'corr\t0',
+ b'sfs\t0',
+ b'sfe\t0',
+ b'slen\t0',
+ b'styp\t0',
+ b'stat\t0',
+ b'stae\t0',
+ b'tatyp\t0',
+ b'afilf\t0',
+ b'afils\t0',
+ b'nofilf\t0',
+ b'nofils\t0',
+ b'lcf\t0',
+ b'hcf\t0',
+ b'lcs\t0',
+ b'hcs\t0',
+ b'year\t0',
+ b'day\t0',
+ b'hour\t0',
+ b'minute\t0',
+ b'sec\t0',
+ b'timbas\t0',
+ b'trwf\t0',
+ b'grnors\t0',
+ b'grnofr\t0',
+ b'grnlof\t0',
+ b'gaps\t0',
+ b'otrav\t0',
+ b'cdpx\t0',
+ b'cdpy\t0',
+ b'iline\t2',
+ b'xline\t20',
+ b'sp\t0',
+ b'scalsp\t0',
+ b'trunit\t0',
+ b'tdcm\t0',
+ b'tdcp\t0',
+ b'tdunit\t0',
+ b'triden\t0',
+ b'sctrh\t0',
+ b'stype\t0',
+ b'sedm\t0',
+ b'sede\t0',
+ b'smm\t0',
+ b'sme\t0',
+ b'smunit\t0',
+ b'uint1\t0',
+ b'uint2\t0']
+
+ def test_segycatr_argparse_t(self):
+ cmd = [self.cmd_base, "-t 5", self.file_path]
+ subprocess.check_call(cmd)
+
+ def test_segycatr_argparse_r1(self):
+ cmd = [self.cmd_base, "-r 5", self.file_path]
+ subprocess.check_call(cmd)
+
+ def test_segycatr_argparse_r2(self):
+ cmd = [self.cmd_base, "-r 1 2", self.file_path]
+ subprocess.check_call(cmd)
+
+ def test_segycatr_argparse_r3(self):
+ cmd = [self.cmd_base, "-r 1 2 3", self.file_path, "-r 5 6"]
+ subprocess.check_call(cmd)
+
+ def test_segycatr_argparse_r_multiple(self):
+ cmd = [self.cmd_base, "-r 1", "5", "2", self.file_path, "-r 1 2"]
+ subprocess.check_call(cmd)
+
+ def test_segycatr_argparse_r_t(self):
+ cmd = [self.cmd_base, "-r 1 2", self.file_path, "-t 5"]
+ subprocess.check_call(cmd)
+
+ def test_segycatr_output_t(self):
+ cmd = [self.cmd_base, self.file_path, "-t 6"]
+ res = subprocess.Popen(cmd, stdout=subprocess.PIPE).communicate()[0]
+ res_list = res.split(b"\n")
+ for i in range(len(self.ref_list)):
+ self.assertEquals(self.ref_list[i], res_list[i])
+
+ def test_segycatr_output_r1(self):
+ cmd = [self.cmd_base, self.file_path, "-r 6"]
+ res = subprocess.Popen(cmd, stdout=subprocess.PIPE).communicate()[0]
+ res_list = res.split(b"\n")
+ for i in range(len(self.ref_list)):
+ self.assertEquals(self.ref_list[i], res_list[i])
+
+ def test_segycatr_output_r2(self):
+ cmd = [self.cmd_base, self.file_path, "-r 1 6"]
+ res = subprocess.Popen(cmd, stdout=subprocess.PIPE).communicate()[0]
+ res_list = res.split(b"\n")
+ for i in range(len(self.ref_list)):
+ self.assertEquals(self.ref_list[i], res_list[i+455])
+
+ def test_segycatr_output_r3(self):
+ cmd = [self.cmd_base, self.file_path, "-r 5 7 1"]
+ res = subprocess.Popen(cmd, stdout=subprocess.PIPE).communicate()[0]
+ res_list = res.split(b"\n")
+ for i in range(len(self.ref_list)):
+ self.assertEquals(self.ref_list[i], res_list[i+91])
+
+ def test_segycatr_output_r_multiple(self):
+ cmd = [self.cmd_base, self.file_path, "-r 1 2", "-r 6 7"]
+ res = subprocess.Popen(cmd, stdout=subprocess.PIPE).communicate()[0]
+ res_list = res.split(b"\n")
+ for i in range(len(self.ref_list)):
+ self.assertEquals(self.ref_list[i], res_list[i+182])
+
+ def test_segycatr_output_r_t(self):
+ cmd = [self.cmd_base, self.file_path, "-r 4 9", "-t 12"]
+ res = subprocess.Popen(cmd, stdout=subprocess.PIPE).communicate()[0]
+ res_list = res.split(b"\n")
+ for i in range(len(self.ref_list)):
+ self.assertEquals(self.ref_list[i], res_list[i+182])
diff --git a/man/segyio-catr.1 b/man/segyio-catr.1
new file mode 100644
index 0000000..d685a64
--- /dev/null
+++ b/man/segyio-catr.1
@@ -0,0 +1,59 @@
+.TH SEGYIO-CATR 1
+.SH NAME
+segyio-catr \- Print selected headers from FILE
+.SH SYNPOSIS
+.B segyio-catr
+[\fIOPTION\fR]...
+\fIFILE\fR
+.SH DESCRIPTION
+.B segyio-cath
+Print selected traceheaders from SEG-Y file FILE
+
+.PP
+
+The flag\fB-r\fR takes up to three vales; START, STOP, STEP, which is a closed inteval from START to STOP.
+The third value STEP can be specified to print i.e. every other trace in the interval. All values are defaulted to zero.
+Flags \fB-r\fR and \fB-t\fR can be called multiple times.
+
+.PP
+Mandatory arguments to long options are mandatory for short options too.
+
+.SH OPTIONS
+.TP
+.BR \-t ", " \-\-trace =\fINUMBER\fR
+trace(s) to print
+
+.TP
+.BR \-r ", " \-\-range=\fINUMBER\fR
+trace to print from
+
+.TP
+.BR \-s ", " \-\-strict
+fail on unreadable tracefields
+
+.TP
+.BR \-S ", " \-\-non-strict
+don't fail on unreadable tracefields
+this is the default behavior
+
+.TP
+.BR \-n ", " \-\-segyio-names
+print with segyio tracefield names
+
+.TP
+.BR \-v ", " \-\-verbose
+increase verbosity
+
+.TP
+.BR \-\-version
+output version information and exit
+
+.TP
+.BR \-\-help
+display this help and exit
+
+.SH COPYRIGHT
+Copyright © Statoil ASA. License LGPLv3+: GNU LGPL version 3 or later <http://gnu.org/licenses/lgpl.html>.
+
+.PP
+This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/segyio.git
More information about the debian-science-commits
mailing list