📄 sugausstaper.c
字号:
/* Copyright (c) Colorado School of Mines, 2006.*//* All rights reserved. *//* SUTAPER: $Revision: 1.2 $ ; $Date: 2006/03/10 20:43:09 $ */#include "su.h"#include "segy.h"/*********************** self documentation **********************/char *sdoc[] = {" "," SUGAUSSTAPER - Multiply traces with gaussian taper "," "," sugausstaper < stdin > stdout [optional parameters] "," "," Required Parameters: "," <none> "," "," Optional parameters: "," key=offset keyword of header field to weight traces by "," x0=300 centre of gaussian window "," xw=50 width of gaussian window "," "," "," Traces are multiplied with a symmetrical gaussian taper "," w(t)=exp(-((key-x0)/xw)**2) "," ",NULL};/* Credits: * * Thomas Bohlen, 04.01.2002 * * Trace header fields accessed: ns *//**************** end self doc ***********************************/segy tr;intmain(int argc, char **argv){ char *key; /* header key word from segy.h */ char *type; /* ... its type */ int index; /* ... its index */ Value val; /* ... its value */ float fval; /* ... its value cast to float */ int ns; /* number of sample points on traces */ float x0, xw; /* centre and width of gauss taper */ /* Initialize */ initargs(argc, argv); requestdoc(1); /* Get optional parameters */ if (!getparstring("key", &key)) key = "offset"; if (!getparfloat("x0",&x0)) x0 = 300.0; if (!getparfloat("xw",&xw)) xw = 50.0; /* Get key type and index */ type = hdtype(key); index = getindex(key); /* Get info from first trace */ if (!gettr(&tr)) err ("can't get first trace"); ns = tr.ns; /* Loop through traces */ do { register int i = 0; /* counter */ /* Get value of key and convert to float */ gethval(&tr, index, &val); fval = vtof(type,val); /* Loop over samples in trace and apply weighting */ for (i=0; i < ns; ++i) tr.data[i] *= exp(-pow((fval-x0)/xw,2)); /* Put out weighted traces */ puttr(&tr); } while (gettr(&tr)); return(CWP_Exit());}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -