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

📄 prog.tex

📁 国外免费地震资料处理软件包
💻 TEX
📖 第 1 页 / 共 4 页
字号:
is a standard SEGY keyword that denotes row number 11 (see the outputof \texttt{sfheaderattr} above.) A variety of mathematical expressionscan be defined in the \texttt{output=} string. The expressionprocessing engine is shared with \texttt{sfmath}.\noindent\doublebox{\parbox{\textwidth}{\input{sfheadersort}}}\texttt{sfheadersort} is used to sort traces in the input fileaccording to trace header information. Here is an example of using\texttt{sfheadersort} for randomly shuffling traces in the inputfile. First, let us create an input file with seven traces:\begin{verbatim}bash$ sfmath n1=5 n2=7 output=x2+1 > input.rsfbash$ < input.rsf sfdisfil   0:             1            1            1            1            1   5:             2            2            2            2            2  10:             3            3            3            3            3  15:             4            4            4            4            4  20:             5            5            5            5            5  25:             6            6            6            6            6  30:             7            7            7            7            7 \end{verbatim}Next, we can create a random file with seven header values using\texttt{sfnoise}.\begin{verbatim}bash$ sfspike n1=7 | sfnoise rep=y type=n > random.rsfbash$ < random.rsf sfdisfil   0:       0.05256      -0.2879       0.1487       0.4097       0.1548   5:        0.4501       0.2836\end{verbatim}If you reproduce this example, your numbers will most likely be different,because, in the absence of \texttt{seed=} parameter, \texttt{sfnoise}uses a random seed value to generate pseudo-random numbers. Finally, weapply \texttt{sfheadersort} to shuffle the input traces.\begin{verbatim}bash$ < input.rsf sfheadersort head=random.rsf > output.rsfbash$ < output.rsf sfdisfil   0:             2            2            2            2            2   5:             1            1            1            1            1  10:             3            3            3            3            3  15:             5            5            5            5            5  20:             7            7            7            7            7  25:             4            4            4            4            4  30:             6            6            6            6            6\end{verbatim}As expected, the order of traces in the output file corresponds to theorder of values in the header. Thanks to the separation betweenheaders and data, the operation of \texttt{sfheadersort} is optimallyefficient. It first sorts the headers and only then accesses the data,reading each data trace only once.\noindent\doublebox{\parbox{\textwidth}{\input{sfheaderwindow}}}\texttt{sfheaderwindow} is used to window traces in the input fileaccording to trace header information. Here is an example of using \texttt{sfheaderwindow} for randomlyselecting part of the traces in the input file. First, let us createan input file with ten traces:\begin{verbatim}bash$ sfmath n1=5 n2=10 output=x2+1 > input.rsfbash$ < input.rsf sfdisfil   0:             1            1            1            1            1   5:             2            2            2            2            2  10:             3            3            3            3            3  15:             4            4            4            4            4  20:             5            5            5            5            5  25:             6            6            6            6            6  30:             7            7            7            7            7  35:             8            8            8            8            8  40:             9            9            9            9            9  45:            10           10           10           10           10\end{verbatim}Next, we can create a random file with ten header values using\texttt{sfnoise}.\begin{verbatim}bash$ sfspike n1=10 | sfnoise rep=y type=n > random.rsfbash$ < random.rsf sfdisfil   0:     -0.005768      0.02258     -0.04331      -0.4129      -0.3909   5:      -0.03582       0.4595      -0.3326        0.498      -0.3517\end{verbatim}If you reproduce this example, your numbers will most likely be different,because, in the absence of \texttt{seed=} parameter, \texttt{sfnoise}uses a random seed value to generate pseudo-random numbers. Finally,we apply \texttt{sfheaderwindow} to window the input traces selectingonly those for which the header is greater than zero.\begin{verbatim}bash$ < random.rsf sfmask min=0 > mask.rsfbash$ < mask.rsf sfdisfil   0:    0    1    0    0    0    0    1    0    1    0bash$ < input.rsf sfheaderwindow mask=mask.rsf > output.rsfbash$ < output.rsf sfdisfil   0:             2            2            2            2            2   5:             7            7            7            7            7  10:             9            9            9            9            9\end{verbatim}In this case, only three traces are selected for the output. Thanks tothe separation between headers and data, the operation of\texttt{sfheaderwindow} is optimally efficient. \noindent\doublebox{\parbox{\textwidth}{    \input{sfin}  }}\texttt{sfin} is one of the most useful programs for operating withRSF files. It produces quick information on the file hypercubedimensions and checks the consistency of the associated data file.Here is an example. Let us create an RSF file and examine it with \texttt{sfin}.\begin{verbatim}bash$ sfspike n1=100 n2=20 > spike.rsfbash$ sfin spike.rsfspike.rsf:    in="/tmp/spike.rsf@"    esize=4 type=float form=native    n1=100         d1=0.004       o1=0          label1="Time" unit1="s"    n2=20          d2=0.1         o2=0          label2="Distance" unit2="km"        2000 elements 8000 bytes\end{verbatim}\texttt{sfin} reports the following information:\begin{itemize}\item location of the data file (\texttt{/tmp/spike.rsf\@})\item element size (4 bytes)\item element type (floating point)\item element form (native)\item hypercube dimensions (100 by 20)\item axes scale (0.004 and 0.1)\item axes origin (0 and 0)\item axes labels\item axes units\item total number of elements\item total number of bytes in the data file\end{itemize}Suppose that the file got corrupted by a buggy program and reportsincorrect dimensions. The \texttt{sfin} program should be able tocatch the discrepancy.\begin{verbatim}bash$ echo n2=100 >> spike.rsfbash$ sfin spike.rsf > /dev/nullsfin:           Actually 8000 bytes, 20% of expected.\end{verbatim}\texttt{sfin} also checks the first records in the file for zeros. \begin{verbatim}bash$ sfspike n1=100 n2=100 k2=99 > spike2.rsfbash$ sfin spike2.rsf >/dev/nullsfin: The first 32768 bytes are all zeros\end{verbatim}The number of bytes to check is adjustable\begin{verbatim}bash$ sfin spike2.rsf check=0.01 >/dev/nullsfin: The first 16384 bytes are all zeros\end{verbatim}You can also output only the location of the data file. This issometimes handy in scripts.\begin{verbatim}bash$ sfin spike.rsf spike2.rsf info=n/tmp/spike.rsf@ /tmp/spike2.rsf@\end{verbatim}An alternative is to use \texttt{sfget}, as follows:\begin{verbatim}bash$ sfget parform=n in < spike.rsf/tmp/spike.rsf@\end{verbatim}\noindent\doublebox{\parbox{\textwidth}{    \input{sfinterleave}  }}\texttt{sfinterleave} combines two or more datasets by interleaving them on oneof the axes. Here is a quick example:\begin{verbatim}bash$ sfspike n1=5 n2=5 > one.rsfbash$ sfdisfil < one.rsf   0:             1            1            1            1            1   5:             1            1            1            1            1  10:             1            1            1            1            1  15:             1            1            1            1            1  20:             1            1            1            1            1bash$ sfscale < one.rsf dscale=2 > two.rsfbash$ sfdisfil < two.rsf   0:             2            2            2            2            2   5:             2            2            2            2            2  10:             2            2            2            2            2  15:             2            2            2            2            2  20:             2            2            2            2            2bash$ sfinterleave one.rsf two.rsf axis=1 | sfdisfil   0:             1            2            1            2            1   5:             2            1            2            1            2  10:             1            2            1            2            1  15:             2            1            2            1            2  20:             1            2            1            2            1  25:             2            1            2            1            2  30:             1            2            1            2            1  35:             2            1            2            1            2  40:             1            2            1            2            1  45:             2            1            2            1            2bash$ sfinterleave < one.rsf two.rsf axis=2 | sfdisfil   0:             1            1            1            1            1   5:             2            2            2            2            2  10:             1            1            1            1            1  15:             2            2            2            2            2  20:             1            1            1            1            1  25:             2            2            2            2            2  30:             1            1            1            1            1  35:             2            2            2            2            2  40:             1            1            1            1            1  45:             2            2            2            2            2\end{verbatim}\noindent\doublebox{\parbox{\textwidth}{    \input{sfmask}  }}\texttt{sfmask} creates an integer output of ones and zeros comparingthe values of the input data to specified \texttt{min=} and\texttt{max=} parameters. It is useful for \texttt{sfheaderwindow} andin many other applications. Here is a quick example:\begin{verbatim}bash$ sfmath n1=10 output="sin(x1)" > sin.rsfbash$ < sin.rsf sfdisfil   0:             0       0.8415       0.9093       0.1411      -0.7568   5:       -0.9589      -0.2794        0.657       0.9894       0.4121bash$ < sin.rsf sfmask min=-0.5 max=0.5 | sfdisfil   0:    1    0    0    1    0    0    1    0    0    1\end{verbatim}\noindent\doublebox{\parbox{\textwidth}{    \input{sfmath}  }}\inputdir{sfmath}\texttt{sfmath} is a versatile program for mathematical operationswith RSF files. It can operate with several input file, all of thesame dimensions and data type. The data type can be real (floatingpoint) or complex. Here is an example that demonstrates severalfeatures of \texttt{sfmath}.\begin{verbatim}bash$ sfmath n1=600 d1=0.01 o1=0 n2=40 d2=1 o2=5 \output="x2*(8+sin(6*x1+x2/10))" > rad.rsfbash$ < rad.rsf sfrtoc | sfmath output="input*exp(I*x1)" > rose.rsfbash$ < rose.rsf sfgraph title=Rose screenratio=1 wantaxis=n | xtpen\end{verbatim}The first line creates a 2-D dataset that consists of 40 traces 600samples each. The values of the data are computed with the formula\verb#"x2*(8+sin(6*x1+x2/10))"#, where \texttt{x1} refers to thecoordinate on the first axis, and \texttt{x2} is the coordinate of thesecond axis. In the second line, we convert the data from real tocomplex using \texttt{sfrtoc} and produce a complex dataset usingformula \verb#"input*exp(I*x1)"#, where \texttt{input} refers to theinput file. Finally, we plot the complex data as a collection ofparametric curves using \texttt{sfgraph} and display the result using\texttt{xtpen}.  The plot appearing on your screen should look similarto Figure~\ref{fig:rose}.\plot{rose}{width=0.6\textwidth}{This figure was created with \texttt{sfmath}.}One possible alternative to the second line above is\begin{verbatim}bash$ < rad.rsf sfmath output=x1 > ang.rsfbash$ sfmath r=rad.rsf a=ang.rsf output="r*cos(a)" > cos.rsfbash$ sfmath r=rad.rsf a=ang.rsf output="r*sin(a)" > sin.rsfbash$ sfcmplx cos.rsf sin.rsf > rose.rsf\end{verbatim}Here we refer to input files by names (\texttt{r} and \texttt{a}) and combine the names in a formula.\noindent\doublebox{\parbox{\textwidth}{    \input{sfpad}  }}\texttt{pad} increases the dimensions of the input dataset by paddingthe data with zeroes. Here are some simple examples.\begin{verbatim}bash$ sfspike n1=5 n2=3 > one.rsfbash$ sfdisfil < one.rsf   0:             1            1            1            1            1   5:             1            1            1            1            1  10:             1            1            1            1            1bash$ < one.rsf sfpad n2=5 | sfdisfil   0:             1            1            1            1            1   5:             1            1            1            1            1  10:             1            1            1            1            1  15:             0            0            0            0            0  20:             0            0            0            0            0

⌨️ 快捷键说明

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