segy.h

Go to the documentation of this file.
00001 /* Copyright (c) Colorado School of Mines, 2006.*/
00002 /* All rights reserved.                       */
00003 
00004 
00005 /* segy.h - include file for SEGY traces
00006  *
00007  * declarations for:
00008  *  typedef struct {} segy - the trace identification header
00009  *  typedef struct {} bhed - binary header
00010  *
00011  * Note:
00012  *  If header words are added, run the makefile in this directory
00013  *  to recreate hdr.h.
00014  *
00015  * Reference:
00016  *  K. M. Barry, D. A. Cavers and C. W. Kneale, "Special Report:
00017  *      Recommended Standards for Digital Tape Formats",
00018  *      Geophysics, vol. 40, no. 2 (April 1975), P. 344-352.
00019  *  
00020  * $Author: john $
00021  * $Source: /usr/local/cwp/src/su/include/RCS/segy.h,v $
00022  * $Revision: 1.26 $ ; $Date: 2005/01/21 20:18:45 $
00023  */ 
00024 
00025 #ifndef SEGY_H
00026 #define SEGY_H
00027 
00028 #define SU_NFLTS    32768   /* Arbitrary limit on data array size   */
00029 
00030 
00031 /* TYPEDEFS */
00032 typedef struct s_segy { /* segy - trace identification header */
00033 
00034     int tracl;  /* Trace sequence number within line
00035                --numbers continue to increase if the
00036                same line continues across multiple
00037                SEG Y files.
00038              */
00039 
00040     int tracr;  /* Trace sequence number within SEG Y file
00041                ---each file starts with trace sequence
00042                one
00043              */
00044 
00045     int fldr;   /* Original field record number */
00046 
00047     int tracf;  /* Trace number within original field record */
00048 
00049     int ep;     /* energy source point number
00050                ---Used when more than one record occurs
00051                at the same effective surface location.
00052              */
00053 
00054     int cdp;    /* Ensemble number (i.e. CDP, CMP, CRP,...) */
00055 
00056     int cdpt;   /* trace number within the ensemble
00057                ---each ensemble starts with trace number one.
00058              */
00059 
00060     short trid; /* trace identification code:
00061             -1 = Other
00062                  0 = Unknown
00063              1 = Seismic data
00064              2 = Dead
00065              3 = Dummy
00066              4 = Time break
00067              5 = Uphole
00068              6 = Sweep
00069              7 = Timing
00070              8 = Water break
00071              9 = Near-field gun signature
00072             10 = Far-field gun signature
00073             11 = Seismic pressure sensor
00074             12 = Multicomponent seismic sensor
00075                 - Vertical component
00076             13 = Multicomponent seismic sensor
00077                 - Cross-line component 
00078             14 = Multicomponent seismic sensor
00079                 - in-line component 
00080             15 = Rotated multicomponent seismic sensor
00081                 - Vertical component
00082             16 = Rotated multicomponent seismic sensor
00083                 - Transverse component
00084             17 = Rotated multicomponent seismic sensor
00085                 - Radial component
00086             18 = Vibrator reaction mass
00087             19 = Vibrator baseplate
00088             20 = Vibrator estimated ground force
00089             21 = Vibrator reference
00090             22 = Time-velocity pairs
00091             23 ... N = optional use 
00092                 (maximum N = 32,767)
00093 
00094             Following are CWP id flags:
00095 
00096             109 = autocorrelation
00097             110 = Fourier transformed - no packing
00098                  xr[0],xi[0], ..., xr[N-1],xi[N-1]
00099             111 = Fourier transformed - unpacked Nyquist
00100                  xr[0],xi[0],...,xr[N/2],xi[N/2]
00101             112 = Fourier transformed - packed Nyquist
00102                  even N:
00103                  xr[0],xr[N/2],xr[1],xi[1], ...,
00104                 xr[N/2 -1],xi[N/2 -1]
00105                 (note the exceptional second entry)
00106                  odd N:
00107                  xr[0],xr[(N-1)/2],xr[1],xi[1], ...,
00108                 xr[(N-1)/2 -1],xi[(N-1)/2 -1],xi[(N-1)/2]
00109                 (note the exceptional second & last entries)
00110             113 = Complex signal in the time domain
00111                  xr[0],xi[0], ..., xr[N-1],xi[N-1]
00112             114 = Fourier transformed - amplitude/phase
00113                  a[0],p[0], ..., a[N-1],p[N-1]
00114             115 = Complex time signal - amplitude/phase
00115                  a[0],p[0], ..., a[N-1],p[N-1]
00116             116 = Real part of complex trace from 0 to Nyquist
00117             117 = Imag part of complex trace from 0 to Nyquist
00118             118 = Amplitude of complex trace from 0 to Nyquist
00119             119 = Phase of complex trace from 0 to Nyquist
00120             121 = Wavenumber time domain (k-t)
00121             122 = Wavenumber frequency (k-omega)
00122             123 = Envelope of the complex time trace
00123             124 = Phase of the complex time trace
00124             125 = Frequency of the complex time trace
00125             130 = Depth-Range (z-x) traces
00126             143 = Seismic Data, Vertical Component 
00127             144 = Seismic Data, Horizontal Component 1 
00128             145 = Seismic Data, Horizontal Component 2 
00129             146 = Seismic Data, Radial Component
00130             147 = Seismic Data, Transverse Component  
00131             201 = Seismic data packed to bytes (by supack1)
00132             202 = Seismic data packed to 2 bytes (by supack2)
00133             */
00134 
00135     short nvs;  /* Number of vertically summed traces yielding
00136                this trace. (1 is one trace, 
00137                2 is two summed traces, etc.)
00138              */
00139 
00140     short nhs;  /* Number of horizontally summed traces yielding
00141                this trace. (1 is one trace
00142                2 is two summed traces, etc.)
00143              */
00144 
00145     short duse; /* Data use:
00146                 1 = Production
00147                 2 = Test
00148              */
00149 
00150     int offset; /* Distance from the center of the source point 
00151                to the center of the receiver group 
00152                (negative if opposite to direction in which 
00153                the line was shot).
00154              */
00155 
00156     int gelev;  /* Receiver group elevation from sea level
00157                (all elevations above the Vertical datum are 
00158                positive and below are negative).
00159              */
00160 
00161     int selev;  /* Surface elevation at source. */
00162 
00163     int sdepth; /* Source depth below surface (a positive number). */
00164 
00165     int gdel;   /* Datum elevation at receiver group. */
00166 
00167     int sdel;   /* Datum elevation at source. */
00168 
00169     int swdep;  /* Water depth at source. */
00170 
00171     int gwdep;  /* Water depth at receiver group. */
00172 
00173     short scalel;   /* Scalar to be applied to the previous 7 entries
00174                to give the real value. 
00175                Scalar = 1, +10, +100, +1000, +10000.
00176                If positive, scalar is used as a multiplier,
00177                if negative, scalar is used as a divisor.
00178              */
00179 
00180     short scalco;   /* Scalar to be applied to the next 4 entries
00181                to give the real value. 
00182                Scalar = 1, +10, +100, +1000, +10000.
00183                If positive, scalar is used as a multiplier,
00184                if negative, scalar is used as a divisor.
00185              */
00186 
00187     int  sx;    /* Source coordinate - X */
00188 
00189     int  sy;    /* Source coordinate - Y */
00190 
00191     int  gx;    /* Group coordinate - X */
00192 
00193     int  gy;    /* Group coordinate - Y */
00194 
00195     short counit;   /* Coordinate units: (for previous 4 entries and
00196                 for the 7 entries before scalel)
00197                1 = Length (meters or feet)
00198                2 = Seconds of arc
00199                3 = Decimal degrees
00200                4 = Degrees, minutes, seconds (DMS)
00201 
00202             In case 2, the X values are longitude and 
00203             the Y values are latitude, a positive value designates
00204             the number of seconds east of Greenwich
00205                 or north of the equator
00206 
00207             In case 4, to encode +-DDDMMSS
00208             counit = +-DDD*10^4 + MM*10^2 + SS,
00209             with scalco = 1. To encode +-DDDMMSS.ss
00210             counit = +-DDD*10^6 + MM*10^4 + SS*10^2 
00211             with scalco = -100.
00212             */
00213 
00214     short wevel;    /* Weathering velocity. */
00215 
00216     short swevel;   /* Subweathering velocity. */
00217 
00218     short sut;  /* Uphole time at source in milliseconds. */
00219 
00220     short gut;  /* Uphole time at receiver group in milliseconds. */
00221 
00222     short sstat;    /* Source static correction in milliseconds. */
00223 
00224     short gstat;    /* Group static correction  in milliseconds.*/
00225 
00226     short tstat;    /* Total static applied  in milliseconds.
00227                (Zero if no static has been applied.)
00228             */
00229 
00230     short laga; /* Lag time A, time in ms between end of 240-
00231                byte trace identification header and time
00232                break, positive if time break occurs after
00233                end of header, time break is defined as
00234                the initiation pulse which maybe recorded
00235                on an auxiliary trace or as otherwise
00236                specified by the recording system */
00237 
00238     short lagb; /* lag time B, time in ms between the time break
00239                and the initiation time of the energy source,
00240                may be positive or negative */
00241 
00242     short delrt;    /* delay recording time, time in ms between
00243                initiation time of energy source and time
00244                when recording of data samples begins
00245                (for deep water work if recording does not
00246                start at zero time) */
00247 
00248     short muts; /* mute time--start */
00249 
00250     short mute; /* mute time--end */
00251 
00252     unsigned short ns;  /* number of samples in this trace */
00253 
00254     unsigned short dt;  /* sample interval; in micro-seconds */
00255 
00256     short gain; /* gain type of field instruments code:
00257                 1 = fixed
00258                 2 = binary
00259                 3 = floating point
00260                 4 ---- N = optional use */
00261 
00262     short igc;  /* instrument gain constant */
00263 
00264     short igi;  /* instrument early or initial gain */
00265 
00266     short corr; /* correlated:
00267                 1 = no
00268                 2 = yes */
00269 
00270     short sfs;  /* sweep frequency at start */
00271 
00272     short sfe;  /* sweep frequency at end */
00273 
00274     short slen; /* sweep length in ms */
00275 
00276     short styp; /* sweep type code:
00277                 1 = linear
00278                 2 = cos-squared
00279                 3 = other */
00280 
00281     short stas; /* sweep trace length at start in ms */
00282 
00283     short stae; /* sweep trace length at end in ms */
00284 
00285     short tatyp;    /* taper type: 1=linear, 2=cos^2, 3=other */
00286 
00287     short afilf;    /* alias filter frequency if used */
00288 
00289     short afils;    /* alias filter slope */
00290 
00291     short nofilf;   /* notch filter frequency if used */
00292 
00293     short nofils;   /* notch filter slope */
00294 
00295     short lcf;  /* low cut frequency if used */
00296 
00297     short hcf;  /* high cut frequncy if used */
00298 
00299     short lcs;  /* low cut slope */
00300 
00301     short hcs;  /* high cut slope */
00302 
00303     short year; /* year data recorded */
00304 
00305     short day;  /* day of year */
00306 
00307     short hour; /* hour of day (24 hour clock) */
00308 
00309     short minute;   /* minute of hour */
00310 
00311     short sec;  /* second of minute */
00312 
00313     short timbas;   /* time basis code:
00314                 1 = local
00315                 2 = GMT
00316                 3 = other */
00317 
00318     short trwf; /* trace weighting factor, defined as 1/2^N
00319                volts for the least sigificant bit */
00320 
00321     short grnors;   /* geophone group number of roll switch
00322                position one */
00323 
00324     short grnofr;   /* geophone group number of trace one within
00325                original field record */
00326 
00327     short grnlof;   /* geophone group number of last trace within
00328                original field record */
00329 
00330     short gaps; /* gap size (total number of groups dropped) */
00331 
00332     short otrav;    /* overtravel taper code:
00333                 1 = down (or behind)
00334                 2 = up (or ahead) */
00335 
00336 #ifdef UNOCAL_SEGY_H  /* begin Unocal SU segy.h differences */
00337 
00338 
00339     /* cwp local assignments */
00340     float d1;   /* sample spacing for non-seismic data */
00341 
00342     float f1;   /* first sample location for non-seismic data */
00343 
00344     float d2;   /* sample spacing between traces */
00345 
00346     float f2;   /* first trace location */
00347 
00348     float ungpow;   /* negative of power used for dynamic
00349                range compression */
00350 
00351     float unscale;  /* reciprocal of scaling factor to normalize
00352                range */
00353 
00354     short mark; /* mark selected traces */
00355 
00356     /* UNOCAL local assignments */ 
00357     short mutb; /* mute time at bottom (start time)  */
00358             /* bottom mute ends at last sample   */
00359     float dz;   /* depth sampling interval in (m or ft)  */
00360             /* if =0.0, input are time samples       */
00361 
00362     float fz;   /* depth of first sample in (m or ft)  */
00363 
00364     short n2;   /* number of traces per cdp or per shot */
00365 
00366         short shortpad; /* alignment padding */
00367 
00368     int ntr;    /* number of traces */
00369 
00370     /* UNOCAL local assignments end */ 
00371 
00372     short unass[8]; /* unassigned */
00373 
00374 #else
00375 
00376     /* cwp local assignments */
00377     float d1;   /* sample spacing for non-seismic data */
00378 
00379     float f1;   /* first sample location for non-seismic data */
00380 
00381     float d2;   /* sample spacing between traces */
00382 
00383     float f2;   /* first trace location */
00384 
00385     float ungpow;   /* negative of power used for dynamic
00386                range compression */
00387 
00388     float unscale;  /* reciprocal of scaling factor to normalize
00389                range */
00390 
00391     int ntr;    /* number of traces */
00392 
00393     short mark; /* mark selected traces */
00394 
00395         short shortpad; /* alignment padding */
00396 
00397 
00398     short unass[14];    /* unassigned--NOTE: last entry causes 
00399                a break in the word alignment, if we REALLY
00400                want to maintain 240 bytes, the following
00401                entry should be an odd number of short/UINT2
00402                OR do the insertion above the "mark" keyword
00403                entry */
00404 #endif
00405 
00406     float  data[SU_NFLTS];
00407 
00408 } segy;
00409 
00410 
00411 typedef struct s_bhed { /* bhed - binary header */
00412 
00413     int jobid;  /* job identification number */
00414 
00415     int lino;   /* line number (only one line per reel) */
00416 
00417     int reno;   /* reel number */
00418 
00419     short ntrpr;    /* number of data traces per record */
00420 
00421         short nart; /* number of auxiliary traces per record */
00422 
00423     unsigned short hdt; /* sample interval in micro secs for this reel */
00424 
00425     unsigned short dto; /* same for original field recording */
00426 
00427     unsigned short hns; /* number of samples per trace for this reel */
00428 
00429     unsigned short nso; /* same for original field recording */
00430 
00431     short format;   /* data sample format code:
00432                 1 = floating point (4 bytes)
00433                 2 = fixed point (4 bytes)
00434                 3 = fixed point (2 bytes)
00435                 4 = fixed point w/gain code (4 bytes) */
00436 
00437     short fold; /* CDP fold expected per CDP ensemble */
00438 
00439     short tsort;    /* trace sorting code: 
00440                 1 = as recorded (no sorting)
00441                 2 = CDP ensemble
00442                 3 = single fold continuous profile
00443                 4 = horizontally stacked */
00444 
00445     short vscode;   /* vertical sum code:
00446                 1 = no sum
00447                 2 = two sum ...
00448                 N = N sum (N = 32,767) */
00449 
00450     short hsfs; /* sweep frequency at start */
00451 
00452     short hsfe; /* sweep frequency at end */
00453 
00454     short hslen;    /* sweep length (ms) */
00455 
00456     short hstyp;    /* sweep type code:
00457                 1 = linear
00458                 2 = parabolic
00459                 3 = exponential
00460                 4 = other */
00461 
00462     short schn; /* trace number of sweep channel */
00463 
00464     short hstas;    /* sweep trace taper length at start if
00465                tapered (the taper starts at zero time
00466                and is effective for this length) */
00467 
00468     short hstae;    /* sweep trace taper length at end (the ending
00469                taper starts at sweep length minus the taper
00470                length at end) */
00471 
00472     short htatyp;   /* sweep trace taper type code:
00473                 1 = linear
00474                 2 = cos-squared
00475                 3 = other */
00476 
00477     short hcorr;    /* correlated data traces code:
00478                 1 = no
00479                 2 = yes */
00480 
00481     short bgrcv;    /* binary gain recovered code:
00482                 1 = yes
00483                 2 = no */
00484 
00485     short rcvm; /* amplitude recovery method code:
00486                 1 = none
00487                 2 = spherical divergence
00488                 3 = AGC
00489                 4 = other */
00490 
00491     short mfeet;    /* measurement system code:
00492                 1 = meters
00493                 2 = feet */
00494 
00495     short polyt;    /* impulse signal polarity code:
00496                 1 = increase in pressure or upward
00497                     geophone case movement gives
00498                     negative number on tape
00499                 2 = increase in pressure or upward
00500                     geophone case movement gives
00501                     positive number on tape */
00502 
00503     short vpol; /* vibratory polarity code:
00504                 code    seismic signal lags pilot by
00505                 1   337.5 to  22.5 degrees
00506                 2    22.5 to  67.5 degrees
00507                 3    67.5 to 112.5 degrees
00508                 4   112.5 to 157.5 degrees
00509                 5   157.5 to 202.5 degrees
00510                 6   202.5 to 247.5 degrees
00511                 7   247.5 to 292.5 degrees
00512                 8   293.5 to 337.5 degrees */
00513 
00514     short hunass[170];  /* unassigned */
00515 
00516 } bhed;
00517 
00518 /* DEFINES */
00519 #define gettr(x)    fgettr(stdin, (x))
00520 #define vgettr(x)   fvgettr(stdin, (x))
00521 #define puttr(x)    fputtr(stdout, (x))
00522 #define vputtr(x)   fvputtr(stdout, (x))
00523 #define gettra(x, y)    fgettra(stdin, (x), (y))
00524 
00525 
00526 /* TREAL represents real time traces                */
00527 #define     TREAL       1
00528 /* TDEAD represents dead time traces                */
00529 #define     TDEAD       2
00530 /* TDUMMY represents dummy time traces              */
00531 #define     TDUMMY      3
00532 /* TBREAK represents time break traces              */
00533 #define     TBREAK      4
00534 /* UPHOLE represents uphole traces              */
00535 #define     UPHOLE      5
00536 /* SWEEP represents sweep traces                */
00537 #define     SWEEP       6
00538 /* TIMING represents timing traces              */
00539 #define     TIMING      7
00540 /* WBREAK represents timing traces              */
00541 #define     WBREAK      8
00542 /* NFGUNSIG represents near field gun signature         */
00543 #define     NFGUNSIG    9   
00544 /* FFGUNSIG represents far field gun signature          */
00545 #define     FFGUNSIG    10
00546 /* SPSENSOR represents seismic pressure sensor          */
00547 #define     SPSENSOR    11
00548 /* TVERT represents multicomponent seismic sensor 
00549     - vertical component */
00550 #define     TVERT       12
00551 /* TXLIN represents multicomponent seismic sensor 
00552     - cross-line component */
00553 #define     TXLIN       13
00554 /* TINLIN represents multicomponent seismic sensor 
00555     - in-line component */
00556 #define     TINLIN  14
00557 /* ROTVERT represents rotated multicomponent seismic sensor 
00558     - vertical component */
00559 #define     ROTVERT     15
00560 /* TTRANS represents rotated multicomponent seismic sensor 
00561     - transverse component */
00562 #define     TTRANS      16
00563 /* TRADIAL represents rotated multicomponent seismic sensor 
00564     - radial component */
00565 #define     TRADIAL     17
00566 /* VRMASS represents vibrator reaction mass */
00567 #define     VRMASS      18
00568 /* VBASS represents vibrator baseplate */
00569 #define     VBASS       19
00570 /* VEGF represents vibrator estimated ground force */
00571 #define     VEGF        20
00572 /* VREF represents vibrator reference */
00573 #define     VREF        21
00574 
00575 /*** CWP trid assignments ***/
00576 /* ACOR represents autocorrelation  */
00577 #define     ACOR        109
00578 /* FCMPLX represents fourier transformed - no packing 
00579    xr[0],xi[0], ..., xr[N-1],xi[N-1] */
00580 #define     FCMPLX      110
00581 /* FUNPACKNYQ represents fourier transformed - unpacked Nyquist
00582    xr[0],xi[0],...,xr[N/2],xi[N/2] */
00583 #define     FUNPACKNYQ  111
00584 /* FTPACK represents fourier transformed - packed Nyquist
00585    even N: xr[0],xr[N/2],xr[1],xi[1], ...,
00586     xr[N/2 -1],xi[N/2 -1]
00587    (note the exceptional second entry)
00588     odd N:
00589      xr[0],xr[(N-1)/2],xr[1],xi[1], ...,
00590      xr[(N-1)/2 -1],xi[(N-1)/2 -1],xi[(N-1)/2]
00591    (note the exceptional second & last entries)
00592 */
00593 #define     FTPACK      112
00594 /* TCMPLX represents complex time traces            */
00595 #define     TCMPLX      113
00596 /* FAMPH represents freq domain data in amplitude/phase form    */
00597 #define     FAMPH       114
00598 /* TAMPH represents time domain data in amplitude/phase form    */
00599 #define     TAMPH       115
00600 /* REALPART represents the real part of a trace to Nyquist  */
00601 #define     REALPART    116
00602 /* IMAGPART represents the real part of a trace to Nyquist  */
00603 #define     IMAGPART    117
00604 /* AMPLITUDE represents the amplitude of a trace to Nyquist */
00605 #define     AMPLITUDE   118
00606 /* PHASE represents the phase of a trace to Nyquist     */
00607 #define     PHASE       119
00608 /* KT represents wavenumber-time domain data            */
00609 #define     KT      121
00610 /* KOMEGA represents wavenumber-frequency domain data       */
00611 #define     KOMEGA      122
00612 /* ENVELOPE represents the envelope of the complex time trace   */
00613 #define     ENVELOPE    123
00614 /* INSTPHASE represents the phase of the complex time trace */
00615 #define     INSTPHASE   124
00616 /* INSTFREQ represents the frequency of the complex time trace  */
00617 #define     INSTFREQ    125
00618 /* DEPTH represents traces in depth-range (z-x)         */
00619 #define     TRID_DEPTH  130
00620 /* 3C data...  v,h1,h2=(11,12,13)+32 so a bitmask will convert  */
00621 /* between conventions */
00622 /* CHARPACK represents byte packed seismic data from supack1    */
00623 #define     CHARPACK    201
00624 /* SHORTPACK represents 2 byte packed seismic data from supack2 */
00625 #define     SHORTPACK   202
00626 
00627 /* #define ISSEISMIC(id) (( (id)==0 || (id)==TREAL || (id)==TDEAD || (id)==TDUMMY ) ? cwp_true : cwp_false ) */
00628 #define ISSEISMIC(id) (( (id)==0 || (id)==TREAL || (id)==TDEAD || (id)==TDUMMY || \
00629                          (id)==TVERT || (id)==TXLIN || (id)==TINLIN || \
00630                          (id)==TRADIAL || (id)==TTRANS  ) ? cwp_true : cwp_false ) 
00631 
00632 /* FUNCTION PROTOTYPES */
00633 #ifdef __cplusplus /* if C++, specify external linkage to C functions */
00634 extern "C" {
00635 #endif
00636 
00637 int fgettr(FILE *fp, segy *tp);
00638 int fvgettr(FILE *fp, segy *tp);
00639 void fputtr(FILE *fp, segy *tp);
00640 void fvputtr(FILE *fp, segy *tp);
00641 int fgettra(FILE *fp, segy *tp, int itr);
00642 
00643 /* hdrpkge */
00644 void gethval(const segy *tp, int index, Value *valp);
00645 void puthval(segy *tp, int index, Value *valp);
00646 void getbhval(const bhed *bhp, int index, Value *valp);
00647 void putbhval(bhed *bhp, int index, Value *valp);
00648 void gethdval(const segy *tp, char *key, Value *valp);
00649 void puthdval(segy *tp, char *key, Value *valp);
00650 char *hdtype(const char *key);
00651 char *getkey(const int index);
00652 int getindex(const char *key);
00653 void swaphval(segy *tp, int index);
00654 void swapbhval(bhed *bhp, int index);
00655 void printheader(const segy *tp);
00656 
00657 void tabplot(segy *tp, int itmin, int itmax);
00658 
00659 #ifdef __cplusplus /* if C++, end external linkage specification */
00660 }
00661 #endif
00662 
00663 #endif

Generated on 5 Jan 2017 for IWAVE by  doxygen 1.4.7