Commit 6cc61f06 authored by Giuseppe Stanghellini's avatar Giuseppe Stanghellini

BUGFIX

parent 143f9e8e
......@@ -2,9 +2,13 @@
segy-change: a progam to read and optionally change
the contents of segy seismic data files.
Copyright (C) 2009, Giuseppe Stanghellini (1), Gabriela Carrara (2).
If you use this software for scientific publication, please cite:
G. Stanghellini, G. Carrara
Segy-change: The swiss army knife for the SEG-Y files
SoftwareX, Volume 6, 2017, Pages 42–47, DOI:10.1016/j.softx.2017.01.003Copyright (C) 2009, Giuseppe Stanghellini (1), Gabriela Carrara (2).
(1) Istituto di Scienze Marine, Geologia Marina, CNR, Bologna, Italy
(2) LNEG – Marine Geology Department, Portugal
(2) Independent Researcher, Monte San Pietro, Italy
This program comes with ABSOLUTELY NO WARRANTY! see GPLV3.
This is free software, and you are welcome to redistribute it
......@@ -17,11 +21,11 @@ Usage : segy-change [options] -f input_file [-o output_file]
-f input_file : The input file (use "-" for stdin)
-o output_file : The output file (use "-" for stdout)
Options:
Switches:
-flip_endianess : Flip endianess, useful to make
the file conformant to SEGY standard.
-all : Process the whole file. If you do not use this one
you should use the '-shot' and/or '-trace' switches
you should use the '-record' and/or '-trace' switches
to set the part of the segy file that will be
processed.
-change_header_fields : Change SEGY header fields given an offset,
......@@ -39,8 +43,10 @@ Usage : segy-change [options] -f input_file [-o output_file]
obtained by the -dump_trace_fields switch,
with or without the -use_names switch.
-dump_xy : Print x and y location to stdout.
SOURCE|RECEIVER the word SOURCE or RECEIVER must be given, according to locations to print.
-add_xy : Add shot coordinates (in m, feet or arcsec) to trace
SOURCE|RECEIVER the word SOURCE or RECEIVER must be given, according
to locations to print.
-vertical_stack num : Do a vertical stack, summing num samples together
-add_xy : Add coordinates (in m, feet or arcsec) to trace
fname,SOURCE|RECEIVER header, given a filename and one of the two words
SOURCE or RECEIVER, depending on whose entries of the
trace headers we want to update.
......@@ -59,23 +65,27 @@ Usage : segy-change [options] -f input_file [-o output_file]
5 1 1 3608 4200 105 meters
...
NOTE: to have the lines with the first three numbers
of that file, execute:
of a given file, execute:
segy-change -print_rec_seq_num -all -f segyfile
you can then just add coordinates and the unit of
measure in the proper format for each line.
-convert S|I|F : Convert the trace encoding to the given format, where
-do_op +|-|*|/:VAL : Do the given operation, for example to multiply all
trace values by 3.0 use: -do_op *:3.0
-convert S|I|F|E : Convert the trace encoding to the given format, where
S: short
I: integer
F: IBM floating point.
F: IBM floating point
E: IEEE 754.
-do_ps siz,n,sc : Plot the segy to a postscript file where:
siz = paper size (for example A4)
n = number of traces to plot
n = number of traces per cm to plot
sc = factor to multiply trace values, darkening
(if>1) or lightening (if<1) the plot.
Valid paper sizes are: A0,A1,A2,A3,A4.
-print_rec_seq_num : Print to stdout the original_field_record_number,
trace_sequence_within_line and
trace_sequence_within_field_record terna.
-scan : Scan SEGY and print some info.
-dump : Dump traces values to stdout.
-dump_header_fields : Dump header fields stored into the traces header.
Use it with the following syntax:
......@@ -96,24 +106,37 @@ Usage : segy-change [options] -f input_file [-o output_file]
To know at which offsets a field is stored
or which parameters are available, use the
'-segy_info and -use_names switches.'
-only_traces_with : Keep only traces with fields from trace header
with a given value
syntax is field_offset0:field_type0:value,...
where type can be S for short (2 bytes),
I for int (4 bytes)
or
parameter0_name:value,parameter1_name:value,...
To know at which offsets a field is stored
or which parameters are available, use the
'-segy_info and -use_names switches.'
-use_names : use names instead of offsets.
to have a list of available parameters names use:
segy-change -segy_info -use_names
-info : Write the SEGY header and exits.
-EBCDIC file : Replace the EBCDIC header section with the content
of the specified ASCII file, converting it to EBCDIC
-isc num : Do a shot renumbering starting from num.
-irc num : Do a record renumbering starting from num.
-itc num : Do a trace renumbering starting from num.
-no_header : Do not write the SEGY header into the output file
(useful to concatenate SEGY files).
-no_header : Do not write the SEGY header into the output file.
Useful to concatenate SEGY files or to make a file
in SU format to be processed with Seismic Unix.
-segy_info : Write the SEGY header formats and exits.
-shot num num : The shot interval to process. Tested against
-record num num : The record interval to process. Tested against
the 'Original_field_record_number' field
-trace num num : Set the trace interval to process. Tested against
the 'Trace_number_within_field_record' field.
-only_ntraces num : Consider the file long at most 'num' traces.
-skip_ntraces num : Skip the first 'num' traces.
-only_n_traces num : Consider the file long at most 'num' traces.
-skip_n_traces num : Skip the first 'num' traces.
-only_n_samples num : Consider the trace only long at most 'num' samples.
-skip_n_samples num : Skip the first 'num' samples.
-num_trace_offset num : Set the offset at which, into the trace header,
there is the field to use for the trace number.
Useful when we don't want to use the
......@@ -130,6 +153,7 @@ Usage : segy-change [options] -f input_file [-o output_file]
use -change_trace_fields switch.
-v num : Verbosity level: 1 | 2 | 3
-x num : Skip num bytes at the beginning of input file.
-view : Display segy data.
Examples:
......@@ -152,12 +176,26 @@ Usage : segy-change [options] -f input_file [-o output_file]
segy-change -all -f in.sgy -o out.sgy -change_header_fields 3212:S:3336
-traces_per_record 3336
- To make a postscript plot of the first two shot-gather, assuming
the file long at most 250 total traces, skipping all remaining data:
- To extract traces containing exactly 10000 samples:
segy-change -f in.segy -all -o out.segy -use_names
-only_traces_with NUMBER_OF_SAMPLES_IN_THIS_TRACE:10000
- To make a postscript plot of the first two shot-gather, with 25 traces
per cm:
segy-change -f in.segy -record 100 101 -trace 1 120
-do_ps A4,25,0.01
- To view interactively the segy:
segy-change -f in.segy -shot 100 101 -trace 1 120
-do_ps A4,250,0.005 -only_ntraces 250
segy-change -f in.segy -view
For your information this machine is LITTLE_ENDIAN and the size of int appears
to be 4 bytes, as it should be.
***********************************************************************
If you use this software for scientific publication, please cite:
G. Stanghellini, G. Carrara
Segy-change: The swiss army knife for the SEG-Y files
SoftwareX, Volume 6, 2017, Pages 42–47, DOI:10.1016/j.softx.2017.01.003
***********************************************************************
LIBS = -lm -ldl -lSDL2 -lgomp -lSDL2_gfx -lpthread
LIBS = -lm -ldl -lSDL2 -lSDL2_gfx -lpthread
LIBSPATH =
LDLIBS = $(LIBS)
DEPLIBS =
......@@ -6,27 +6,27 @@ CC = gcc
C++ = g++
CPP = cc -E
LD = ld
CFLAGS = -O3 -std=c99 -fopenmp
CFLAGS = -O3 -std=c99
CCLINK = $(CC)
CXXLINK = $(CXX)
OBJS = segy-change.o
default:
@$(MAKE) -f makefile.linux-gnu-static segy-change \
"CFLAGS = -O3 -std=c99 -fopenmp -DWITH_SDL"
"CFLAGS = -O3 -std=c99 -DWITH_SDL"
nosdl:
@$(MAKE) -f makefile.linux-gnu-static segy-change \
"CFLAGS = -O3 -std=c99 -fopenmp" \
"LIBS = -lm -lc -lgomp"
"CFLAGS = -O3 -std=c99 " \
"LIBS = -lm -lc"
debug:
@$(MAKE) -f makefile.linux-gnu-static segy-change \
"CFLAGS = -g -std=c99 -fopenmp -DWITH_SDL"
"CFLAGS = -g -std=c99 -DWITH_SDL"
segy-change: $(OBJS) $(DEPLIBS)
$(RM) $@
$(CCLINK) -fopenmp -o $@ $(LDOPTIONS) $(OBJS) $(LOCAL_LIBRARIES) $(LDLIBS) $(LIBS) $(EXTRA_LOAD_FLAGS) -static
$(CCLINK) -o $@ $(LDOPTIONS) $(OBJS) $(LOCAL_LIBRARIES) $(LDLIBS) $(LIBS) $(EXTRA_LOAD_FLAGS) -static
clean:
$(RM) *.CKP *.ln *.BAK *.bak *.o core errs *~ *.a segy-change
......
No preview for this file type
......@@ -714,9 +714,15 @@ void print_usage(int argc, char **argv) {
fprintf(stdout, "\nsegy-change: a progam to read and optionally change\n"
"the contents of segy seismic data files.\n\n");
fprintf(stdout,
"If you use this software for scientific publication, please cite:\n"
"\n"
"G. Stanghellini, G. Carrara\n"
"Segy-change: The swiss army knife for the SEG-Y files\n"
"SoftwareX, Volume 6, 2017, Pages 42–47, DOI:10.1016/j.softx.2017.01.003"
"Copyright (C) 2009, Giuseppe Stanghellini (1), Gabriela Carrara (2).\n"
" (1) Istituto di Scienze Marine, Geologia Marina, CNR, Bologna, Italy\n"
" (2) LNEG – Marine Geology Department, Portugal\n\n"
" (2) Independent Researcher, Monte San Pietro, Italy\n\n"
"This program comes with ABSOLUTELY NO WARRANTY! see GPLV3.\n"
"This is free software, and you are welcome to redistribute it\n"
"under certain conditions; for details see the GPLV3 license\n"
......@@ -752,7 +758,7 @@ void print_usage(int argc, char **argv) {
" obtained by the -dump_trace_fields switch,\n"
" with or without the -use_names switch.\n"
" -dump_xy : Print x and y location to stdout.\n"
" SOURCE|RECEIVER the word SOURCE or RECEIVER must be given, according"
" SOURCE|RECEIVER the word SOURCE or RECEIVER must be given, according\n"
" to locations to print.\n"
" -vertical_stack num : Do a vertical stack, summing num samples together\n"
" -add_xy : Add coordinates (in m, feet or arcsec) to trace\n"
......@@ -882,16 +888,17 @@ void print_usage(int argc, char **argv) {
"\n"
" segy-change -f in.segy -all -o out.segy -use_names\n"
" -only_traces_with NUMBER_OF_SAMPLES_IN_THIS_TRACE:10000\n"
" - To make a postscript plot of the first two shot-gather, assuming\n"
" the file long at most 250 total traces, skipping all remaining data:\n"
" - To make a postscript plot of the first two shot-gather, with 25 traces\n"
" per cm:\n"
"\n"
" segy-change -f in.segy -record 100 101 -trace 1 120\n"
" -do_ps A4,250,0.005 -only_ntraces 250\n"
" -do_ps A4,25,0.01\n"
"\n"
" - To view interactively the segy:\n"
"\n"
" segy-change -f in.segy -view\n"
"\n");
"\n"
);
printf("For your information this machine is ");
if (is_little_endian())
......@@ -904,6 +911,16 @@ void print_usage(int argc, char **argv) {
printf(", as it should be.\n\n");
else
printf(" and that's wrong! it should be 4 bytes.\n\n");
printf( "***********************************************************************\n"
"If you use this software for scientific publication, please cite:\n"
"G. Stanghellini, G. Carrara\n"
"Segy-change: The swiss army knife for the SEG-Y files\n"
"SoftwareX, Volume 6, 2017, Pages 42–47, DOI:10.1016/j.softx.2017.01.003\n"
"***********************************************************************\n"
);
exit(0);
}
......
Markdown is supported
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