⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 segy_documentation.tex

📁 MATLAB编写的segy地震数据地震数据读写代码。从事地球物理地震勘探的人员可以参考。
💻 TEX
📖 第 1 页 / 共 2 页
字号:
writing stacks, as stack geometry is a lot simpler than gather
geometry.

It is called as follows:
\begin{verbatim}
SEGY_WriteStack(filename, stack, dt, separation, text, num);
\end{verbatim}

Where {\tt filename} is a string containing the filename to write,
{\tt stack} is an $N \times M$ array of $N$ samples for each of $M$
traces in the stack. {\tt dt} is the sample interval in seconds, {\tt
  separation} is the horizontal separation distance between each
stacked trace, {\tt text} is either 'ebcdic' or 'ascii', and {\tt num}
is either 'b' for big-endian or 'l' for little-endian. 

\subsubsection{Example}

This call will save the stack in {\tt stackdata} into the file {\tt
  /tmp/stacked.segy} with a sample interval of 2 ms. The text will be
  written in \ebcdic and the data in big-endian format. 
\begin{verbatim}
SEGY_WriteStack{'/tmp/stacked.segy', stackdata, 0.002, 100, ...
                'ebcdic', 'b');
\end{verbatim}

\section{Driving Functions}
These functions do all the heavy lifting, when writing \segy files. I
think of them in two separate groups. The first group is the
``retrieving a template'' group:
\begin{itemize}
\item {\tt SEGY\_GetTextHeader}
\item {\tt SEGY\_GetBinaryHeader}
\item {\tt SEGY\_GetTrace}
\end{itemize}
These functions return a template of sorts that can be used as a
starting point for your own binary header, text header, and trace when
you're writing \segy.

The next group is the ``writing to file'' group:
\begin{itemize}
\item {\tt SEGY\_WriteTextHeader}
\item {\tt SEGY\_WriteBinaryHeader}
\item {\tt SEGY\_WriteTrace}
\end{itemize}

\subsection{SEGY\_GetTextHeader}
This function will return a text header that is initialized to be the
correct size as a standard text header for a \segy file. It will be
returned to you in \ascii, but this is ok because {\tt
  SEGY\_WriteTextHeader} expects an \ascii header input as an
argument. All of the \ascii vs. \ebcdic stuff is worked out via
arguments to the writing functions. Don't try to manipulate \ebcdic
directly yourself -- the 1970s are long over.

The text header itself is a 3200 byte string of information. Take a
look at it if you like, and modify it in place to fill in the blanks.
Do {\bf not} change the size of this array. The text header is
generally used purely as notes to the users of the data, so you can
frequently just get a text header as it is, and write it directly
without any changes.
\begin{verbatim}
thead = SEGY_GetTextHeader;
\end{verbatim}

\subsection{SEGY\_GetBinaryHeader}
This function returns an initialized structure that represents all of
the data found in a \segy binary header. The details of the \segy
binary header are documented exhaustively in lots of places. One thing
worth noting is that I tend to name the binary header elements in the
same way as Seismic Unix names them. If you are familiar with Seismic
Unix keywords, then you know all of the keywords for this structure as
well. 

\begin{verbatim}
bhead = SEGY_GetBinaryHeader;
\end{verbatim}

A few of the more important header elements that you probably want to
set in every \segy file are:

\begin{description}
\item[bhead.jobid] job id number
\item[bhead.lino] line number, one line per reel
\item[bhead.reno] reel number
\item[bhead.hdt] sampling interval in microseconds, this reel
\item[bhead.dto] sampling interval in microseconds, in field
\item[bhead.hns] number of samples per trace, this reel
\item[bhead.nso] number of samples, in field
\item[bhead.tsort] trace sorting code
\end{description}

\subsection{SEGY\_GetTrace}
This function returns a template for a \segy trace. As with the other
functions, you get a trace, and then you modify the things that you
want to change. You also have to add in the data for the trace. This
trace structure includes both the trace header and the trace data
itself. So you can use retrieve one template, then for every trace
simply replace the time series data for each new trace, and also
update the relevant geometry and trace id number information.

\begin{verbatim}
trace = SEGY_GetTrace;
\end{verbatim}

Here are a few of the most important trace header elements. Again,
they follow Seismic Unix keyword names.

\begin{description}
\item[trace.tracl] trace sequence number within the line
\item[trace.tracr] trace sequence number within the reel
\item[trace.fldr] field record number
\item[trace.ep] energy source point number
\item[trace.cdp] ensemble number (doesn't have to be cdp)
\item[trace.cdpt] trace number within the ensemble
\item[trace.offset] distance from source to receiver
\item[trace.sx] x source coordinate
\item[trace.gx] x group coordinate
\item[trace.dt] sample interval in microseconds
\item[trace.data] the time series, as an array
\end{description}

Some of these elements will likely be the same for every single trace
within a line. For example, {\tt trace.dt} is probably going to be the
same for every trace. Others must be altered, usually in a non-trivial
way, to accomodate the geometry of the shooting.


\subsection{SEGY\_WriteTextHeader}

This function will write the text header to the \segy file.

\begin{verbatim}
SEGY_WriteTextHeader(FILE, thead, format);
\end{verbatim}

{\tt FILE} is the opened file handle for the \segy file, {\tt thead}
is the text header as returned by {\tt SEGY\_GetTextHeader} and
subsequently modified, {\tt format} is equal to 'ebdic' or 'ascii'.
You should probably choose 'ebcdic' unless you know otherwise, because
\ebcdic conforms to the original \segy standard.

If there is a text header already in the file that you are writing to,
it will be overwritten without warning. You cannot use this function
to insert a text header in front of a binary header and/or traces. It
will simply overwrite the first 3200 bytes of a file without regard
for what exists in those 3200 bytes.

\subsection{SEGY\_WriteBinaryHeader}

This function writes the binary header to the file.

\begin{verbatim}
 SEGY_WriteBinaryHeader(FILE, bhead);
\end{verbatim}

{\tt FILE} is the opened file handle for the \segy file, and {\tt
  bhead} is the binary header as returned by the {\tt
  SEGY\_GetBinaryHeader} function and subsequently modified. Note that
endianness is determined within your call to {\tt fopen}, and is not a
part of this library.

If there is a binary header in the file, this function will overwrite
it without warning. This function will overwrite the bytes from 3201
to 3600 (inclusive) without regard for what exists in those
bytes. Therefore, you cannot use this to insert a binary header into a
file that does not have one. 

\subsection{SEGY\_WriteBinaryHeader}

This function will write a \segy trace to the file. 

\begin{verbatim}
SEGY_WriteTrace(FILE, trace);
\end{verbatim}

{\tt FILE} is the opened file handle for the \segy file and {\tt
  trace} is the trace as returned by the {\tt SEGY\_GetTrace} function
  and subsequently modified. Note that endianness is determined within
  your call to the {\tt fopen}, and is not a part of this library.

The trace will be written to the file at exactly the point where the
current file pointer resides. If you do not understand the previous
sentence, then simply ensure that you include the following line
before you try to use the function {\tt SEGY\_WriteTrace}:

\begin{verbatim}
fseek(FILE, 0, 'eof');
\end{verbatim}

\end{document}

%%% Local Variables: 
%%% mode: latex
%%% TeX-master: t
%%% End: 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -