📄 sutwig.c
字号:
/* SUTWIG: $Revision: 1.7 $ ; $Date: 90/11/10 13:21:38 $ *//*---------------------------------------------------------------------- * Copyright (c) Colorado School of Mines, 1990. * All rights reserved. * * This code is part of SU. SU stands for Seismic Unix, a processing line * developed at the Colorado School of Mines, partially based on Stanford * Exploration Project (SEP) software. Inquiries should be addressed to: * * Jack K. Cohen, Center for Wave Phenomena, Colorado School of Mines, * Golden, CO 80401 (jkc@dix.mines.colorado.edu) *---------------------------------------------------------------------- */#include "su.h"#include "segy.h"#include "vplot.h"/*********************** self documentation ******************************/string sdoc = "\ \n\SUTWIG - full-featured wiggle trace program for data plotting \n\ \n\sutwig <stdin [optional parameters] | pen \n\ \n\Optional Parameters: \n\....DATA... \n\ tmin = tr.delrt tic label for first time sample \n\ dt = tr.dt or .004 time sample increment \n\ xmin = 1st tr.tracl first trace location \n\ dx = (1st-2nd)tr.tracl trace sample increment \n\....LABELING ... \n\ title = null plot title \n\ label1 = Time time axis label \n\ label2 = Trace trace axis label \n\ dtict = 0.0 time tic interval (0.0 for automatic) \n\ dticx = 0.0 trace tic interval (0.0 for automatic) \n\ ftict = tmin 1st numbered time tic (for dtict != 0) \n\ fticx = xmin 1st numbered trace tic (for dticx != 0) \n\ titlsz = 9 title print size \n\ lablsz = 9 label print size \n\ ticsz = 5 tic labeling print size \n\....MISCELLANEOUS ... \n\ tlines = 1 flag for timing lines (=0 for none) \n\ fill = 1 flag for positive fill (=0 for no fill) \n\ ltic = 0.05 length of tic mark (inches) \n\ plotfat = 0 line thickness of traces \n\ axisfat = 0 line thickness of box & tics \n\ hcopy = 0 honors user/default parameters \n\ = 1 forces thesis format \n\....SIZE & LOCATION ... \n\ sizet = 6.0 length of t-axis (inches) \n\ sizex = 4.7 length of x-axis (...) \n\ margint = 0.1 top/bot gap between box and traces (...)\n\ marginx = 0.1 side gap between box and traces (...) \n\ zerot = 1.3 base of plot to bottom of screen (...) \n\ zerox = 1.0 left of plot to left of screen (...) \n\....DETAIL BOX ... \n\ db = 0 flag for detail box (=1 for box) \n\ top = nt/4 time sample at top of detail box \n\ bot = nt/2 time sample at bottom of detail box \n\ left = ntr/2 trace on left side of detail box \n\ right = 3*ntr/4 trace on right side of detail box \n\ dbfat = 4 line thickness for detail box \n\....GAINING ... \n\ overlap = 2.0 max deflection (in traces) is \n\ overlap*scale \n\ \n\gain defaults (see sugain): \n\ tpow=0.0 epow=0.0 gpow=1.0 agc=0 wagc=0.2 \n\ trap=0.0 clip=0.0 qclip=1.0 qbal=1 pbal=0 scale=1.0 \n\";/**************** end self doc *******************************************//* Credits: * SEP: Shuki * CWP: Chris * *//* Set plotting defaults */#define TITLE ""#define LABEL1 "Time"#define LABEL2 "Trace"#define FILL 1#define OVERLAP 2.0#define ZEROT 1.3#define ZEROX 1.0#define SIZET 6.0#define SIZEX 4.5#define MARGINT 0.1#define MARGINX 0.1#define DTICT 0.0;#define DTICX 0.0#define LTIC 0.05#define PLOTFAT 0#define AXISFAT 0#define TITLSZ 9#define LABLSZ 9#define TICSZ 5#define TLINES 1#define DB 0#define DBFAT 4#define FONT 3/* Set gain defaults (balance by maximum magnitude) */#define TPOW 0.0#define EPOW 0.0#define GPOW 1.0#define AGC 0#define WAGC 0.2#define TRAP 0.0#define CLIP 0.0#define QCLIP 1.0#define QBAL 1 /* default is balance by maximum magnitude */#define PBAL 0#define SCALE 1.0segy tr;main(int argc, char **argv){ float *dataptr; /* mega-vector of data from the segys */ float dt; /* time sample rate (and tic increment) */ float dx; /* tic label increment for horiz axis */ float tmin; /* minimum time (and tic label) */ float xmin; /* minimum tic label for horiz axis */ int nt; /* time samples per trace (from tr.ns) */ int ntsize; /* number of data bytes on a trace */ int ntr; /* traces in input data (from gettr) */ int tracl2; /* tracl of 2nd trace (for dx) */ int ndata; /* bytes allocated for mega-vector */ string label1; /* vertical axis label (default Time) */ string label2; /* horiz axis label (default Trace) */ string title; /* title on plot */ void wigplot( /* vertical wiggle plot */ float *dataptr, int nt, int ntr, string title, string label1, string label2, float tmin, float dt, float xmin, float dx); /* Initialize */ initargs(argc, argv); askdoc(1); /* Prevent bytes from spilling onto screen */ if (isatty(STDOUT)) { err("must redirect or pipe byte code output"); } /* Get info from first trace */ if (!gettr(&tr)) err("can't get first trace"); nt = tr.ns; ntsize = nt * FSIZE; if (!fgetpar("xmin", &xmin)) xmin = tr.tracl; if (!fgetpar("tmin", &tmin)) tmin = tr.delrt/1000.0; if (!fgetpar("dt", &dt)) { if (tr.dt) { /* is dt field set? */ dt = tr.dt / 1000000.0; } else { /* dt not set, assume 4 ms */ dt = 0.004; warn("tr.dt not set, for labeling assume dt=%g", dt); } } /* Allocate block of memory for data float mega-vector */ ndata = MAX(NFALLOC, nt); /* alloc at least one trace */ dataptr = ealloc1float(ndata); /* Loop over input traces & put them into data mega-vector */ ntr = 0; do { ++ntr; if (ntr == 2) tracl2 = tr.tracl;/* needed for dx */ if (ntr*nt > ndata) { /* need more memory */ ndata += NFALLOC; dataptr = erealloc1float(dataptr, ndata); } bcopy(tr.data, dataptr + (ntr - 1)*nt, ntsize); } while(gettr(&tr)); if (!fgetpar("dx", &dx)) dx = tracl2 - xmin; /* Gain */ gain(dataptr, TPOW, EPOW, GPOW, AGC, TRAP, CLIP, QCLIP, QBAL, PBAL, SCALE, tmin, dt, WAGC, nt, ntr); /* Plot getpars */ if (!sgetpar("title", &title)) title = TITLE; if (!sgetpar("label1", &label1)) label1 = LABEL1; if (!sgetpar("label2", &label2)) label2 = LABEL2; /* Plot */ warn("nt = %d ntr = %d", nt, ntr); wigplot(dataptr,nt, ntr, title, label1, label2, tmin, dt, xmin, dx); return EXIT_SUCCESS;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -